Object-Oriented Programming

Software Design

Michael L. Collard, Ph.D.

Department of Computer Science, The University of Akron

Scale

Scale

Layers of a System

  • System
  • Subsystem
  • Namespace/Directory
  • Class/File
  • Method/Function
  • Statement

Design Definition

Software design is the process of defining software methods, functions, objects, and the overall structure and interaction of your code so that the resulting functionality will satisfy user requirements [1]

Software Activities

OOP View of Software Development

Design Explanation

Software design is the process by which an agent creates a specification of a software artifact, intended to accomplish goals, using a set of primitive components and subject to constraints.[1] Software design may refer to either “all the activity involved in conceptualizing, framing, implementing, commissioning, and ultimately modifying complex systems” or “the activity following requirements specification and before programming, as … [in] a stylized software engineering process.”[2]

Design Explanation

Software design usually involves problem solving and planning a software solution. This includes both a low-level component and algorithm design and a high-level, architecture design. [3]

High-Level Design (HLD)

  • Close to Analysis
  • Overall system design
  • Includes Architecture
  • Represents solution to requirements

Low-Level Design (LLD)

  • Close to Code
  • Detailed description of each and every module
  • Expressed in the design of the classes and methods

Layers of Design

  • System
  • Subsystem
  • Namespace/Directory
  • Class/File
  • Method/Function
  • Statement (?)

Types of Design

  • structured design
    • From structured programming
    • What are the functions?
  • object-oriented design
    • From object-oriented programming
    • What are the classes?

Class Design

  • What classes exist
  • Identifier (name) of the classes
  • Methods of the class:
    • name
    • parameters
    • return type
    • (method) specifiers:
      • C++17: const, static, virtual, final, override, friend
      • Note: final and override are contextual keywords [1]
    • access:
      • public, private, protected
  • Relationship of classes to other classes

Target Audience for Design Decisions

  • You as a developer
  • Other developers
  • You in a few months
  • Other developers in a few months
  • Future developers

Informally, what indicates a good design?

  • Easy to add features
  • Easy to determine source of bugs
  • Easy to fix bugs
  • Has the required efficiency
  • Has the required security
  • Handles errors safely

Why does bad design occur?

  • Design primarily involves making choices between tradeoffs
  • Design decisions are often made before the problem is fully understood
  • Incomplete knowledge by current and previous software engineers
  • Requirements changes since design was made
  • Security requirement changes since the design was made

Features of Good Design

  • Consistent, shared vocabulary
  • Simplicity
  • Clear roles
  • High cohesion
  • Low coupling

Design Example: MethodCount

Count the number of methods per class for a software system written in C++.

  • Input the software system (files, directories, fragments)
  • Parse the source code into some form so we can process it
  • Count the methods in the parsed form

Design Choices

Layers of Design

  • System
  • Subsystem
  • Namespace/Directory
  • Class/File
  • Method/Function
  • Statement