You've started your business, and it has grown into a thriving endeavor. Your product is doing very well, and now it's time to invest in expanding your offering online. However, you want to make sure that the approach you take towards correctly structuring your online product offering will be an architecture that is scalable.
When deciding the architectural approach, does your business or product offering contain a supporting database? Will it scale towards becoming an eCommerce website? If so, the three-tiered architectural approach to expanding your site is a must.
Three-Tiered Architecture at a Glance
A three-tiered architectural design to a business system consists of the Presentation Layer, the Business/Service Layer, and the Data Layer. These layers are independent of each other and if need be, can run on separate servers. Each tier is developed and maintained as independent modules. Here is a breakdown of each layer.
In fact, an entirely new career path for developers has been forged in this layer. If there's one takeaway, the beginning and the end of processing requests or data in a three-tiered application is in this layer.
Requests are usually in the form of objects that represent data that your application is wanting to retrieve or save. For instance, you may be wanting to set up a new customer or you may be wanting to get transaction history of what an existing customer has purchased through your business or website.
Validation is also done in this layer to ensure that all required data elements that are needed to process a request are present. If required data elements are missing, processing the request is halted, and the user is notified what data is missing.
This layer contains logic that will take the requests or objects that are sent from the Presentation Layer and begin to use business rules or business logic to determine how to save or process data. Examples of this would be the following:
- A customer logs into your eCommerce site to purchase products. Based on their order history, you could have a business rule in place that automatically gives preferred customer discounts or shipping rates. This would be for example a Customer Response object.
- Your payments have different payment types, i.e. check, credit card, ACH, but they are saved as transactions. Business rules or logic will take these different types and transform them into a transaction object and pass them to the Data Layer for saving.
Transformation will always occur when creating, updating, or deleting data. They are transformed or mapped to what are called Data Transformation Objects, or DTO’s for short. These are data containers for moving data between layers. Once transformed these objects will be passed to the final layer, the Data Layer.
This is the final layer in the three-tiered architecture. This layer receives the transformed objects or DTO from the Business/Service Layer and converts them to Entity objects that represent database tables. The main rule to follow in this layer is that there should not be any additional business rules or logic run on the objects.
Saving of the data to your database should happen here. This is done in the form or LINQ to SQL or stored procedures. Your data layer can connect to a database directly to save the data or it can be passed to a web service that will handle the saving of data.
Advantages of Three-Tiered Architecture
The advantages of this architecture are tremendous. Each layer is independent of the other. With this approach, each layer contains logic that can be updated or changed without affecting the other layers. Logic is streamlined and only does what it needs to do. You no longer have logic that would be bundled up to receive requests, run business rules, and make calls to the database in one method or function. It is now separated and easier to maintain.
Because each layer is separated and can be managed independently, flexibility is increased. Development time is also streamlined. Work can be divided as web designers or frontend developers can work on the presentation, while software engineers can work on business rules/logic and the storing of data.
Disadvantages of Three-Tiered Architecture
After many years of development experience building and maintaining systems, this is the preferred approach - but there are some pitfalls. This is a more complex structure for junior developers. Ramp up time towards understanding this approach could take some time.
Setup is also time consuming. Knowing what areas need enhancing or updating for new features can be time consuming. Seasoned developers who are proficient in this architectural design methodology can quickly identify areas in each layer that would need to be updated, but if your team is new to this approach, it can be time consuming.
The three-tiered architectural design is an excellent approach towards ramping up your business to an eCommerce site or database-driven site. The main advantage is that once you decide to implement a three-tiered structure, it is more scalable, flexible, maintainable, and faster to develop. Yes, there are some trade-offs, but they pale in comparison to the advantages.
If your organization is need of a professional software development team that can help scale your product or solution, contact us today!