Skip to content

Architectural Requirements (Demo 4)

Daniel Bezuidenhout edited this page Sep 28, 2023 · 3 revisions

Architectural Design Strategy


Strategy: Our chosen architectural designs are based on our technology choices and our Architectural Quality Requirements, so that we develop a smoothly functioning app that operates the way the client wants it to.

Architectural Patterns and Styles


Layered

The Layered Architecture pattern is useful in our application for a multitude of reasons. It increases modularity by separating concerns, which in turn allows for easier maintenance and code reusability. It also aids in scalability by allowing the modification of different layers without effecting the other layers.

Client-Server

The Client-Server Architecture pattern is another approach that will be beneficial for our app. It aids in scalability by allowing multiple users to connect to one server. It increases security by centralizing data in secure storage in the form of Firestore. It allows for the sharing of resources between clients as well as centralized management, meaning administrators can easily manage and moderate data.

Service-Oriented

The Service-Oriented Architecture pattern was another approach we decided to integrate into our project. Service-oriented approaches optimize computation and communication, which increases the application's performance. It is easier to maintain when services are split up as opposed to having one monolithic structure. It is also very easy to refactor for quality requirements such as scalability.

MVC

The Model View Controller (MVC) pattern was yet another approach we employed to achieve our quality requirements. MVC helps to aid maintainability by separating concerns into its individual parts, meaning it is easier to fix problem areas of code. Furthermore, it aids in achieving scalability as the business logic within the model can be altered to handle more users without having to change the view or controller.

final drawio

Quality Requirements

Modularity

Our app follows a layered architecture which separates all the code into their relative components, services, styling files, etc. Since we use Ionic in Angular, it is easy to create and maintain modular code structures to promote loose coupling.

Performance

Our app makes use of many approaches to improve performance. Asynchronous functions are used to execute simultaneously to speed up the app, we use Firestore which allows for real time updates and more. We also make use of lazy loading in some aspects of our code. These performance aspects are necessary as to provide a smooth and enjoyable experience for the user, which will in turn increase our user base and put more stress on the system. Hence a good design is needed to keep up with multiple concurrent users. We aim to keep any in app loading under 5 seconds and any external services under 10 seconds.

Scalability

Our app is accustomed to be scalable. Firestore uses a NO-SQL database which is accustomed for large volumes of data. This allows for significant growth in users without a bad hit to performance. Since this is going to be an app in which the social factor is a big aspect, as well as us expecting many users, we need to ensure our design is scalable to handle large volumes of data. The Firebase plan we are using currently allows 100 concurrent users, but it can be upgraded on a paid for plan for up to 200000 concurrent users

Security

We use Firestore for our backend which has in-built security features and encryption to protect users' data. We also do checks in Ionic when creating an account that passwords are suitable enough to be protected against brute force attacks. This security is necessary to protect user credentials, which could become even more sensitive if in the production world, billing details could be used for certain features.

Maintainability

Our system's architecture makes use of the layered-architecture approach. This approach naturally separates concerns of operations, which promotes low-coupling which in turn improves maintainability as functions are independent of one another.

Architectural Constraints

Each component should belong to one layer. The Clients and the Server must connect through request and reply connectors.

Technology Choices

Databases

Component Technology 1 Technology 2 Technology 3
Database MySQL Firestore MongoDB
Overview Relational database management system (RDBMS) widely used for its ease of use and scalability. Flexible and scalable NoSQL document database provided by Google Cloud Platform. NoSQL document-oriented database designed for scalability, flexibility, and high performance.
Pros - Mature and widely adopted
- ACID compliance
- Strong community support
- Fully managed and serverless
- Real-time updates with Firebase
- Automatic scaling and sharding
- Flexible schema design
- Horizontal scalability
- High-performance queries
- Replication and sharding
Cons - Limited support for unstructured data
- Vertical scalability challenges
- Vendor lock-in to Google Cloud Platform
- Limited query capabilities compared to MongoDB
- Lack of transaction support
- Eventual consistency model
- Not suitable for complex relationships
Alignment - Fits well with the selected architecture's emphasis on scalability and ease of use
- Can be integrated with object-relational mapping (ORM) frameworks
- Supports serverless architecture and real-time updates
- Fits well with microservices architecture
- Suitable for cloud-based deployments
- Supports the architecture's flexibility and schema evolution
- Suitable for handling large volumes of unstructured data
- Integrates well with microservices architecture

Final Choice ; Firestore

After taking all our other options into consideration , our final choice was Firestore as it fits our needs of having a scalable and flexible database which provides real-time updates and cloud functions. Firebase also does not enforce rigid table structures like traditional relational databases, making it more suitable for agile development and rapid iterations.

Testing Suite

Component Technology 1 Technology 2 Technology 3
Testing Suite Mocha Jest Jasmine
Overview Mocha provides developers with a flexible base test framework and options for assertion, mocking, and spy libraries. It is highly extensible and widely used in Node.js for various types of tests. Jest offers a comprehensive set of features, including a test runner, assertion library, and mocking capabilities. It is known for its fast performance and minimal configuration requirements. Jasmine is a clean and simple JavaScript testing framework for end-to-end testing with Node.js or in the browser. It does not depend on any other JavaScript frameworks but integrates well with them.
Pros Highly flexible and extensible framework. Mocha can run tests in both Node.js and browser environments, making it suitable for testing both server-side and client-side code. Fast-performing framework with minimal configuration requirements. Jest provides built-in support for snapshot testing, which allows you to capture the output of a component or function and compare it against a previously saved snapshot. This makes it easy to detect unexpected changes in code behavior. Clean and simple API for end-to-end JavaScript testing. Jasmine has an active community that provides support, resources, and plugins to enhance its functionality.
Cons Requires additional configuration and setup for features such as test runners. Mocha itself does not come with built-in features like snapshot testing or code coverage reporting. You will need to rely on additional libraries or plugins to add these features to your testing setup. May not be ideal for large projects that require integration with external libraries. You may need to spend more time configuring Jest to work with specific libraries. May not have as many advanced features as Jest or Mocha. Jasmine may not integrate as seamlessly with other frameworks or libraries.
Alignment Mocha is a flexible and widely used JavaScript testing framework that runs on both Node.js and in the browser. It provides a feature-rich environment for writing and executing tests. Jest focuses on simplicity, speed, and ease of use, making it a preferred choice for testing JavaScript applications, including Angular, and Node.js projects. Jasmine provides a behavior-driven development (BDD) style for writing tests, making them more expressive and easier to understand.

Final Choice ; Jest Testing Suite

We chose the Jest Testing Suite as our final choice as it appealed to our needs of having a testing framework that is easy to use and configure , while at the same time offering a comprehensive set of testing features and fast performance .Jest also includes built-in code coverage reports, which will assist us to measure the percentage of code covered by our tests to help us test efficiently.

Frontend

Component Technology 1 Technology 2 Technology 3
Frontend Ionic-Angular React Native Flutter
Overview Open-source framework for creating user interfaces that work on any operating system Open-source framework for building native mobile apps using JavaScript and React Open-source framework for building native mobile apps using Dart
Pros Well-integrated framework with a simple and responsive UI. Popular and widely used, with many support options Allows for building native apps using JavaScript. Supports platform-specific APIs and plugins High performance and fast development. Hot Reload feature for faster development
Cons May have performance issues compared to other frameworks. Limited access to native device features compared to native development Steeper learning curve compared to other frameworks. Reliance on third-party libraries for certain advanced functionalities. Reliance on the Dart programming language, which may require developers to learn a new language. Limited access to native features, smaller community
Alignment Ionic, which is built on top of angular inherently follows the MVC pattern. This fits in well with our architectural and design patterns React is most commonly associated with the Flux architecture, which is a variation of the client-server design pattern. React supports the architectures flexibility and it can be utilized within both the MVC and client-server design pattern. Flutter follows its own unique design pattern called the Widget-based design pattern. While it doesn't align directly with our architectural patterns of choice, it provides its own set of concepts and principles for structuring applications.

Final Choice ; Ionic

After taking all our other options into consideration , our final choice was Ionic as its features are inline with our development needs in terms of providing responsive UI and importantly considering that our application is cross platform and ionic provides an open source mobile toolkit for building high quality, cross-platform native and web app experiences.

Backend

Component Technology 1 Technology 2 Technology 3
Backend Nodejs Nestjs Django
Overview Node.js is a JavaScript runtime built on Chrome's V8 JavaScript engine. It uses an event-driven, non-blocking I/O model, making it highly efficient for handling concurrent connections and real-time applications. Nest.js is a progressive Node.js framework built with TypeScript. It uses modern architectural patterns and provides a structured approach to building scalable and efficient server-side applications. Django is a high-level Python web framework that follows the model-template-view (MTV) architectural pattern. It provides a complete set of tools and libraries for rapid development and emphasizes reusability and code efficiency.
Pros Node.js has a large and mature ecosystem of libraries and packages available through npm, allowing developers to quickly leverage existing tools and modules. Node.js excels in building applications that require real-time communication, such as chat applications and gaming servers. Nest.js promotes the use of SOLID principles and provides a modular structure that allows for better code organization and maintainability. Django has built-in features for handling user authentication, authorization, and security, making it easier to implement secure applications.
Cons Node.js provides a basic runtime environment, but developers may need to manually configure additional features like routing, authentication, and database connections. The modular and structured approach of Nest.js can add overhead and complexity to smaller projects that don't necessarily require such a level of organization. Due to its nature as a Python framework, Django can be slower in terms of raw performance compared to Node.js, especially for high-traffic or real-time applications.
Alignment Fits well with the selected architecture's emphasis on scalability and ease of use. It follows an event-driven, non-blocking I/O model, making it suitable for handling high-concurrency applications. Nest.js promotes separation of concerns and helps in organizing code using modular structures. Django promotes rapid development and follows the MVC architectural patterns. It fits well with the architectural need of realtime functions and promotes hindrance free development

Final Choice ; Nodejs

The reason we chose Nodejs as our option of choice is because Node.js follows an event-driven, non-blocking I/O model, which makes it well-suited for handling real-time applications and APIs , which is a major component in our application, as well as for its single-threaded, event-driven architecture that allows it to handle a large number of concurrent connections efficiently.