Key Concepts in Modern Software Development and OOP

Main Characteristics of Modern Software Development

A main characteristic of modern software development is:

  • Software products can get very complex
  • High-quality results are expected
  • Most projects add functionality to an existing product instead of developing a new one from scratch

Agile Process

The agile process is a repetitive spiral process. The steps from requirements gathering, architecting, designing, and implementation are repeated in cycles.

Strings in Double Quotes

Strings should be in double quotes. For example, “Hello” is correct, not ‘Hello’.

Variable Declaration, Definition, and Initialization

Before a variable is used in a program, it should be:

  • Declared with a type
  • Defined to allocate memory
  • Initialized or assigned to a valid value

Main() Function Return Type

The main() function returns an integer type. If the main() function doesn’t have a return statement, it will generate a compilation error.

Compound Statement Scope

Every compound (block) statement can have its own local variable scope.

Organizing Functions in C++

If you write a set of functions to be used by other C++ programs, it is best practice to put all function declarations in *.h (or *.hpp) files and all function implementations in *.cpp files.

Generating Random Integers

The expression to return random integers greater than or equal to 13 and less than or equal to 24 is: rand() % 12 + 13

Function Declarations

Function declarations:

  • Should be placed before any calls
  • Are referenced by developers to understand function interfaces
  • Are used by a compiler to check the validity of function return types and parameters

Storing “Hello” in a C-String

The smallest array size to store the string literal “Hello” in the C-string format is 6.

Assigning “Hello” to a C-String Variable

Code snippets to assign “Hello” to a C-string variable:

  • char aStr[10] = "Hello";
  • char aStr[10];
    strcpy(aStr, "Hello");

C-String Assignment Limitation

You cannot directly assign a C-string to another C-string variable after declaration.

File System

The mechanism that specifies how a computer organizes, names, stores, locates, moves, and manipulates files in the operating system is called the File System.

Stream Object ‘cin’

The stream object that is not an instance of ostream is cin.

Best Practice with Stream Function Calls

A good programming practice when using stream function calls that end up calling underlying OS system calls is to call fail().

Major Phases in Object-Oriented Software Engineering

The major phases in Object-Oriented Software Engineering (OOSE) discussed in class are:

  • Requirements Gathering
  • Analysis
  • Design
  • Programming
  • Testing

Four Principles of Object-Oriented Programming

The four principles of OOP are:

  • Abstraction
  • Encapsulation
  • Inheritance
  • Polymorphism

OOSE Solution to Modern Software Engineering Challenges

OOSE offers a solution to help face the challenges of modern software engineering by creating computer programs consisting of a system of interacting classes of objects.

Elements of the Object-Oriented Programming Paradigm

The elements of the object-oriented programming paradigm are:

  • Requirement Gathering
  • Analysis and Design
  • Modeling
  • Programming
  • Organizing Underlying Data (Database)
  • User Interface
  • System Verification

Abstraction in OOP

Abstraction in OOP involves displaying only essential information and hiding the details. An abstraction interface hides the internal implementation and shows only the functionality to users.

Cohesion

Cohesion indicates whether a class represents a single abstraction or multiple abstractions. If a class represents more than one abstraction, it should be refactored into multiple classes, each representing a single abstraction.

Encapsulation

Encapsulation in OOP refers to bundling data and the methods that operate on that data into a single unit.

Information Hiding

Information hiding, or data hiding, is about protecting data from inadvertent changes throughout the program.

Coupling

Coupling refers to the degree of direct knowledge that one element has of another. In other words, how often do changes in class A force related changes in class B.

Loose Coupling

Loose coupling is a desirable quality of software that allows one part of the software to be modified without affecting other parts. For example, a change in the UI layout should not affect the back-end class structure.

Tight Coupling

Tight coupling is where changes in one part of the software directly and quickly affect another part.

Interpreted Languages

In interpreted languages like Python, programs (scripts) are interpreted by the Python program and then run on the hardware platform.

Compiled Languages

In compiled languages like C++, programs are compiled into assembly code, linked with other library codes, and then converted to machine code (e.g., 01010110) that runs on the hardware platform.

Compiled Language Execution

In a compiled language like C++, most of the source code is directly translated into the machine language of the target platform before execution.

Compiled Language Stand-Alone Execution

Compiled languages like C++ can execute stand-alone executable codes in *.exe file format (binary machine code). However, they have a time-consuming compilation process, which can take hours for large projects.

Bug Detection in Compiled Languages

Many bugs are caught during compilation, even before executing programs in compiled languages.

Interpreted vs. Compiled: Program Size

Compiled languages like C++ have a much larger program size after being compiled into machine code.

Interpreted vs. Compiled: Memory Management

Memory management can be automatic (e.g., Java) or non-automatic (e.g., C++).

First Stage of Compilation/Linking: Pre-Processor

The first stage of the compilation/linking process is the pre-processor. It processes the program before compilation, mainly performing textual replacement and augmentation. It includes header files and expands macros.

Second Stage: Compiler

The second stage is the compiler. It takes the output from preprocessing, checks for syntactical errors (lexical analysis, parsing), uses BNF grammar, and generates the object file.

Third Stage: Linker

The third stage is the linker. It links multiple object files or libraries together to generate the final executable file. It handles static libraries (.a) and shared (dynamically-linked, .so, .dll) libraries.

Fourth Stage: Loader

The fourth stage is the loader, which handles the run-time loading of programs and libraries by the operating system.