Design patterns for (x)harbour

You can share your experience with HMG. Share with some screenshots/project details so that others will also be benefited.

Moderator: Rathinagiri

Post Reply
User avatar
santy
Posts: 60
Joined: Tue Sep 25, 2012 11:19 am
Location: Ukraine, Lviv
Contact:

Design patterns for (x)harbour

Post by santy »

Hi all,

Repeating design patterns I decided to create examples of their implementation for (x)Harbour.
First two patterns.

Facade pattern:
http://code.google.com/p/santysoft/down ... akechanges

Mediator pattern:
http://code.google.com/p/santysoft/down ... akechanges

to be continued. :)
Best regards,
Oleksandr Antypenko
xHarbour 1.2.3 , Harbour 3.x + Mingw 4.x (HMG, minigui)
https://bitbucket.org/aantypenko
https://github.com/aantypenko
User avatar
santy
Posts: 60
Joined: Tue Sep 25, 2012 11:19 am
Location: Ukraine, Lviv
Contact:

Re: Design patterns for (x)harbour

Post by santy »

Singleton pattern:
http://code.google.com/p/santysoft/down ... akechanges

to be continued.
Best regards,
Oleksandr Antypenko
xHarbour 1.2.3 , Harbour 3.x + Mingw 4.x (HMG, minigui)
https://bitbucket.org/aantypenko
https://github.com/aantypenko
User avatar
santy
Posts: 60
Joined: Tue Sep 25, 2012 11:19 am
Location: Ukraine, Lviv
Contact:

Re: Design patterns for (x)harbour

Post by santy »

Builder pattern
http://code.google.com/p/santysoft/down ... akechanges

Two simple example using this pattern (in archive):

Computer builder and Report Builder. :)


to be continued.
Best regards,
Oleksandr Antypenko
xHarbour 1.2.3 , Harbour 3.x + Mingw 4.x (HMG, minigui)
https://bitbucket.org/aantypenko
https://github.com/aantypenko
User avatar
santy
Posts: 60
Joined: Tue Sep 25, 2012 11:19 am
Location: Ukraine, Lviv
Contact:

Re: Design patterns for (x)harbour

Post by santy »

Template method pattern
Intent. Define the skeleton of an algorithm in an operation, deferring some steps to subclasses. Template Method lets subclasses redefine certain steps of an algorithm without changing the algorithm's structure

http://code.google.com/p/santysoft/down ... akechanges


to be continued.
Best regards,
Oleksandr Antypenko
xHarbour 1.2.3 , Harbour 3.x + Mingw 4.x (HMG, minigui)
https://bitbucket.org/aantypenko
https://github.com/aantypenko
User avatar
santy
Posts: 60
Joined: Tue Sep 25, 2012 11:19 am
Location: Ukraine, Lviv
Contact:

Re: Design patterns for (x)harbour

Post by santy »

Decorator pattern
Intent. Attach additional responsibilities to an object dynamically. Decorators provide a flexible
alternative to subclassing for extending functionality.

http://code.google.com/p/santysoft/down ... akechanges

Factory Method pattern
Intent. Define an interface for creating an object, but let subclasses decide which class to
instantiate. Factory Method lets a class defer instantiation to subclasses.

http://code.google.com/p/santysoft/down ... akechanges
Best regards,
Oleksandr Antypenko
xHarbour 1.2.3 , Harbour 3.x + Mingw 4.x (HMG, minigui)
https://bitbucket.org/aantypenko
https://github.com/aantypenko
User avatar
santy
Posts: 60
Joined: Tue Sep 25, 2012 11:19 am
Location: Ukraine, Lviv
Contact:

Re: Design patterns for (x)harbour

Post by santy »

Prototype pattern
Intent. Specify the kinds of objects to create using a prototypical instance, and create new objects by
copying this prototype

http://code.google.com/p/santysoft/down ... r&can=2&q=

to be continued :)
Best regards,
Oleksandr Antypenko
xHarbour 1.2.3 , Harbour 3.x + Mingw 4.x (HMG, minigui)
https://bitbucket.org/aantypenko
https://github.com/aantypenko
User avatar
esgici
Posts: 4543
Joined: Wed Jul 30, 2008 9:17 pm
DBs Used: DBF
Location: iskenderun / Turkiye
Contact:

Re: Design patterns for (x)harbour

Post by esgici »

Thanks Alex

Regards
Viva INTERNATIONAL HMG :D
Post Reply