13
 OOP vs Structured Programming CSC238 TOPIC 1

Structured vs Object Oriented Programming

  • Upload
    kuroha

  • View
    24

  • Download
    1

Embed Size (px)

DESCRIPTION

Introduction into object oriented programming and the difference between structured programming.

Citation preview

  • OOP vs Structured ProgrammingCSC238

    TOPIC 1

  • ContentStructured vs OOPObject Oriented Programming(OOP)

  • Structured ProgrammingDividing a problem into smaller subproblems. Each subproblem is then analyzed and a solution for the subproblem is obtained. The solutions to all the subproblems are then combined to solve the overall problem. This process of implementing a structured design is called structured programming.

  • Top Down approachA Single module will be split into several smaller modulesGeneral to SpecificBottom Up approachLot of small modules will be grouped to form a single large moduleSpecific to GeneralIf the requirements are clear at the first instance we can go for Top down approachIn circumstances where the requirements may keep on adding, we go for Bottom up approach

  • Limitation Structured Programming

    a. Structured Programming is hard and takes a long time to master b. It concentrates on doing things. (Eg. Algorithms) c. Large programs are divided into smaller programs called Functions d. Most of the Functions share global data e. Data is accessible from one function to another f. Top down Approach

  • Object Oriented ProgrammingOOP is a programming style that is focused on objectsImportant Features of OOPAbstractionEncapsulationInheritancePolymorphism

  • History of C++ Extension of CEarly 1980s: Bjarne Stroustrup (Bell Laboratories)Originally named C with Classes.Provides capabilities for object-oriented programmingObjects: reusable software components Model items in real worldObject-oriented programsEasy to understand, correct and modifyHybrid languageC-like styleObject-oriented styleBoth

  • Using functionFunction & program is divided into modulesEvery module has its own data and function which can be called by other modules.Structured Programming

  • OBJECT ORIENTED PROGRAMMINGObjects have both data and methods Objects of the same class have the same data elements and methods Objects send and receive messages to invoke actions

  • Structured Vs OOP

    StructuredOOPFocuses on ProcessFocuses on ObjectFollows Top-down, Bottom-up, stepwise refinement and modular programming ApproachFollows Object oriented design

  • Structured VS OOP

  • Structured VS OOPStructured programming is task-centric, object oriented programming is data-centric. Structured programming is based around data structures and subroutines. The subroutines are where stuff actually "happens", and the data structures are simply containers for the information needed by those subroutines. Object oriented programming, on the other hand, shifts your primary focus to the data itself. Instead of asking "what do I want to do and what will I need to know to do it", you ask "what kind of things do I want to have and what can those things do for me". Instead of designing your functions first and then coming up with data structures to support them, you design types first and then come up with the operations needed to work with them.