Cs309 Asgn1-1

  • Uploaded by: Andrew Denner
  • 0
  • 0
  • April 2020
  • PDF

This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA


Overview

Download & View Cs309 Asgn1-1 as PDF for free.

More details

  • Words: 498
  • Pages: 2
Andrew Denner CS 309 Asignment1 Part 2 1.) Write a few paragraphs explaining difference between developing software in an OO way and in a procedural way. The Object Oriented paradigm is best described as a set of Modules which aid in code reusability and abstraction. This abstraction allows a developer to treat a function as a “black box” that input can be passed to and then a result can be collected from on the other side. It is a particularly useful methodology when coding in a large project. Provided simple rules are followed by all, one programmer can be working on one part of the project while another is on a separate part. OO design also allows for code reuse across projects. For example a linked list implementation can be written for one project and can be easily transplanted from that project to another. This particular benefit is especially evident in Open Source Software where code is often shared across projects and is done with out even meeting the other developer. Procedural programming is a older method of development. In Procedural Programming the program is much like a script in a play, first you do the first step then the next one and through ad nauseum. There are no functions and no opportunities for code reuse. This development model frequently leads to much copy and paste coding which can be problematic if requirements change and rework is needed because each spot of repetitive code needs to be fixed. Thus OO development allows programmers to develop in a more efficient manner saving both time and money. It also allows for more complex programs that are bigger and better then what could have ever created using Procedural programming. 2.) What are benefits of inheritance? Inheritance allows a programmer to quickly develop a set of similar classes with the ability to reuse code that has only been defined once. A good example of this would be a Interface that defines how to draw multiple sets of shapes yet allows a programmer to overload parts that are different to use a different equation or to have more sides. This not only saves the developer time and cuts down on the amount of rewritten code but also allows many developers to use a predefined structure and set to better cooperate. 3.) What is Polymorphism (and Dynamic Binding) and give an example of its use. Also describe key benefits of polymorphism.

The idea of Polymorphism is one of using generic interfaces to manipulate specific objects. Again, using the example from the above question in a Drawing display program, there exists the display interface, below that is the shape interface, and below that is the line, dot, and circle objects. Dynamic binding allows the other classes 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 be called until it is dynamically called at runtime. 4.) See attached files.

Related Documents

Cs309 Asgn1-1
April 2020 5

More Documents from "Andrew Denner"