Solved

Object Oriented program samples

Posted on 1998-11-25
3
157 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

733 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