My base problem is that I would like to have an interface define a shared function, although through vb (the CLR from what i've read) does not allow for it. After reading, I don't think there is a single solution to this problem, so let me give you some context.
I am trying to implement MVC with a program that interprets logs, and spits it out in a format that will allow the users to possibly debug, or at least know more about what happened in case something goes wrong. My view handles the gui, which will soon change to a web interface. My controller handles the input, and then my model handles the raw data. I then have seperate classes handle the business logic, since they might change by themselves later on - this is where I would like to enforce the shared function. One of the functions I need from the business logic is to interpret any given line of a log. I could name this class 'LogConverter'. Since it has no state, I would like it to have the method 'public shared function ConvertLog(byval log as string) as string'. Later, I was assuming someone might want to implement the converter differently, so I figured this method would be defined and implemented through ILogConverter - but obviously I can't do this.
according to this read Shared functions with interface, a singleton pattern is the way to go. However, the singleton in this case seems as much a hack as simply leaving it to the instance itself - which was going to be my solution. Is there any clean way of accomplishing my goal?
thank you,
Phil
I am trying to implement MVC with a program that interprets logs, and spits it out in a format that will allow the users to possibly debug, or at least know more about what happened in case something goes wrong. My view handles the gui, which will soon change to a web interface. My controller handles the input, and then my model handles the raw data. I then have seperate classes handle the business logic, since they might change by themselves later on - this is where I would like to enforce the shared function. One of the functions I need from the business logic is to interpret any given line of a log. I could name this class 'LogConverter'. Since it has no state, I would like it to have the method 'public shared function ConvertLog(byval log as string) as string'. Later, I was assuming someone might want to implement the converter differently, so I figured this method would be defined and implemented through ILogConverter - but obviously I can't do this.
according to this read Shared functions with interface, a singleton pattern is the way to go. However, the singleton in this case seems as much a hack as simply leaving it to the instance itself - which was going to be my solution. Is there any clean way of accomplishing my goal?
thank you,
Phil