1. Home
  2. Explore
  3. Computer Science
  4. Introduction to Software Engineering

Study methods

Flashcards
Quiz
Fill in the blanks
Written test
Lesson
Notes
Podcast
Content

Introduction to Software Engineering

Software Engineering: From Coding to Professional Development

Many people can write code. Some learn independently, others attend short courses, and others study computing for years. However, the ability to make a program work is only one part of professional software development.

A hobbyist may begin coding immediately, experiment freely, and stop when the program appears to work. A professional developer must think more broadly:

  • Is the correct product being built?
  • Can other developers understand and maintain the code?
  • Will the software remain useful as requirements change?
  • Is the program correct, efficient, secure, and reliable?
  • Can the work be coordinated across a team?
  • Can the software be tested systematically?

The discipline that addresses these questions is software engineering.

Software engineering is a standardized, structured, and thorough approach to developing software from the beginning of a project through its ongoing maintenance.

Software engineering is not simply “more coding.” It organizes the entire development process so that the final product satisfies its users and can continue to function and evolve over time.

Why Software Engineering Matters

Building the correct product

The first responsibility of professional development is to deliver what the customer or users actually need. A program can be technically impressive and still be a failure if it solves the wrong problem.

For example, a development team might build a sophisticated sales system with advanced reporting, but the customer may primarily need a simple way to record sales quickly. If the team does not understand the real need before development begins, a great deal of time and money may be spent producing something unsuitable.

Maintaining a consistent standard

Professional software is often maintained for months or years. It may also be modified by many different developers. Code that only makes sense to its original author becomes a serious problem when another person must fix or extend it.

Software engineering therefore encourages:

  • Consistent coding styles
  • Clear naming conventions
  • Organized program structures
  • Standardized design approaches
  • Documentation and revision tracking

These practices make the software easier to understand and reduce the risk of errors during future changes.

Achieving rigor

Professional software must meet a level of rigor, meaning that it should be dependable rather than merely functional in a few informal trials.

Rigor involves increasing confidence that the software is:

  • Correct: It produces the intended results.
  • Efficient: It uses time and resources appropriately.
  • Secure: It resists incorrect or harmful use.
  • Maintainable: Developers can modify it without causing unnecessary damage elsewhere.

Software engineering provides processes and techniques that make these qualities more likely.

Coding produces instructions for a computer. Software engineering manages the larger process of producing reliable software that solves the right problem.

Think About It

If a program works correctly but does not meet the customer’s actual needs, should it be considered successful? The distinction between “working software” and “useful software” is central to software engineering.

Phase One: Requirements Gathering and Analysis

Software engineering begins before serious coding starts. The first major task is to understand what the customer and users need. This process is called requirements gathering.

A requirement is a statement about something the software must provide or a quality it must possess.

Beginning development without understanding requirements is risky because the project may produce the wrong product. Discovering this mistake late is expensive: much of the completed work may need to be discarded or redesigned.

Why Requirements Are Difficult

It might seem that requirements gathering simply means asking the customer what should be built. However, customers do not always know exactly what they want.

A customer may:

  • Describe a solution instead of the underlying problem
  • Leave out important details
  • Use technical or business terms ambiguously
  • Change their mind after seeing an initial design
  • Be unaware of what software can realistically do
  • Know that a process is frustrating without knowing how to improve it

For this reason, developers do not merely wait for a list of requirements. They actively investigate the customer’s work, goals, difficulties, and expectations.

Ways to Gather Requirements

Customer-provided lists

The simplest method is to ask the customer to provide a list of desired features. This can be useful as an initial source of information, but it has limitations.

A customer-written list may be:

  • Very long
  • Organized around vague wishes rather than specific behavior
  • Missing important requirements
  • Written without considering technical relationships
  • Difficult for developers to translate directly into software

The development team therefore usually gathers and analyzes requirements independently, using several structured methods.

Surveys

A survey collects responses from many users through a standardized set of questions. Surveys are useful when the development team wants to identify common opinions, preferences, or problems across a large group.

Their strength is breadth: many people can provide information. Their limitation is that answers may lack the detail that comes from a conversation or direct observation.

Interviews

An interview is a guided conversation with a customer, user, or stakeholder. The developer can ask follow-up questions, clarify vague statements, and investigate the reasons behind a request.

For example, if a user says, “The system needs to be faster,” an interview can explore what “faster” means. The problem might be slow login, delayed reports, or too many steps in a particular task.

Focus groups

A focus group brings several users together to discuss their needs and experiences. This can reveal shared problems as well as disagreements between different groups of users.

For instance, employees who enter sales records may want speed and simplicity, while managers may want detailed reporting. A focus group can expose both perspectives.

Observation

If an existing system or work process is available, developers can observe users performing real tasks. Observation is valuable because people do not always accurately describe what they do.

Direct observation can reveal:

  • Which features users rely on
  • Which steps they repeat
  • Where errors occur
  • Which parts of the process cause frustration
  • Workarounds users have created

These observations help developers design software around actual behavior rather than assumptions.

Use Case Analysis

One especially useful requirements technique is use case analysis. A use case describes a realistic interaction between a user and a system from the user’s point of view.

The focus is not on how the program will be implemented. Instead, the focus is on:

  • What the user wants to accomplish
  • What the user sees
  • What actions the user takes
  • How the system responds

Use cases should avoid unnecessary programming jargon so that both technical and nontechnical participants can understand them.

Main success scenario

A use case commonly begins with a main success scenario, which is a sequence of steps describing what happens when everything goes correctly.

Consider a sales system in which a user wants to add a sale:

  1. The user initiates the “add sale” action.
  2. The system requests the relevant information.
  3. The user provides the product name and quantity.
  4. The system stores the information.
  5. The system confirms that the sale has been recorded.

This sequence represents the expected successful path.

Alternative and error scenarios

Real interactions do not always follow the ideal path. A complete use case also describes what happens when something goes wrong.

Suppose the user enters a quantity less than 111. The system may:

  1. Display an error message.
  2. Reject the invalid quantity.
  3. Return the user to the appropriate input step.
  4. Wait for a corrected value.

This error path is important because it defines how the software should behave under invalid conditions.

A use case can also describe other outcomes. If the user closes the dialog box, for example, the system may cancel the operation and leave the records unchanged.

Preconditions and postconditions

A precondition is something that must already be true before a use case begins. For example, a user may need to be logged in before adding a sale.

A postcondition describes the state of the system after the use case finishes. For the successful sales example, the new sale may be stored in the system. If the user cancels, the postcondition may instead be that no new record has been added.

These conditions make the expected behavior more precise.

User Stories

A user story expresses a requirement in a shorter, less detailed form. It emphasizes the user’s perspective and usually includes three important pieces of information:

  1. Who wants something
  2. What the person wants to do
  3. Why the person wants to do it

A typical structure is:

As a particular type of user, the user wants to perform an action so that a desired benefit is achieved.

For example:

As a sales clerk, the user wants to record a sale so that inventory and sales records remain accurate.

Compared with a use case, a user story usually contains less detail about the exact interaction. Its advantage is that it clearly connects a requested feature to the user’s purpose.

Functional and Non-Functional Requirements

After gathering information, the development team analyzes it and organizes it into different categories.

Functional requirements

A functional requirement states what the system must do. It describes a behavior, operation, or service provided by the software.

Examples include:

  • The system must allow a user to add a sale.
  • The system must store a product name and quantity.
  • The system must reject quantities less than 111.
  • The system must display sales records in a table.

Functional requirements describe the system’s actions.

Non-functional requirements

A non-functional requirement describes a characteristic or quality of the system rather than a specific function.

Examples include:

  • The system should respond quickly.
  • The interface should be easy to understand.
  • The software should remain secure.
  • The system should be reliable under expected use.

The distinction can be remembered this way:

  • Functional requirements describe what the system does.
  • Non-functional requirements describe how well or under what qualities it does it.

A sales system’s ability to save a sale is functional. The requirement that the sale be saved quickly and securely is non-functional.

Prototyping

Once requirements have been gathered and organized, the team can create a prototype. A prototype is an early representation of the software used to explore and communicate its design.

A prototype does not need to be fully functional. It might consist of:

  • Screen sketches
  • Clickable interface mockups
  • Diagrams
  • Presentation slides
  • A partial working interface

The purpose is to show the customer how the system may look and behave. A prototype can demonstrate:

  • Where information will appear
  • How screens connect
  • What controls users will interact with
  • How a particular task will be completed

The customer can then provide feedback. The prototype is revised until the requirements and design more closely match the user’s needs.

This process reduces risk because misunderstandings can be discovered before the team invests heavily in implementation.

Think About It

Why is a non-functional prototype useful even if it cannot perform the final task? It allows users to evaluate the planned interaction and structure before the expensive work of building the complete system begins.

Phase Two: Planning

The next major activity is planning. Planning determines how the project will be organized and developed over the coming weeks or months.

Requirements gathering and planning often occur at the same time. As the team learns more about the customer’s needs, it may revise the development plan. Likewise, planning may reveal that a requirement needs clarification.

A plan is especially important for large projects containing many thousands of lines of code and numerous interacting components. Without a plan, developers may create incompatible parts, duplicate work, or lose track of how the system is intended to operate.

Modularization

A central planning activity is modularization. Modularization means dividing a large program into smaller, more focused parts called modules.

A module may contain:

  • Related data
  • Functions that operate on that data
  • A particular responsibility
  • A defined way of communicating with other modules

For example, a game might be divided into modules for:

  • The player
  • Enemies
  • Game rules
  • Scoring
  • Input handling
  • Graphics
  • Sound

The purpose is not merely to create many separate files. The purpose is to design meaningful boundaries so that each part of the program has a clear role.

Good modularization aims for high cohesion and low coupling.

Cohesion

Cohesion describes how closely the contents of a module are related to one another.

A highly cohesive module contains elements that all contribute to one clear responsibility. For example, a records module might contain functions for:

  • Retrieving records
  • Adding records
  • Updating records
  • Removing records

All of these operations concern records, so the module has high cohesion.

A module has low cohesion when it groups together unrelated tasks simply because they do not fit anywhere else. A vague “utilities” module containing unrelated database functions, display functions, mathematical helpers, and file operations is an example of low cohesion.

High cohesion is valuable because it makes a module easier to understand. When a developer needs to change record-related behavior, a highly cohesive design provides a clear place to look.

Coupling

Coupling describes how strongly modules depend on one another.

Two modules are highly coupled when changes to one module require extensive changes to the other. They may rely on each other’s internal data, implementation details, or shared state.

Two modules are loosely coupled when they communicate through a limited, well-defined interface. Each module knows what services the other provides but does not need to know how those services are implemented.

Low coupling in a game

Suppose a game engine needs to determine whether an enemy has hit a player. In a loosely coupled design, the game engine can:

  1. Request the player’s position from the player module.
  2. Request the enemy’s position from the enemy module.
  3. Compare the positions.
  4. Send a message to the player module to reduce health if a collision occurred.

The game engine does not directly manipulate the internal data of the player or enemy modules. It communicates through requests and responses.

This design makes it easier to add multiple players or different enemy types. As long as the modules provide the expected operations, the game engine can work with them without needing to understand their internal implementation.

High coupling through shared state

A highly coupled design might allow many modules to access and modify one shared game-state object directly. Every module becomes dependent on the structure and contents of that shared state.

Changing one part of the state may affect many other modules. The result is difficult to predict and difficult to maintain.

Separation of Concerns

When a system has high cohesion and low coupling, it achieves separation of concerns.

A concern is a distinct responsibility or area of functionality. Separation of concerns means that each part of the program handles its own responsibility instead of mixing unrelated tasks together.

This provides several benefits:

  • Code becomes easier to read.
  • Changes are easier to locate.
  • A modification is less likely to break unrelated features.
  • Team members can work on different modules more independently.
  • Individual components can be replaced or upgraded more easily.
  • Testing becomes more focused.

For example, if all record-related behavior is located in one cohesive module, a change to record storage can be made in that module rather than throughout the entire program.

Think About It

If changing a single module forces changes in many unrelated modules, what does that suggest about the system’s coupling? It suggests that the modules are too dependent on one another and need clearer boundaries.

Phase Three: Development and Design Practices

Once requirements are sufficiently understood and the system has been planned, serious implementation can begin. Professional development still differs from simply writing code until a program appears to work.

Developers use established design approaches, readable coding practices, and tools that support collaboration and change.

Design Patterns

A design pattern is a standardized, reusable approach to a recurring software design problem.

The same kinds of problems appear repeatedly in software development. Instead of inventing a completely different solution each time, developers can use patterns that have already been examined and widely applied.

Patterns are useful because they:

  • Provide a shared vocabulary for developers
  • Make designs easier for experienced programmers to recognize
  • Encourage organized solutions
  • Reduce unnecessary creativity in routine problems
  • Increase confidence because the approach has been tried and tested

A pattern is not necessarily a complete program. It is more like a proven arrangement of responsibilities and relationships that can be adapted to a particular system.

Model–View–Controller

One important pattern is Model–View–Controller, commonly abbreviated as MVC. It is useful for programs that contain data and logic connected to a user interface.

MVC separates the program into three main parts.

Model

The model contains the data and the logic that operates on that data.

For a sales system, the model might contain:

  • Sales records
  • Functions for adding and editing records
  • Functions for retrieving records
  • Rules governing how records are stored

The model is an abstract, low-level representation. It does not need to know how the information will appear visually to the user.

View

The view presents model information to the user.

For a sales system, the view might display sales records in a table. A different view could display those same records as a chart.

The view is concerned with presentation. It translates internal data into something the user can interpret.

Controller

The controller receives user interaction and coordinates the appropriate response.

In a sales system, buttons such as “Add Sale,” “Edit,” and “Delete” may be part of the controller’s interaction logic. The controller can receive a user’s action, ask the model to change or retrieve data, and then cause the view to update.

Why MVC helps

MVC reduces dependence between data, interaction, and presentation.

If the table view is replaced with a chart, the model does not need to change because the sales data remains the same. The controller may also remain unchanged because the user actions still perform the same operations.

Likewise, if administrators need additional controls, the controller can be replaced or extended while leaving the model and view unaffected.

This ability to replace one part without rewriting the others is called substitutability.

MVC therefore supports:

  • Easier maintenance
  • More flexible interfaces
  • Independent development of components
  • Reuse of the same data with different presentations
  • Reduced impact from changes

Readable Code

Professional software is often revisited long after it was first written. Readability is therefore a practical engineering requirement, not merely a matter of personal style.

Readable code allows developers to understand the original intent quickly. This reduces the time required to fix defects and makes new features safer to add.

Avoiding magic numbers

A magic number is a numerical value placed directly in code without a clear explanation of what it represents.

For example, a program might compare an infrared remote-control input to a long numeric code. The program may work, but a developer returning to it months later may not know what the number means.

A clearer approach is to assign the value a meaningful name, such as a name representing the previous-button command. The code then communicates the purpose of the value rather than forcing the reader to remember or investigate it.

The same issue can occur with ordinary values such as:

  • Screen dimensions
  • Time limits
  • Maximum quantities
  • Special status codes
  • Configuration values

Replacing unexplained numbers with named constants or variables improves readability and reduces accidental inconsistency.

Meaningful names

Names should communicate what a variable or function represents.

Function names are often clearer when they describe an action using a verb. A name such as queryDatabase communicates much more than a vague name such as database, because it indicates that the function performs a database query.

Boolean variables should also be named so that their meaning is obvious. A name such as isOn clearly represents a state and reads naturally in a condition:

if (isOn)

This is easier to understand than a vague condition such as:

if (power)

Meaningful naming allows code to be read more like a description of the program’s behavior.

Revision Control Systems

A revision control system tracks changes to source code over time. Platforms such as GitHub commonly store projects that use revision control, but the important concept is the version-control system itself.

Revision control allows developers to:

  • Record successive versions of a project
  • Review what changed
  • Return to an earlier version
  • Compare different versions
  • Work on separate changes
  • Combine contributions from multiple developers

In a team environment, developers can commit their work and merge it with the work of others. This makes collaboration more organized and provides a history of how the software developed.

Without revision control, a team may lose earlier working versions, overwrite another developer’s changes, or struggle to identify when a defect was introduced.

Think About It

Why are meaningful names and revision history both important? Meaningful names help developers understand the current code, while revision history helps them understand how the code changed and recover from harmful changes.

Phase Four: Testing

Testing determines whether the software behaves as expected. Informal testing—opening an application, clicking around, and deciding that it “seems fine”—is not sufficient for large or critical systems.

Professional software uses systematic testing, often with automated tools.

Testing Against Expectations

Testing compares actual behavior with expected behavior.

A test supplies an input or action, runs the relevant software, and compares the result with the expected result. A successful test means that the actual result matches the stated expectation. A failed test identifies a difference that requires investigation.

Testing is therefore more precise than simply searching randomly for bugs. It checks whether defined behavior is being fulfilled.

Unit Testing

Unit testing tests a small, individual part of a program, such as a function or module.

A unit test generally includes:

  1. A chosen input
  2. An expected result
  3. An execution of the unit
  4. A comparison between the actual and expected results

For example, a subtraction function could be tested with two inputs and an expected difference. If the function accidentally adds the inputs instead, the test fails and identifies the type of operation that is incorrect.

A collection of unit tests can quickly reveal which specific operations are failing. This makes debugging more focused than testing only the entire application.

Integration Testing

Integration testing tests multiple modules working together.

Individual modules may each pass their own unit tests but still fail when connected. The problem may involve:

  • Incorrect communication
  • Incompatible data formats
  • A mistaken sequence of operations
  • A misunderstanding of another module’s interface

In the sales system, an integration test might simulate editing a record through the controller and then check whether the model actually changed. This tests the connection between the user interaction, controller, and data model rather than testing only one component.

Black-Box Testing

In black-box testing, the tester does not examine the internal implementation. The module is treated as a black box: inputs are supplied, and outputs are checked against the specification.

For example, a tester may provide a quantity to a sales function and verify that the correct result is returned without caring how the function calculates it.

Black-box testing is useful because it evaluates the system from the perspective of its externally visible behavior.

White-Box or Glass-Box Testing

In white-box testing, also called glass-box testing, the tester considers the internal implementation.

Tests may be designed to exercise:

  • Particular branches of an if statement
  • Different loop conditions
  • Internal helper functions
  • Specific paths through the code
  • Internal states that are not visible from outside

White-box testing can reveal implementation problems that black-box testing may miss. The two approaches examine different aspects of quality, so a strong testing strategy may use both.

GUI Testing

GUI testing checks whether the graphical user interface behaves correctly.

A GUI test may verify that:

  • Buttons perform the correct actions
  • Windows open and close correctly
  • Information appears in the proper location
  • User input is accepted or rejected correctly
  • The visible result matches the expected action

Automated GUI testing can use tools that generate keyboard input, mouse actions, or other interaction events. It may also use screen capture or screen-reading techniques to examine what appears to the user.

The underlying logic is the same as other testing: perform an action, observe the result, and compare it with the expectation.

Security Testing

Security testing examines how software behaves under unexpected or potentially harmful input.

Normal tests use carefully selected values. Security testing must also consider inputs that a developer might not anticipate. One approach is to send randomized values repeatedly to parts of the system, such as a login form, and observe whether the software remains stable and secure.

Randomized input can help reveal weaknesses that ordinary planned examples fail to expose.

Code Coverage

Code coverage measures how much of a program has been executed by tests.

A program may contain:

  • Functions
  • Conditional branches
  • Loops
  • Multiple possible states

Testing one normal path does not guarantee that all of these areas have been exercised.

Loops make complete coverage particularly difficult. A loop may need to be tested when it runs:

  • Zero times
  • Once
  • Several times
  • Many times
  • With unusual boundary values

Programs with internal state are also difficult to cover completely because behavior can depend on the sequence of earlier events.

Although complete coverage can be difficult or impossible, greater coverage generally provides greater confidence that more of the program has been examined.

Test-Driven Development

Test-driven development, or TDD, is a development approach in which tests are written before the corresponding implementation.

The cycle is:

  1. Write a test for desired behavior.
  2. Run the test and observe that it fails because the behavior does not yet exist.
  3. Write the smallest amount of code needed to make the test pass.
  4. Run the test again.
  5. Repeat the process for the next behavior.

The developer does not write large amounts of unnecessary code in advance. Each new piece of functionality is guided by a test.

TDD can promote:

  • Frequent verification
  • High test coverage
  • Small, manageable changes
  • Clear definitions of expected behavior
  • Early detection of incorrect implementations

The key idea is that the tests specify the behavior first, and the implementation is built to satisfy those specifications.

Think About It

Why might a module pass unit tests but fail an integration test? The module may work correctly by itself while communicating incorrectly with another module.

The Software Development Cycle

The major activities of software engineering are often presented as phases:

  1. Requirements gathering and analysis
  2. Planning
  3. Development
  4. Testing

These phases should not be interpreted as completely separate steps that occur only once. In real projects, they frequently overlap.

For example:

  • Requirements may be clarified during planning.
  • Planning may change when a prototype reveals technical difficulties.
  • Development may expose an ambiguous requirement.
  • Testing may reveal that the design needs to be changed.
  • New requirements may appear after users try the software.

Software development is therefore iterative. The team repeatedly learns, designs, builds, evaluates, and improves.

Deployment and Maintenance

The process does not necessarily end when the initial product is deployed.

After using the software, customers may request:

  • Improvements
  • New features
  • Enhancements
  • Bug fixes
  • Changes to meet new circumstances

The development cycle then begins again. The team gathers the new requirements, plans the changes, designs or prototypes them, implements the solution, and tests it.

For large systems, this cycle may continue throughout the software’s entire lifetime.

Software engineering is a continuous process of understanding needs, organizing solutions, building carefully, evaluating behavior, and adapting the product over time.

Comprehensive Review

Software engineering distinguishes professional development from simply writing code that works in a limited situation.

The central ideas are connected:

  • Requirements gathering ensures that the correct product is being built.
  • Use cases describe realistic interactions from the user’s perspective.
  • User stories connect a user, an intended action, and the reason for that action.
  • Functional requirements define what the system must do.
  • Non-functional requirements define qualities such as performance, security, and usability.
  • Prototypes allow users to evaluate a planned design before full implementation.
  • Planning creates an organized path for developing a large system.
  • Modularization divides a complex system into manageable parts.
  • High cohesion keeps related responsibilities together.
  • Low coupling minimizes dependencies between modules.
  • Separation of concerns makes systems easier to understand and maintain.
  • Design patterns provide proven solutions to recurring design problems.
  • MVC separates data and logic, presentation, and user interaction.
  • Readable code uses meaningful names and avoids unexplained magic numbers.
  • Revision control preserves development history and supports collaboration.
  • Unit testing examines individual components.
  • Integration testing examines components working together.
  • Black-box testing focuses on externally visible behavior.
  • White-box testing examines internal implementation and execution paths.
  • GUI testing checks visible user interactions.
  • Security testing explores unexpected or randomized inputs.
  • Code coverage measures how much of the program tests exercise.
  • TDD writes tests before implementation and develops incrementally.
  • Iteration and maintenance recognize that software continues to evolve after deployment.

The overall purpose of these practices is to increase confidence that software is useful, understandable, adaptable, correct, efficient, and secure. Coding is the act of writing instructions, while software engineering provides the disciplined process that turns those instructions into a dependable product.

Ask anything

We've read this whole study set, so questions about it get the best answers.

FlashcardsQuizFill in the blanksWritten testLessonNotesPodcastContent