Solved

Object Oriented program samples

Posted on 1998-11-25
3
153 Views
Last Modified: 2013-11-23
I had been writing an MIS database program which involves customer information entry, deletion, search...etc. Now, i am told to re-arrange this program by using object-oriented logic. With that in mind i determined some objects. But the objects i chose are barely the tables i have. i am not sure about this to be correct. I need some examples of object-oriented programs in Delphi and advice on how to implement this situation in object-oriented manner.  First i said there is a manager which manages works around, a screen object which would write on screen, an I/O object which will do the I/O works (read/write database) but... that doesn't make sense! Delphi already have objects for screen TScreen, TForm and for databases TQuery, TTable. Why do i write these objects again? I need some examples in Delphi written with object-oriented logic.
Any help is appreciated.
0
Comment
Question by:Cuneyt
3 Comments
 
LVL 5

Expert Comment

by:scrapdog
ID: 1347824
Almost all Delphi programs are object-oriented, at least object based.  If you are already using TForm, TScreen, TQuery, etc. you are already using object-based programming.  By object-oriented logic, do you mean that you want to make your own objects/components?
0
 
LVL 15

Accepted Solution

by:
Tommy Hui earned 200 total points
ID: 1347825
Perhaps you should think of your application as not object-oriented (which it already is, because you're using TQuery, TTable, etc.), but instead think of transactions.

A transaction can be thought of like an ATM bank machine transaction. You want to withdraw money or transfer money. But the task of transferring money may require several TQueries or TTables. In this sense, a transaction is an operation on several objects and the transaction itself is an object. Is this the idea you were looking for?

The other nice things about transactions is roll-back. The idea here is that during the process of updating several database tables for the ATM transfer, something terribly wrong can happen. If an application was designed correctly (as most bank ATMs are), then you can be sure that the transaction either happened completely (i.e. no extra money produced by adding to one account and not subtracting it from another) or nothing happened at all.

While using objects to create programs are great. It requires quite a bit of design work to filter out the important objects and how to create them correctly.
0
 

Author Comment

by:Cuneyt
ID: 1347826
I already know that Delphi is an Object-Oriented programming language and all programs i write in Delphi is based on objects. But i had written a database program in Delphi. And now i am told to rewrite it with the object oriented manner. And i am looking for examples.
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now