Nick Hodges is running a nice series of design pattern articles these days. They are based on the Java examples in the “Head First Design Pattern” book.
These examples are of course easy to replicate in Smart Mobile Studio.
There are a few difference between the Delphi and Smart Pascal languages, but it’s mostly cut’n’paste and minor resolvents to have the examples running under Smart.
Take a look at the Observer Pattern, for instance.
You can read Nick’s article at his blog, and you can download his Delphi code from bitbucket.org.
The Smart version of this code can be downloaded from http://smartmobilestudio.com/SmartCode/HFDP/Observer.opp.
We had to add an additional TWeatherDataDisplay class to the original example, of course…
[code]
TSmileyDisplay = class(TForecastDisplay)
public
procedure Display; override;
end;
[/code]
This is what you get:
(Can also be executed directly from http://www.smartmobilestudio.com/smartdemo/HFDP/Observer/)