No announcement yet.

Why Should I Use Objects

  • Filter
  • Time
  • Show
Clear All
new posts

  • Why Should I Use Objects

    Please add your comments and suggestions as a Reply to this thread.

    PB/WIN - Why should I use objects?
    • Objects help you maintain your code. Objects break up your project into small, easily viewed parts. Usually, the input and output is clearly defined. You have all of the code and all of the data right at your fingertips.
    • Objects help you write bug-free code. When you keep an object small and well-defined, you greatly enhance the stability of your programs. Consider the comparison to procedural programming: With standard Subs and Functions, it's typical to create the data (variables) in the calling code, but manipulate the data in the target procedures when they are executed. This separation of code and data has caused some of the most insidious bugs known to programmers. When you need to extend the range of data to a larger data type, it's easy to change the code. A piece of cake, so to speak. But what about the data? Now you must search out every reference to every involved Sub and Function. Find every data creation, every data change, and every other reference to these variables. What are the chances of missing a critical one? Far too great to ignore.
    • Objects help you re-use your code. Since the object contains all the subroutines, and all the data, how could it be easier? Put one object source in one include file... Or put it in one DLL... Just use it when you need it!
    • Objects help with team programming. Objects are self-contained. All of the subroutines and all of the data, all in one concise place. It's easy to create a precise definition for each object, and there's little dependency between the implementation of various objects. Each team member builds an object, one at a time, so it all comes together neatly in the end.
    • Objects are an increasingly popular standard. Do you need to access the Windows API? Many of the newer API functions (DirectX graphics, for example) use only an object interface, and nothing else. If you don't use objects, you simply can't access them. Do you want to control an important application, like an Internet browser, word processor, or spreadsheet? COM objects are the only way to do it. As time goes by, objects will only become more embedded in day-to-day programming. Don't be left behind!
    See AlsoReferences
    Last edited by Gary Beene; 28 Oct 2014, 10:56 PM.