Top-Down Design — an Approach for Flawless Software Design and Implementation

Top-Down Design

In software development, you would have read in many articles and books that the design should be a top priority. A good design would resolve many issues. The design will bring in more clarity to the developers. It will give granular details on the exact requirements. In this article, I am going to discuss the Top-Down Design approach. I will explain step by step by taking an example of eLearning.

A problem must be viewed at multiple levels. Each one of them has its benefits. The different levels in software design or development are as follows

  • Big Picture or a Theme.
  • Modules/System.
  • Sub Modules/Subsystems.
  • Features.
  • Sub features.
  • Business Rules.

Big Picture

In the big picture, it is a kind of a business goal. It is important point back to business goals. Ultimately, all we do is for better business goals. So it will take a higher priority. All decisions that you take down the line must be mapped back to business goals. To understand top-down design, let’s take an example and do a deep dive.

I am from an eLearning domain background. It would be easy for me to relate to the design process. In an eLearning application, generating progress reports for students can be a theme of requirement.

Fair enough however what kind of progress reports are required for these students. It will take you to the next level.

The type of reports will initiate you define the modules.

Modules

Defining the type of reports at a broader level constitutes the Modules’ definition. The modules are identified as

  • Instructor Reports.
  • Student Reports.

Once you define the broader modules, we have to define sub modules for these identified modules

Sub Module

Let’s take up the modules and identify the possible submodules.

  • Instructor Reports — Module
    • Course report.
    • Assignment wise Report.
    • Student wise Report.
    • Result report.
  • Student Reports — Module
    • Course wise Report.
    • Assignment wise report.

Features

Once we identify the submodules, detail it with the list of features. A few examples are:

  • Course Report
    • The Instructor should be able to generate a report for one or more courses.
    • It should have the flexibility to select a date range.
    • It should give results for all students in a course along with the Exams list as a full view option.
  • Assignment Report
    • Users should be select one or more assignments.
    • Users should be able to get the report by date range.
    • Assignment report for one specific course or multiple courses.

The features can be broken down into sub-feature as well.

Use Cases and Business Rules

For these types of reports, we need to identify business entities. Here, in this case, the business entities would be:

  • Course.
  • Students.
  • Instructor.
  • Exams.
  • Score.
  • Grade.

These entities will help to design API. Your API should be designed based on entities of a domain.

They will also help us to identify the systems and subsystems. For example, in the above list user, course, exams, and grades are all different systems on their own. Reports modules will have to interact with all these systems to get the data required for the report.

Once we have defined all the steps explained above, it is time to dig deeper into the feature and sub-feature more in-depth.

We must come up with a list of business rules for each feature or sub-feature. It must list the exact list of business rules must be achieved as part of a feature.

It will be a checklist for developers and testers for executing their tasks. A developer will ensure all those business rules are implemented for that use case. It will ensure there are no bugs related to business rules and it is one of the most important parts of the development. Testers will design test cases considering the user cases and business rules.

Nonfunctional Requirements

Once we have identified and done a deep dive of functional requirements with the help of top-down design. It is important to consider non-functional requirements like security and performance as well at each stage. It will ensure the system designed performs at a higher load or required load and is secure.

An example would be the report generation for students. It is important to understand the number of students in a course. That the system will be able to generate a report for the number of students in a course. In the case of self-learning and students can enroll do self-registration for a course.

The total number of users can grow as big as 3000 to 5000. It will give you a nonfunctional requirement. It will help you to identify the measures that must be taken to support such a big expectation. It must be handled at the design phase so that the implementation is done correctly and performs as expected.

The requirement of the user’s personally identifiable information should be fetched from another system. Here again, a nonfunctional requirement of security and performance is in the scope.

Designing a system to support all these cases requires sufficient time. We must identify these nonfunctional requirements as part of your top-down design. It will help you to come up with the right estimate as well.

Benefits of Top-Down Design

  • It helps to identify systems and subsystems.
  • Bring in more clarity on communication between two systems or subsystems.
  • Comprehensive list of features and sub-features along with all business rules.
  • No room for mistakes in implementing user requirements. High quality can be achieved.
  • Ensure to arrive at a correct estimate.
  • Easy to code as we have clearly defined expectations at all levels.
  • Nonfunctional will help to make sure it performs, secured.

Zero Downtime Deployment

Make sure that your users aren’t left hanging every time you need to upgrade by equipping your infrastructure for a Zero Downtime Deployment.

Software availability is one of the important criteria considered for the success of any software. It is important to make sure your business is not impacted due to software deployment activity. Achieving the highest software availability is possible in many ways.

A new release of software should not bring down the system. To achieve a zero downtime deployment, the software should be built considering the factors that do not demand any downtime.

There are many factors that will impact software downtime. Here, I am going to discuss a few solutions to minimize the impact on software availability from software deployments.

Deployment Architecture

Deployment architecture plays a vital role to ensure there is no downtime for software deployments. During deployment, the software should be available to the user. To achieve this, the application deployment should have these components.

1. More Than One Application Server 

To make software available all the time, it is important to have more than one application server. This will allow us to bring down one node at a time, upgrade, and bring it up to serve the users. Each node can be brought down when a newly upgraded node is up and running.

2. Load Balancer

The load balancer is required to distribute the traffic equally among all the nodes. It is a minimum requirement for a deployment architecture with more than one application server node.

Stateless

All HTTP requests must be stateless to achieve a zero downtime deployment. There should not be a one-to-one relationship between a request and an application server. For example, consider that a user request is attached to a node and we need to bring down the server to upgrade. In such a case, the user’s request would be impacted as it is tightly coupled with that application server.

The architecture should be constructed in such a way that the HTTP request should be able to be served from a different application server. Therefore, it is highly recommended to make sure your architecture is not stateful and does not have a sticky session.

In these cases, the session state is mandatorily a requirement. We should make sure the state is not stored in the application server; rather, it should be stored in a centralized server. There are many ways to store a session state in centralize servers like state server, REDIS, and SQL Server.

Backward Compatibility

In an environment with more than one application server nodes, a rolling deployment is the most common practice. That means, while upgrading servers, a few sets of nodes will be upgraded at once. After the upgrade, bring up the new upgraded ones and bring down the non-upgraded nodes.

If you have a database upgrade, then it is important to upgrade the database first before upgrading application server nodes. All these steps are incremental steps to achieve a zero downtime deployment instead of bringing all of them down together.

When first upgrading the database server, we need to make sure the newly upgraded database has the old stored procedure code. It will ensure that the old version of application nodes can work with the newly upgraded database.

It is important to roll out the guidelines for all SQL developers that the old stored procedures should exist in the DB for the backward compatibility. We follow the process to make sure to version the stored procedure for the new changes. It will ensure there is backward compatibility during the software upgrade.

Incremental Deployment

We should always explore ways that will bring down the total deployment time to designate a few steps as pre-deployment steps. If a new version needs a data upgrade or fix and it is not dependent on the new code, then it can be part of the pre-deployment steps. The pre-deployment steps will be executed incrementally before the actual deployment. If the data upgrade process takes a lot of time, then it is not advisable to do it on the same day of deployment.

A/B Deployments

In software equipped with multiple hardware infrastructures, a few sets of nodes will be serving end users and they are called active nodes. There will be a few more nodes not used by the users and they are called inactive nodes. During the upgrade process, the inactive nodes will be upgraded with the new version and tested thoroughly. Once they passed testing, through routing these new nodes will be made active and older version nodes will be brought down. The A/B deployment, or Blue/Green Deployment, is also used for critical uptime software requirements.

Some critical cases may demand downtime. However, in most cases, these steps will ensure downtime is kept to a minimum for software deployment.