Putting Component-Level Design into Practice: Steps and Examples

UPI Study › Courses › Software Engineering › Free lessons › Lesson 9.4 Free with a free account

Putting Component-Level Design into Practice: Steps and Examples

Software Engineering · Chapter 9: Component-Level Design and Practical ApplicationSection 9.4 · lesson 64 of 1036 min · free with a free account

← Designing Components Around Classes: Principles and ProcessNext lesson: Using Component-Level Design in Real Software Projects →

Earn 3 college credits for Software EngineeringRecommended for credit by NCCRS · Computer Science 301 · self-paced · one payment, lifetime access

In this lesson

A repeatable 5-step process, and 1 component carried all the way through.

  • Name the 5 steps of component-level design, in order
  • Explain why each step comes where it does
  • Apply the steps to a concrete component, start to finish

Transcript

Everything said in the video, section by section (780 words). Read along, or search it.

Component-Level Design and Practical Application

Putting Component-Level Design into Practice

Knowing that a component's data, logic, and interface all need refining is one thing. Actually sitting down and doing it, in an order that works, is another. This section covers a repeatable five-step process, and carries one component through it from start to finish.

Knowing vs. Doing

An Order That Works

In principle, a component's data structures, algorithms, and interface could be refined in any order. In practice, a consistent order makes each step easier. That is because each step builds on a decision already settled by the step before it. The five-step process that follows turns that refinement into something repeatable.

Table 1

The 5 Steps

Here are the five steps, and what each one produces. First, restate the responsibility, as a precise statement of what the component must accomplish, in one or two sentences. Second, identify the data needed. The data structures the component holds and works with. Third, design the algorithm. The step-by-step logic, often written as pseudocode. Fourth, define the interface. The exact operations, inputs, and outputs other components use to call this one. And fifth, walk through scenarios, confirming the design actually handles the realistic cases it needs to.

Why This Order

Each Step Needs the One Before

The order matters. Data cannot be organized sensibly until the responsibility is clear. An algorithm cannot be designed until the data it operates on is settled. An interface cannot be finalized until the algorithm reveals what inputs it needs, and what results it produces. And walking through scenarios deliberately comes last, once there is a complete design to test.

Worked Example

A DiscountCalculator, Steps 1 and 2

Suppose an architecture diagram names a discount calculator component, with no further detail. Let's carry it through all five steps. Step one, the responsibility. Given an order and a set of discount rules, determine the single largest discount the order qualifies for. Step two, the data. The component needs an order, with a total and a category. It needs a list of discount rules, each with a minimum order value, a category it applies to, and a way to compute its amount. And it needs a discount result, to hold the outcome.

Pseudocode

Step 3: The Algorithm as Pseudocode

Step three is the algorithm, written here as pseudocode. It starts with the best discount at zero, and then checks every rule in turn. If the order total is below the rule's minimum, it skips that rule. If the rule does not apply to the order's category, it skips that one too. Otherwise, it computes the rule's amount. And if that beats the best discount so far, it becomes the new best. Finally, it returns a discount result holding the best discount found.

Step 4

Defining the Interface

Step four defines the interface. It is a single operation, calculate discount. It takes the order and the list of rules, and returns a discount result. Notice that this interface could only be written with confidence after steps two and three. Those steps had already settled what data the component needs, and what it actually computes.

Table 2

Step 5: Walk Through Scenarios

Step five walks the design through realistic scenarios. If no rules apply to the order, the result should be an amount of zero. If exactly one rule applies, it should be that rule's computed amount. If several apply, it should be the largest of their amounts. And if the order total is below every rule's minimum, the result should again be zero. Tracing the pseudocode against each case confirms it produces the right answer, including the edge case of no rules applying at all.

Think About It

When a Scenario Fails

Here is a question to think about. What if step five uncovered a scenario the design handled wrongly? Step five does not fix the design itself. It reveals that something upstream still needs attention. Maybe the algorithm needs an added condition. Maybe the data is missing something it needs. For example, suppose a negative order total produced a negative discount, which should never happen. The fix belongs in step three. The algorithm does not guard against a negative total, so that is where the change goes.

Key Terms

The Vocabulary of This Section

Let's lock in the key terms. A responsibility statement is a precise, one or two sentence description of what a component must accomplish. It is the first step. A design walkthrough traces a component's design against realistic scenarios, to confirm it produces the expected result in each one. And pseudocode is a plain-language, step-by-step form of an algorithm, used to design logic before translating it into a real programming language.

Key Takeaways

What to Carry Forward

To pull this together. Component-level design follows five steps. Restate the responsibility, identify the data, design the algorithm, define the interface, and walk through scenarios. Each step builds on the decisions settled by the one before it. The discount calculator went from a single sentence to validated pseudocode, and a clear interface. And walking through scenarios catches gaps, like an unhandled edge case, before any code is written.

About Software Engineering at UPI Study

Software Engineering (Computer Science 301) is a self-paced online course of 103 video lessons in 15 chapters, from process models and agile to requirements, design, user interfaces, reliability, security and project management. It carries a NCCRS credit recommendation for 3 semester credits.

Every lesson transcript is free on pages like this one, and the videos are free with a free UPI Study account. Enrolling adds a practice quiz after each lesson, the graded work and final exam that earn the credit, lifetime access, and an official transcript on completion. UPI Study has helped over 130,000 students with college credits. ACE and NCCRS have over 2,100 cooperating colleges that will consider accepting credits; the final decision is with the universities.

Compare: Software Engineering vs Systems Analysis

Why take it here

Why students take Software Engineering with UPI Study

How professional software gets builtSoftware Engineering covers how teams turn requirements into working, maintainable software: process models, agile, requirements, design, testing, reliability and project management. It is a core course in computer science and software degrees.
Credit at a fraction of the priceThe same 3 credits can cost $750 or more at a US college. Here it is one payment, self-paced, with lifetime access.
Finish your degree soonerTransfer credits reduce the courses you still owe, so you can graduate earlier or lighten a heavy semester.
Strengthen an applicationA completed college-level course on an official transcript shows admissions and scholarship committees you can do the work.
Study on your own scheduleNo start dates, no deadlines. Watch the lessons, practice, and take the final when you are ready.
130,000+students helped with college creditsACE and NCCRS have over 2,100 cooperating colleges that will consider accepting credits; the final decision is with the universities.

Where the credit goes

Universities that work with NCCRS

Software Engineering carries a NCCRS credit recommendation. These universities work with NCCRS; some are UPI Study's signed partners. ACE and NCCRS have over 2,100 cooperating colleges that will consider accepting credits; the final decision is with the universities.

Find my college → Not listed? Ask Athena in the corner of this page, or book a 15-minute call.

FAQ

Questions students ask us

About Putting Component-Level Design into Practice: Steps and Examples

What are the five steps of component-level design?
A repeatable five-step process is: restate the component's responsibility in one or two precise sentences, identify the data structures it needs, design its algorithm, often as pseudocode, define its interface, meaning the exact operations, inputs, and outputs other components use, and walk through realistic scenarios to confirm the design handles them. The steps follow this order because each builds on decisions settled by the step before.
Why is the interface defined after the algorithm in component design?
An interface cannot be finalized with confidence until the algorithm reveals what inputs it needs and what results it produces. In the same way, data cannot be organized until the responsibility is clear, and an algorithm cannot be designed until its data is settled. Scenario walkthroughs come last because they need a complete design to test. Following this order means each step builds on decisions that are already settled.
How would you design a discount calculator component step by step?
First state the responsibility: given an order and discount rules, find the single largest discount the order qualifies for. Next identify the data: an order with a total and category, rules with a minimum value, category, and amount calculation, and a result. Then write pseudocode that skips ineligible rules and keeps the best amount. Finally define calculateDiscount(order, rules) returning a result, and test scenarios such as no applicable rules returning zero.
What happens when a design walkthrough scenario fails?
A failing scenario does not fix the design itself; it reveals that an earlier step still needs attention, such as an algorithm missing a condition or data missing a field. For example, if a negative order total produced a negative discount, the fix belongs in the algorithm step, which needs a guard against negative totals. Catching this during a walkthrough finds the gap before any code is written.

About the Software Engineering course

How many college credits is Software Engineering?
Software Engineering (Computer Science 301) carries a NCCRS credit recommendation for 3 semester credits. ACE and NCCRS have over 2,100 cooperating colleges that will consider accepting credits; the final decision is with the universities.
How much does Software Engineering cost and what is included?
$250, paid once, with lifetime access: all 103 video lessons, a practice quiz after each, the graded work and final exam, and an official transcript when you finish. Students who want several courses choose UPI Study PRO instead.
Which universities accept UPI Study credits?
UPI Study has signed partner agreements with universities such as Thomas Edison State University, University of the People and Charter Oak State College, and works with universities such as Penn State, SNHU and SUNY. ACE and NCCRS have over 2,100 cooperating colleges that will consider accepting credits; the final decision is with the universities. Use "Find my college" on this page to check yours.
How long does Software Engineering take?
It is self-paced with no deadlines. The 103 lessons total about 11 hours of video; most students add reading and practice time and finish in a few weeks to a few months, on their own schedule.
How are the exams done?
Quizzes and assignments are online in the course. The final exam is taken online with proctoring; a person on the UPI Study team checks assignments, usually within two days.
How do my credits reach my college?
When the course shows 100% complete, request the official transcript from your dashboard. It is sent to the college you name, and you can send it to more than one. Check your college first with "Find my college" on this page, or ask Athena.

Ready for the full course? Earn 3 credits in Software Engineering.

103 video lessons, a quiz after each one, and the graded work that earns the credit. Recommended for credit by NCCRS.

Software Engineering
3 credits · NCCRS
Enroll →