Title: Learning Enrichment: static versus object-oriented approach
Course: CPS 161: An Intro to Programming with Java - DL MM MASTER > Section: Learning Units - Bb

Presentations and Videos

- Learning Enrichment: static versus object-oriented approach interactive learning activity

- In JH4, you had a chance to write a program using 2 different approaches (Object-Oriented Programming (OOP) versus using static). Although this particular assignment didn't show the advantages of OOP approachs, you should normally use the OOP approach. This Learning explores the advantages of Object-Oriented programming.
- Object-Oriented Programming (OOP) techniques are the modern way to go with programming. Using static methods and data is the old-fashion "Fortran/Cobol" approach. Using OOP techniques provides the following advantages over older more traditional techniques:
  - OOP techniques create more modular programs that can be expanded to very large projects with many people working on the same project.
  - OOP techniques will usually provide a simpler way to understand the created project
  - OOP code is easier to expand and update.
- Unfortunately first time Java programmers often struggle with and resist using OOP techniques. Common problems include:
  - Putting all code in main
  - Creating too much static (i.e. global) data
  - Not breaking the logic down to simple classes and methods that capture the concepts of the project.