CIS 3100 Structured Programming Intro

Figure 1 a class object a business example for

This preview shows 3 out of 8 pages.

 
Image of page 3

Subscribe to view the full document.

 
Image of page 4
Figure 1: A Class Object   A BUSINESS EXAMPLE   For example, let’s say your organization sells automobiles. Maybe it is a car dealership. You most  certainly will have customers. You have new customers and you'll have existing customers. You’ll  have customers who buy trucks and you have customers who buy cars. You’ll need to create  programs that use customer data for the sales department, for the service department, and for  the accounting department. For all customers, there is certain customer data and modules that  would be common to all applications that need to use or manipulate customer information. The  information pertaining to customer name, customer address, the vehicle type purchased, vehicle  information number, sales price of the vehicle, etc. would certainly be common to applications  written for the accounting and sales departments.   In addition to customer data, there are blocks of logic (modules are called methods by most OOP  programming languages) that would also be the same from department to department and from  application to application. Maybe an example of a customer module might be a block of logic  which calculates the monthly payment, a late penalty, or loan balance.   Programming Tip:  When programming in OOP, modules are usually referred to as methods.  
Image of page 5

Subscribe to view the full document.

  Figure 2: Graphic of Customer Class       The programmers for this car dealership may write software exclusively for one department  (maybe the Sales Department) or write programs for all the departments (Accounts Receivable,  Marketing, Service, etc.). If the basic data and logic for the customer is created in a way that it  can be used in multiple applications then this would save time in developing and maintaining  existing applications. There’s an old expression which talks about not “reinventing the wheel.” 
Image of page 6
Reinventing the wheel has come to mean inventing the solution to a task when the task has  already been done by someone else.       In the context of programming, it would describe the situation where two programmers need logic  to calculate late payment fees and they both independently develop their own logic instead of  sharing. If the logic exists already there's no need to recreate it. It is much more efficient for one  class object to be created to represent a customer data and logic, then to have each programmer  create a unique data and logic definition for each program that works with customer information.  The duplication can actually lead to quality problems since it is possible for both programmers to  create a solution based on there interpretation. As is often the case, two people can see the 
Image of page 7

Subscribe to view the full document.

Image of page 8
You've reached the end of this preview.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern