In fear of bloated Statergy Pattern Implementations
-
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. EachFunc
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? -
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. EachFunc
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 wrote:
If But now I concern about the rising number of this statergy pattern implementations.
Why? There's also a rising amount of code. The amount does not say much in itself - if the usage is justified, it is not bloat. If it is there just to say "look, I'm doing patterns" without adding value (there's always cost) then it is bloat.
popchecker wrote:
o me, this implementation is more primitive than Object Oriented approach.
A parser might be handy.
popchecker wrote:
I just want to know which one is more adaptable.
Which approach compared to which other approach?
Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^][](X-Clacks-Overhead: GNU Terry Pratchett)
-
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. EachFunc
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 wrote:
I am working on a CSS parser ...
Before you re-invent the wheel, have you seen this project[^]?
"These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer
-
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. EachFunc
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 wrote:
If But now I concern about the rising number of this statergy pattern implementations
10? 1000? 100,000?
popchecker wrote:
Before analyzing the performace like aspects
I would expect that profiling would determine that implementation methodology of accessing the functionality would have zero impact (just noise) for either method The functionality represented by each and the usage to which each is put would be the problem. If there even is a problem.