Delphi and the Decorator Pattern
Delphi and the Decorator Pattern
http://www.nickhodges.com/post/Delphi-and-the-Decorator-Pattern.aspx
http://www.nickhodges.com/post/Delphi-and-the-Decorator-Pattern.aspx
http://www.nickhodges.com/post/Delphi-and-the-Decorator-Pattern.aspx
http://www.nickhodges.com/post/Delphi-and-the-Decorator-Pattern.aspx
Very nice example!
ReplyDeleteIt wasn't mine -- it came directly from the book. ;-)
ReplyDeleteBut thanks.
THe kindle edition of the book is only $1 cheaper than the actual book.
ReplyDeleteI wouldn't recommend getting the Kindle version. There are lots of illustrations and such, it and I don't think it would work well for on a Kindle.
ReplyDeleteI might be stupid, but I don't find a way to find all your posts related to design patterns on your website.
ReplyDeleteI know these pattern but I would like to recommend the reading of your articles to my colleagues , who are still using delphi in a procedural way (they still use delphi 4) but are preparing migration to XE3 ...
All Kindle books purchased can now be seen in full color and complete with active links using the Amazon Reader which syncs with your Kindle
ReplyDeletehttps://read.amazon.com/
Great book, I always have it near my desk. Thanks for implementing the pattern demos!
ReplyDeleteNick Hodges
ReplyDeleteA have a little question:
"type
TBeverage = class
...
public
function Cost: Double; virtual; abstract;
property Description: string read GetDescription write SetDescription;
end;
The base class is abstract. It has two properties, with the Cost property being read-only and having an abstract, virtual setter. "
maybe you mean "getter" ?
Nick Hodges I have had my Kindle for over two years now, and have yet to find a software book which is not annoying on Kindle. It appears as though the publishers think they should be able to get on Kindle without doing additional work in formatting, and of course, woth a 600x800 screen, that's wishful thinking, at best. And many of the non-software books appear to have been scanned, and badly proofed (if at all). I have returned a few that were so bad they should never have been offered for sale.
ReplyDeleteSteven Healey Using Amazon Reader would be a reasonable solution for some of the software books which are not well formatted for Kindle. However, I love my Kindle because whenever I have to wait somewhere, it is there, and I need not have my time wasted on waiting room magazines. I won't carry a laptop for such service; Kindle is far more convenient.
ReplyDeleteWould you mind if we tried to run these examples in Smart Mobile Studio? (Or perhaps we could convince you to try that yourself...)
ReplyDeleteIMHO, such examples would really benefit from being "pure Pascal" (and reusable in several Pascal-based environments), rather than bound to "Delphi"...
Jørn Einar Angeltveit Hey, feel free.
ReplyDeleteAnd I'd love to try it myself as well, though I don't have a copy of Smart Mobile Studio. ;-)
Olivier SCHWAB I've create a category for these posts:
ReplyDeletehttp://www.nickhodges.com/category/Patterns.aspx
And so you should be able to find that that way from now on.
Thanks Nick Hodges , you're great !
ReplyDeleteOlivier SCHWAB You are too kind. ;-)
ReplyDeleteIgor Schevchenko Yes, thanks for the correction. I've fixed the article.
ReplyDeleteWith only a few modifications, the code was pretty easy to "port" to Smart. (No need (support) for GUID in the interfaces and no generics).
ReplyDeleteYou can test the solution online in the widget in this article: http://smartmobilestudio.com/2013/02/08/design-patterns-observer/.
Oh. I had to add another TWeatherDataDisplay class. Guess which :-)