[Lazarus] Quick Modern Object Pascal Introduction, for Programmers

Graeme Geldenhuys mailinglists at geldenhuys.co.uk
Thu Jun 23 10:40:36 CEST 2016


On 2016-06-23 00:25, Travis Ayres wrote:
> 
> I don't understand the problem tiOPF is trying to solve well enough to
> fully grok it in context - I've never used a database, only flat files.

Well, you wanted quality examples of design patterns using Object
Pascal. tiOPF gives you that, and so does my articles.

tiOPF is an Object Persistence Framework (and more). Instead of working
with Datasets, TFields, a database specific component, a ton of event
handlers and all code dumped into the Form unit (gui layer) — which
99.9% of the time ends up being unmaintainable and not very reusable.

tiOPF steers you into separating your storage, business rules and UI
into separate layers. This makes for much more maintainable code, much
easier to unit test and code reuse of the business rules. In many of my
applications I’ve created GUI, Console and CGI applications from the
same set of business rule classes — thanks to tiOPF.

tiOPF also allows you to switch between DB connection component (SqlDB,
Zeos, DOA, IBX etc) and even switch between database storage (Firebird,
Oracle, MS SQL Server, MySQL, TAB, CSV, XML etc)… all without needing to
make a code change in you application. Simply toggle a compiler define
and recompile. The same goes for Client/Server and 3-tier applications.

As I hinted at above, tiOPF can also do persistence to something other
than a database. Like a flat file, and currently supplies CSV, TAB and
XML persistence layers to accomplish that.

The reason I said “and more” earlier, is because I often write
non-database applications, and still use tiOPF. Simply because tiOPF
(thanks to all the design patterns it implements) has so many useful
features and utility functions. The whole framework is backed by 1700+
unit tests that run every 3 hours, 24/7 to make sure in stays in a
stable state, and than any newly introduced errors are very quickly
detected and fixed.

Maybe the “Concepts Documentation” will help shed some light on what
tiOPF tries to (and does) accomplish. Especially chapters 1–3. It’s a
relatively quick read.

  http://tiopf.sourceforge.net/Doc/Concepts/index.shtml


Either way, I hope you find the design pattern example code useful.


Regards,
  Graeme

-- 
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/

My public PGP key:  http://tinyurl.com/graeme-pgp



More information about the Lazarus mailing list