III. Hard to maintain – if we add a new parameter for thecar, we will have to go over all the code baseII. Many repetitions (like carMake is written 6 times) andit looks messy easy to make the error (there are errors in last two calls),this contributes to the low performance.I. Business-logic code (the definition of car propertiesand the toString() method) is mixed with the client code (the part wherewe call toString()), we can not separate them, because client code refersto the global variables we created (like myCarMake). Thus an inflexibleimplementation approach. ProceduralProperties : iii.
Easier to modify (if we add a new property for thecar, the myCar.toString() calls in client code don’t need to be changed).ii.
Less repetitions and in general the code looks cleareronce the object is defined, it is really complex to make the error (you just domyCar.toString()), no parameters passing, no chance to mix them or pass in thewrong order. Thus a plus in performance.i.
The business logic is clearly defined and separatedfrom the client code, client code is not aware of internal structure of the Car object,thusflexible implementationOOPProperties :As shown inthe sample code: For OOP theperformance can highly be improved compared to Procedural programming as thecomplexity of a given program. Performance This is wellshown in the sample example code, included in this report. Designing thefunction to print the car information in OOP is much flexible than inProcedural approach.Whendesigning in Object-oriented Programming or Procedural Programming languages,the developer will need to have a plan for the program before actually writingany code. Procedural Programming can be a tempting solution for many developersbecause it means they can usually jump into coding quicker, but it can be atime consuming solution later when changes to the code are needed.Additionallythe up-front planning that is involved in Object-oriented Programming can payoff in the long run when changes or additions are needed and during thedebugging process.
Implementation One of themost important characteristics of procedural programming is that it relies onprocedures that operate on data – these are two separate concepts. Inobject-oriented programming, these two concepts are bundled into objects. Thismakes it possible to create more complicated behavior with less code.
The useof objects also makes it possible to reuse code. Once you have created anobject with more complex behavior, you can use it anywhere in your code.