cs309 asgn1-1
TRANSCRIPT
8/14/2019 cs309 asgn1-1
http://slidepdf.com/reader/full/cs309-asgn1-1 1/2
Andrew Denner
CS 309 Asignment1
Part 2
1.)Write a few paragraphs explaining difference between developingsoftware in an OO way and in a procedural way.
The Object Oriented paradigm is best described as a set of Modules which aid incode reusability and abstraction. This abstraction allows a developer to treat afunction as a “black box” that input can be passed to and then a result can becollected from on the other side. It is a particularly useful methodology whencoding in a large project. Provided simple rules are followed by all, oneprogrammer can be working on one part of the project while another is on aseparate part. OO design also allows for code reuse across projects. Forexample a linked list implementation can be written for one project and can beeasily transplanted from that project to another. This particular benefit isespecially evident in Open Source Software where code is often shared acrossprojects and is done with out even meeting the other developer.
Procedural programming is a older method of development. In ProceduralProgramming the program is much like a script in a play, first you do the firststep then the next one and through ad nauseum. There are no functions and noopportunities for code reuse. This development model frequently leads to muchcopy and paste coding which can be problematic if requirements change andrework is needed because each spot of repetitive code needs to be fixed.
Thus OO development allows programmers to develop in a more efficientmanner saving both time and money. It also allows for more complex programsthat are bigger and better then what could have ever created using Proceduralprogramming.
2.)What are benefits of inheritance?
Inheritance allows a programmer to quickly develop a set of similar classes with theability to reuse code that has only been defined once. A good example of this wouldbe a Interface that defines how to draw multiple sets of shapes yet allows aprogrammer to overload parts that are different to use a different equation or tohave more sides.
This not only saves the developer time and cuts down on the amount of rewrittencode but also allows many developers to use a predefined structure and set tobetter cooperate.
3.) What is Polymorphism (and Dynamic Binding) and give an example of its use.Also describe key benefits of polymorphism.
8/14/2019 cs309 asgn1-1
http://slidepdf.com/reader/full/cs309-asgn1-1 2/2
The idea of Polymorphism is one of using generic interfaces to manipulate specificobjects. Again, using the example from the above question in a Drawing displayprogram, there exists the display interface, below that is the shape interface, andbelow that is the line, dot, and circle objects. Dynamic binding allows the otherclasses in the program to handle all display items the same, say by calling the
function shape.draw at runtime with out the compiler knowing what object will becalled until it is dynamically called at runtime.
4.) See attached files.