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
Free preview
Create a free account to keep watching
It takes a minute and costs nothing. Your free account unlocks all of Chapter 1 and 3 more lessons of Software Engineering.
Lesson complete
Earn the 3 college credits for Software Engineering
Enrolling adds a quiz after each lesson, the graded work and the official transcript. Recommended for credit by NCCRS.
Next lesson: Using Component-Level Design in Real Software Projects →← Designing Components Around Classes: Principles and ProcessNext lesson: Using Component-Level Design in Real Software Projects →
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.
Enroll now → Course details Download the syllabus All Computer Science courses Every course with PRO →
Why take it here
Why students take Software Engineering with UPI Study
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.
Thomas Edison State UniversitySigned partner
University of the PeopleSigned partner
Charter Oak State CollegeSigned partner
Strayer UniversitySigned partner
Columbia Southern UniversitySigned partner
Indiana TechSigned partner
Penn StateWorks with NCCRS
Southern New Hampshire UniversityWorks with NCCRS
SUNYWorks with NCCRS
+many more cooperating universitiesFind my college →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?
Why is the interface defined after the algorithm in component design?
How would you design a discount calculator component step by step?
What happens when a design walkthrough scenario fails?
About the Software Engineering course
How many college credits is Software Engineering?
How much does Software Engineering cost and what is included?
Which universities accept UPI Study credits?
How long does Software Engineering take?
How are the exams done?
How do my credits reach my college?
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.
3 credits · NCCRSEnroll →