Originally posted by Ilja Preuss:
Which slide(s) do you get that from?
Study of the design patterns book: 16 of 23 patterns have qualitatively simpler implementation in Lisp or Dylan than in C++ for at least some uses of each pattern
16 of 23 patterns are either invisible or simpler, due to:
First-class types(6): Abstract-Factory, Flyweight, Factory Method, State, Proxy, Chain-Of-Responsibility. First-class functions(4): Command, Strategy, Template-Method, Visitor Macros(2): Interpreter, Iterator Method Combination (2): Mediator, Observer Multimethods (1): Builder Modules (1): Facade
Originally posted by Ilja Preuss:
I think the answer is in that a pattern is more than just a code template.
Dynamic versions needs only the Window classes. The classes themselves serve as factories. This works because classes are first-class values. We can say make(c).
However this probably highlights why some members of the Lisp community were a bit perplexed when the GoF patterns got the all that attention back in 1995: "What is all the fuss about? We've been doing this stuff since the 1960s with a handful lines of code."Originally posted by Stan James:
If it's a one-line implementation, that's very cool.
Sounds to me like a Strategy-Factory then.
I'm curious: when would a design pattern be worthy its name, in your opinion?
And how many of the GoF patterns, for example, do you know?
Well, I agree that design patterns can be language specific, and that some can be quite simple. I don't see how it directly follows that they don't have value, though.
I don't know about special variables, but I have a very strong dislike for the Singleton pattern, anyway. They are just globals in disguise - with all their typical problems.
If examining a zillion Lisp programs would not reveal the GoF patterns, would it reveal a whole different set of patterns? Patterns are just common solutions to common problems. I'd rather expect to see Lisp gurus around the world solving similar problems in similar ways that could be written up in the GoF style pattern language. Do patterns show up a weakness in the language, or show off its strengths?
Or maybe some language has reached the place where every line of code sings of the business domain. I'd much rather write and read code about insurance and call centers than http sessions and strategy factories.
Compare "can we use a Strategy there" with "can we pass in a function there that gets called inside the algorithm so that we can customize it?"
Originally posted by Ricky Clarkson:
For example, a C program that needs a shared library is using some late binding
Note, dynamic binding is orthogonal to dynamic linking...
Originally posted by Ricky Clarkson:
Wikipedia seems to agree with my use of late binding - http://en.wikipedia.org/wiki/Name_binding
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
Originally posted by Peer Reynders:
Actually I think you are talking about dynamic linking here, not dynamic binding.
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
Originally posted by Ricky Clarkson:
Wikipedia seems to agree with my use of late binding
Originally posted by Ilja Preuss:
Is dynamic binding the same as late binding?
Originally posted by Ricky Clarkson:
Ilja seems to confuse polymorphism, which is a type-based form of late binding, with late binding itself, which is not necessarily type-based.
quote:
--------------------------------------------------------------------------------
Sounds to me like a Strategy-Factory then.
--------------------------------------------------------------------------------
Not really - an object with references to two functions isn't actually a factory - it doesn't create anything, or appear to create anything.
Taking patterns outside their usual context, Bridge is a pattern worthy of its name, in terms of the real-world constructs that get you over rivers. Performing some mental acrobatics, we can imagine that in the future we might construct roads in the sky unsupported. Calling part of that road a bridge just because it happens to go over a river would be odd; i.e., the Bridge pattern has been obsoleted.
In programming, such physical limitations don't exist in the same way. As long as an abstraction doesn't cost a significant amount more than the repeated pattern, there's always a good way of making a design pattern obsolete.
quote:
--------------------------------------------------------------------------------
And how many of the GoF patterns, for example, do you know?
--------------------------------------------------------------------------------
Begin Sarcasm. Oh, I love this kind of question. End Sarcasm.
I've, at various points, learned a little about all those patterns, and a lot about some.
I suppose the next one is "Have you worked on any real-world projects?"
The reason that they're language specific is that the language isn't flexible enough to handle the abstraction, so the pattern has to be implemented, repeatedly.
If I designed a programming language that didn't support recursion, you could translate your recursive algorithms into iterative ones with a stack object, and you could give that a pattern name, but it doesn't mean that the pattern is worth its name, just that the language I designed isn't.
It's worth learning about special variables, because they are globals that you can temporarily change the value of. They remove some of the problems that globals have in other languages. Even if you never use that, you can at least appreciate that there is a kind of global that isn't retarded.
That is, a pattern that exists among developers is that of limited code-reuse. I'd like to see that change, but Intellectual Property rules make it a bit hard to change it.
quote:
--------------------------------------------------------------------------------
Compare "can we use a Strategy there" with "can we pass in a function there that gets called inside the algorithm so that we can customize it?"
--------------------------------------------------------------------------------
How about: "Can we use a callback there?"?
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
Originally posted by Peer Reynders:
In the context of dynamic languages which tend to be weakly typed
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
The private methods of a certain class can only be accessed by the following two categories :
A- Any method inside the same instance of the class.
B- Any method inside a different instance of the class.
Originally posted by Ilja Preuss:
Weak/strong typing is about whether the type of an "object" is checked at runtime.
Originally posted by Mr. C Lamont Gilbert:
I believe overloading is polymorphism.
A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
Originally posted by Frank Carver:
In the reportedly wonderful, flat and even, land of Lisp there may be no use for a bridge, but for it to be recognized as a pattern there must be a use elsewhere.
Originally posted by Frank Carver:
One key aspect stressed very heavily by the original design patterns community is that a particular approach or piece of code is only considered to be a pattern once it has been observed "in the wild" at least three times.
Originally posted by Peer Reynders:
The "Design Pattern" status of the "Bridge Pattern" was never challenged, neither in this thread nor in Norvig's presentation.
There is still the notion out there that design should be independent of the implementation (language).
I�m sure that there are many patterns that are tremendously useful to specific communities � however at what point should a useful pattern deserve to be called a �design pattern�?
Another thought: While GoF didn�t use UML as such (but something like it), both the GoF and UML are decidedly Object-Oriented. So the use of OO Design Patterns and OO Modeling/Notation could conceivably constrain us into OO solutions.
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
Originally posted by Ilja Preuss:
Only if we constrain ourselves to using those tools, or so it seems to me.
Originally posted by Ilja Preuss:
In my not so humble opinion, that's just plain illogical. Designing is about structuring code so that we can work effectively with it. It seems obvious to me that how we structure code would depend on what tools the language supports to structure the code.
Originally posted by Frank Carver:
And, just like Design Patterns, a lot of the value is in the name.
Originally posted by Frank Carver:
Does anyone remember "algorithms" ?
PJ Murray -
Originally posted by PJ Murray:
What have algorithms gone out of fashion?
I'm not sure if I approve of this interruption. But this tiny ad checks out:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
|