I am working on a CSS parser which requires to implement each algorithm to parse different CSS selectors. So I saw a Statergy Pattern there. Everything working perfect and satisfies the Open/Closed principle. If But now I concern about the rising number of this statergy pattern implementations. Also I am expected to include few more in near future. I can implement this in a different method like an array of Func
methods. Each Func
method will encapsulate the algorithm to parse different CSS selectors. To me, this implementation is more primitive than Object Oriented approach. Before analyzing the performace like aspects, I just want to know which one is more adaptable. It is difficult for me to judge which one is more better design. Can you please help me on this?
popchecker
Posts
-
In fear of bloated Statergy Pattern Implementations -
ASP.NET 5Ubuntu (My favorite operating system) finally meets .NET (My favorite programming environment). I feel on top of the world. :-D
-
'Interface' Considered Harmful : Uncle BobSorry I was perplexed
-
'Interface' Considered Harmful : Uncle BobThank you! :)
-
'Interface' Considered Harmful : Uncle BobOh that explains the hatred towards my question. But I was not trying to degrade that article. All I meant about the technical aspects of that idea. Sorry for my ignorance; I thought my solution can overcome the problem specified in the article. Thanks, Pop
-
'Interface' Considered Harmful : Uncle BobWas that a brainless question? :(
-
'Interface' Considered Harmful : Uncle Bob:-D
-
'Interface' Considered Harmful : Uncle BobHi, In his recent blog[^] Uncle Bob come up with a situation that explains
interface
is harmful. Here is the code snippet taken from his blog.public class Subject {
private List<Observer> observers = new ArrayList<>();
private void register(Observer o) {
observers.add(o);
}
private void notify() {
for (Observer o : observers)
o.update();
}
}public class MyWidget {...}
public class MyObservableWidget extends MyWidget, Subject {
...
}Here he explains that to implement Observer pattern done correctly, compilers must allow multiple inheritance. So my question is why don't the
MyObservableWidget
implement using dependency injection like below to avoid multiple inheritance with greater degree of separation of concerns?public class MyObservableWidget extends MyWidget {
private Subject subject;
public MyObservableWidget(Subject subject) {
this.subject = subject;
}}
Of course the
Subject
class should be an abstract class. Please let me know your thoughts. Thanks, Pop -
Programming For Fun: The Dark SideThe rising popularity of Mac OS make me curious about it. But a Mac machine still not affordable for me. So I decided to try an open source alternative.
-
Programming For Fun: The Dark SideAspDotNetDev wrote:
Are any of you learning something completely useless for your job?
Yes, I am going to download Darwin OS (As a .NET guy, it is completely an alien world for me). Regards, Poppy
-
Go Voyager !Quote:
Shall I go? Shall I stay? 107 light years away Many times, so many doubts But no reason to talk about Mission is over, mission is done I will miss you, children of the sun Now it's time to go away Goodbye, goodbye Milky Way For a better world without hate Follow your heart, believe in fate Only visions and the mind Will guide you to the light Mission is over, mission is done I'll miss you, children of the sun Now it's time to go and say Goodbye, goodbye Milky Way Mission is over, mission is done I will miss you, children of the sun I go home, until someday I say goodbye, goodbye Milky Way 5 billions years, the Andromeda galaxy Will collide with our Milky Way A new gigantic cosmic world will be born
-
What are the criterias for a featured article?When i read that article, first came into my mind that it ain't have a quality to be a featured article on Codeproject. I didn't mean to remove or down rate the article. I just wanted to share my thoughts with you(May be you misunderstand me because I posted it in Site Bugs / Suggestions forum). But, you have a good point. So many people like it and naturally it is popular now. In that sense, it is okay. I agree with that 100%
-
What are the criterias for a featured article?Richard MacCutchan wrote:
who are we to demand its removal?
I dont want to remove it. I ain't even down vote it. As a dutiful member of Codeproject community, I will honor every small contributions. I was just think about the average quality of the articles on this top-notch site.
-
What are the criterias for a featured article?But everybody should have an alternate choice ;P
-
What are the criterias for a featured article?Pete O'Hanlon wrote:
Don't they deserve love?
Ah, sorry I forgot you for a moment. But do you really think that I don't care you?
-
What are the criterias for a featured article?Richard MacCutchan wrote:
it's quite popular with CPians
Does it deserve that?
-
What are the criterias for a featured article?Free Dating Sites[^] I dont know how this dump could be a featured article on codeproject homepage.
-
These Occupy People are getting Everywhere!Still they can't occupy google
-
Some photographs I clickedd@nish wrote:
30 ft is not at all a safe distance
I know that, I had an experience. Few years before I and my friends with a forest guard had a trekking on a rain forest. We were taking pictures of an elephant family. Suddenly they identified our presence. They lined up and stood still like rocks. Th guard said this is not good and let's move back. But how stupid us! We stood up and took our last snaps. Suddenly they attacked us. We fled and managed to save our lives. :sigh:
-
Bored, because...:-O I just wanted to support you. At least I could make you laugh at me. I am happy. :)