Solved

Object Oriented program samples

Posted on 1998-11-25
3
154 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
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…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.

867 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

19 Experts available now in Live!

Get 1:1 Help Now