Ready to test your skills in creating a distributed architecture? In this chapter, you’re the software architect. You’ll be determining architectural characteristics, building a logical architecture, making architectural decisions, and deciding whether to use microservices or event-driven architecture. The exercises in this chapter will give you an end-to-end view of what a software architect does and show you how much you’ve learned. Get ready to create an architecture for a student standardized test–taking system called Make the Grade. Good luck—we hope you get an A on your architecture!
Welcome to Make the Grade
Congratulations—you’ve just been hired by Dataville Public Schools to build a new system for standardized testing. All students in a specific grade level will take the same test to determine how well students, teachers, and the schools are doing.
Make the Grade requirements document
-
□ Students will take a web-based test in their homeroom, proctored by their homeroom teacher. Because tests are timed (2 hours), the system must present questions as fast as possible.
-
□ Each student is presented with a multiple-choice question on the screen. Once they answer it, the system captures the answer and delivers the next question. Students may skip questions, but may not go back to prior ones—only moving forward is allowed.
-
□ Once captured, each answer is automatically graded (correct or incorrect) and the results are stored in a central relational database, which has only 300 database connections available.
-
□ Anywhere from 20 to 200,000 students could be taking tests at the exact same time.
-
□ The Dataville Public Schools testing administrator is responsible for scheduling tests and for maintaining tests, answer keys, and the list of students (used when students sign in to the system).
-
□ Rita, the head of Dataville Public Schools, uses the system to generate student reports, teacher evaluations, and school reports after all testing is complete.
-
□ The proctor (teacher) uses the system to find out when tests are scheduled.
“It’s imperative that no student answers are lost, even if the system crashes.”
Note
Rita has some other important requirements for the system.
“We need this system in place for the start of the next term , which is in six months.”
“You absolutely have to make sure that students cannot hack into the system and steal the test answer keys.”
“Testing doesn’t occur every day. Some days there are only 20 students taking a test; other days there could be 200,000 at the exact same time. Sometimes tests might be staggered throughout the day.”
Student testing workflow
Now that you have the requirements, let’s take a look at the primary workflow of the Make the Grade system so you can better understand those requirements.
Sharpen your pencil
Given the requirements for Make the Grade, list some challenges that you will need to address when creating an architectural solution.
Solution in “Sharpen your pencil Solution”
Planning the architecture
We have to create an architecture first.
As you’ve learned, architecture is a critical part of any software system. Without it, the system will likely fail to achieve any of its goals.
Before you start developing code, you have to create an architecture. This means going back to what you learned in Chapter 1 about the four dimensions of software architecture.
Don’t worry—we’ll get the system done. But first, it’s important to know what we’re building.
The architects’ roadmap
Let’s get the Make the Grade architecture started. You’ll use the steps you’ve learned to translate requirements into an architecture.
This diagram will serve as your roadmap as you make your way through each of the exercises, so get used to seeing it. The next few pages will walk you through these steps.
Good luck on your journey—Dataville Public Schools is counting on you.
Step 1: Identify architectural characteristics
In this first step, you’ll use the requirements below to identify the architectural characteristics that are critical for the success of the Make the Grade student test-taking system. On the next page, identify up to seven driving characteristics. Then select the three you think are the most critical for the system to be successful.
Remember, implicit characteristics are those that are implied in virtually every software architecture. (Would you ever not worry about security?) If you see one you feel is critical for the success of the system, move it over to the driving characteristics area.
-
“It’s imperative that no student answers are lost, even if the system crashes.”
-
“We need this system in place for the start of the next term , which is in six months.”
-
“You absolutely have to make sure that students cannot hack into the system and steal the test answer keys.”
-
“Testing doesn’t occur every day. Some days there are only 20 students taking a test; other days there could be 200,000 at the exact same time. Sometimes tests might be staggered throughout the day.”
Note
We copied the requirements here to make it easier for you to use them to identify the driving architectural characteristics.
Make the Grade requirements document
-
□ Students will take a web-based test in their homeroom, proctored by their homeroom teacher. Because tests are timed (2 hours), the system must present questions as fast as possible.
-
□ Each student is presented with a multiple-choice question on the screen. Once they answer it, the system captures the answer and delivers the next question. Students may skip questions, but may not go back to prior ones—only moving forward is allowed.
-
□ Once captured, each answer is automatically graded (correct or incorrect) and the results are stored in a central relational database, which has only 300 database connections available.
-
□ Anywhere from 20 to 200,000 students could be taking tests at the exact same time.
-
□ The Dataville Public Schools testing administrator is responsible for scheduling tests and for maintaining tests, answer keys, and the list of students (used when students sign in to the system).
-
□ Rita, the head of Dataville Public Schools, uses the system to generate student reports, teacher evaluations, and school reports after all testing is complete.
-
□ The proctor (teacher) uses the system to find out when tests are scheduled.
Exercise
In Chapter 2 , we showed you how to use this template to limit the number of architectural characteristics. Flip back to “Sharpen your pencil” if you need a refresher on how to use it.
Solution in “Exercise Solution”
Step 2: Identify logical components
Good job! Now that you’ve identified the critical architectural characteristics for Make the Grade, it’s time to apply what you learned in Chapter 4 to create logical components.
Using the requirements and primary workflow on the previous pages, use the actor/action approach to identify the users and their actions . Then identify as many logical components as you can on the next page.
Here’s some additional information you might find useful for this exercise:
-
Students sign in to the system using their student ID. The system will verify the date, student ID, test, and teacher when a student signs in.
-
Rita, the head of Dataville Public Schools, will wait at least one day after testing has finished before generating reports.
Note
This gives the system time to record all the answers in the database.
-
The classroom teacher acts as the proctor for the test, watching the students to make sure they don’t cheat and providing assistance. The teachers use the system to find out when a test is scheduled for their class.
-
When a test is created, the questions and answers are sent to the test administrator, who enters them into the system. The same goes for any modifications to existing tests.
Sharpen your pencil
Using the actor/action approach, identify the actions for each of these actors.
Solution in “Sharpen your pencil Solution”
Exercise
Using the space below, draw your logical components and their interactions.
Solution in “Exercise Solution”
Step 3: Choose an architectural style
We know that this system will have separate parts that require different architectural characteristics, so it makes sense to use a distributed architecture , such as microservices or event-driven architecture. Leveraging what you’ve learned about both styles, use the next page to analyze their pros and cons with respect to the Make the Grade test-taking system. You will also need to go back to the requirements, your logical architecture, and the star rating charts for each architectural style (we’ve added those for you below). Choose an architectural style based on your analysis.
Here are some considerations that might help you decide which architectural style would be better suited for Make the Grade:
-
Go back to your logical architecture diagram and count the actions you identified that you would consider events . If you find there aren’t many events, event-driven architecture might not be the right choice.
-
Think about the nature of the data in the system. If most of the data is shared, then microservices probably isn’t the right choice.
-
Think about how many actions you identified are synchronous and how many are asynchronous . If you have a lot of synchronous actions, event-driven architecture might not be a good fit.
Exercise
Outline the pros and cons of each architectural style to help you make a choice about which one might be most appropriate for Make the Grade.
Solution in “Exercise Solution”
Step 4: Document your decision
Good work: you’ve just chosen which architectural style you are going to use for Make the Grade. Now’s your chance to explain why you made the choice you did and document your architectural decision.
As you learned in Chapter 3 , an architectural decision record , or ADR, is an effective way to document your architectural decisions. Use the ADR on the next page to document your architectural style decision. Assume that this is your 11th architectural decision.
Note
Revisit Chapter 3 if you need a refresher on architectural decision records.
Every architectural decision has consequences.
Maybe it’s cost, or maybe it’s sacrificing a little bit of performance to have better security. Regardless, every architectural decision has consequences.
Think about the trade-off analysis you just did. Each one of those trade-offs implies a consequence—something you were willing to give up (or accept) to get something better. The Consequences section of an ADR is a great place to document your trade-off analysis and the corresponding consequences of your decision.
If you can’t find any consequences in your architectural decision, keep looking, because they’re there.
Exercise
Architectural Decision Record
Solution in “Exercise Solution”
Step 5: Diagram your architecture
Now it’s time to combine all four dimensions of software architecture and show us your vision of the Make the Grade architecture. In this last exercise, you’ll diagram your architecture on the following page using the key on this page.
There’s not a lot of room to diagram your architecture, but that’s intentional. While a lot of detail can go into architecture diagrams, what we’re asking you to do is sketch out a high-level physical view showing the user interfaces, services, databases, communication type (sync or async), and how all of these architectural artifacts connect to each other.
Physical Architecture Key
![]() | Draw a computer screen to represent the user interface , and indicate which type(s) of users are interacting with it. For example, if you have separate user interfaces for the test administrator and the education department (for generating reports), show two computer screens. If they share a single user interface, show one computer screen with multiple actors interacting with it. |
![]() | Use a box to represent a service. Be sure to include the components that the services implement, which should match the logical components you identified in the prior exercise. Also, indicate which user interfaces access the service and which other services communicate with the service. Last, give your service a meaningful and descriptive name . NoteFeel free to annotate your diagram to clarify points or describe things. |
![]() | Draw a cylinder to represent each physical database in your solution. Your label should indicate what type of data it stores (for example, Student Answers ). Show which services write to the database and which services are read-only by drawing arrows to indicate the data flow to and from the services. (Writes assume reads.) |
![]() | Draw dotted lines to represent asynchronous communication (such as using a queue, topic, or stream), and solid lines to represent synchronous (blocking) communication between services and user interfaces. |
![]() | If your architecture uses messages or events, draw a box or an envelope to indicate the data being passed (for example, Student Answer ) or the event being triggered (for example, Answer Submitted ). |
Exercise
Use this space and refer to the key on the previous page to sketch your physical architecture for Make the Grade.
Solutions in “Exercise Solution”
There are no right (or wrong) answers!
Congratulations—you’ve just created an architecture!
What we’re about to show you are the exercise “solutions.” We’ve used quotes there because our answers are not the only ones possible. You see, there are no right or wrong answers in software architecture: it’s all about analyzing trade-offs and being able to justify your decisions.
Compare your answers with the ones we’re about to show you. See how your solutions differ and think about what you might have done differently, or confirm that you made what seems to you to be the most appropriate choice. We’ll show you our Make the Grade architectures for microservices and event-driven architecture, since both these styles are viable options.
Software architecture is always a learning process. Each new problem brings a whole new set of conditions, constraints, and business and technical concerns. There is no one-size-fits-all architecture—it’s up to you, the architect, to come up with the most appropriate architecture for your situation.
Bullet Points
-
When analyzing requirements for a business problem, always gather additional information from the business stakeholders or project sponsor.
-
While there’s no “checklist” for creating an architecture, the four dimensions of software architecture (introduced in Chapter 1 ) provide a good roadmap.
-
Identifying driving architectural characteristics requires you to analyze the business requirements and technical constraints.
-
Implicit architectural characteristics become driving characteristics if they are critical or important to the success of the system.
-
Make sure you can tie each driving characteristic back to some sort of requirement or business need.
-
When identifying logical components and creating a corresponding logical architecture, try to avoid adding physical details such as services, databases, queues, and user interfaces—those artifacts go into the physical architecture .
-
When choosing an architectural style, make sure you take into account the characteristics of the architectural style, the problem domain, and the driving architectural characteristics you identified.
-
Hybrid architectures (those combining two or more different architectural styles) are very common. Just be sure to verify that the hybrid architecture still addresses your critical architectural characteristics.
-
Architectural decision records (ADRs) are a great way to document your choices. They communicate the reasons for your architectural decisions as well as your trade-off analyses.
-
When diagramming your physical architecture, be sure to include all the components you identified in your logical architecture.
-
Remember that there are no right or wrong answers in software architecture. As long as you can provide a reasonable justification for your architectural decisions, you are on the right track for success.
You are well on your way to thinking architecturally!
We are going to assume that you actually read this book all the way through and didn’t just jump to the end. If so, we congratulate you for it! Job well done.
Congratulations!
You’ve made it to the end.
Though there is still the appendix.
And the index.
And there’s a website...
You aren’t getting away that easily!
(Go ahead, you can admit it—you just can’t get enough of software architecture, can you?)
From “Sharpen your pencil”
Sharpen your pencil Solution
Given the requirements for Make the Grade, list some challenges that you will need to address when creating an architectural solution.
-
Storing up to 200,000 simultaneous student answers in a relational database that has only 300 connections.
-
Delivering the next question to each student as fast as possible while making sure student answers are not lost.
-
Coming up with a viable solution that can be delivered within a six-month time frame.
-
Making the system elastic to reduce cost and resource use when testing is not happening or there are only a few students taking a test.
From “Sharpen your pencil”
Sharpen your pencil Solution
Using the actor/action approach, identify the actions for each of these actors.
From “Exercise”
Exercise Solution
In Chapter 2 , we showed you how to use this template to limit the number of architectural characteristics. Flip back to “Sharpen your pencil” if you need a refresher on how to use it.
From “Exercise”
Exercise Solution
Using the space below, draw your logical components and their interactions.
From “Exercise”
Exercise Solution
Outline the pros and cons of each architectural style to help you make a choice about which one might be most appropriate for Make the Grade.
From “Exercise”
Exercise Solution
Architectural Decision Record
Title: 011: Use of the microservices architectural style for the Make the Grade system
Status: Proposed
Context:
Make the Grade is a test-taking system that needs high levels of responsiveness, fault tolerance, elasticity, and data integrity. Because there are separate parts of the system (admin, reporting, grading, and test taking) that require different architectural characteristics, a distributed architecture is appropriate. The two choices are microservices and event-driven architecture.
Decision:
We will use the microservices architectural style.
Microservices provides the necessary fault tolerance, elasticity, and scalability.
Performance deficiencies and high responsiveness needs are addressed through minimal inter-service communication, caching to minimize data retrieval needs (student information, test questions, and test answer keys), and asynchronous communication for automatic grading and storing students’ answers.
Data integrity (preventing data loss) is addressed by using persistent queues between the Capture Answer and Automatic Grading components, along with client acknowledgment mode in the Automatic Grading component, to make sure that each student answer stays on the queue until it is persistent in the Student Answer Database.
The test administration functionality will be a single microservice that combines the test scheduling, test maintenance, and student maintenance functionalities. Reporting will be a single microservice as well.
Consequences:
Technically partitioned teams will need to be reorganized into cross-functional teams and will work in parallel in order to finish the system in six months.
We will need to use in-memory caching to address the system’s performance, elasticity, and data sharing needs.
We will need additional infrastructure to support microservices: specifically, a service orchestrator like Kubernetes and a more effective CI/CD deployment pipeline.
From “Exercise”
Exercise Solution
Use this space and refer to the key on the “Exercise” to sketch your physical architecture for Make the Grade .
From “Exercise”
Exercise Solution
Use this space and refer to the key in “Exercise” to sketch your physical architecture for Make the Grade .




