Skip to content

Instantly share code, notes, and snippets.

@Kishimoto96
Created May 4, 2023 11:07
Show Gist options
  • Save Kishimoto96/6263997afe1b7cb552efdf17090341b2 to your computer and use it in GitHub Desktop.
Save Kishimoto96/6263997afe1b7cb552efdf17090341b2 to your computer and use it in GitHub Desktop.

Discussion Questions about MVC architecture:

  1. What is the Model-View-Controller (MVC) architecture, and how does it work in software development?
  2. What is Model component in MVC?
  3. How does the View component work in MVC, and what are some common examples of Views in web development?
  4. What is the Controller component in MVC, and how does it interact with the Model and View components?
  5. What are some common challenges of using MVC in software development?
@jimaa-maya
Copy link

joud khanji, khaled Naes, Talal Bakkour, Jimaa Maya

1- MVC is an architectural pattern that separates an application into three main logical components: the model, the view, and the controller.
The controller receives the request for the application and passes it to the model to send and receive data.

The view then uses the data from the controller to generate presentable information to the end-user. The view is only concerned with how the information is presented, not with the end presentation. Thus, it is the Html file that renders the information from the controller.

The view then sends its final presentation to the controller, and the controller then sends the response to the browser, which then displays the response to the end-user.

2-The Model component corresponds to all the data-related logic that the user works with. This can represent either the data that is being transferred between the View and Controller components or any other business logic-related data. It can add or retrieve data from the database. It responds to the controller’s request because the controller can’t interact with the database by itself. The model interacts with the database and gives the required data back to the controller.

3-The view takes care of the data representation and generates the user interface. The view can highlight specific data or filter out the data provided by the model. It represents the input and output data using UI components like the graph, chart, button, table, text box and dropdown. The model component generates the view using the collected data. As the controller obtains these data indirectly, so the view only communicates with the controller.
In web development, Views are typically implemented using HTML, CSS, and JavaScript. Examples of Views include web pages, forms, widgets, and templates. Views provide the structure and content of the page, styles it, and add interactivity and dynamic behavior.

4-The controller is the component that allows the views and the model to communicate with one another. It acts as a mediator. The controller does not require to deal with data logic; it only instructs the model.
After getting data from the model, the controller processes it before sending it to the display and explains how to convey it to the user. We note that views and models cannot communicate directly, So it's a bridge between the model and the view.

5- A. Maintenance of code is highly complex as all the code is present inside the Controller.
Learning curve: MVC requires a significant shift in thinking compared to traditional approaches, which can make it difficult for developers who are not familiar with the architecture.

Separation of concerns: One of the main benefits of MVC is its separation of concerns, but achieving this separation can be challenging in practice, especially in large or complex applications.

Coordination between components: While MVC separates the Model, View, and Controller, they still need to work together effectively, which can be challenging to coordinate.

Testing: Testing an MVC application can be more challenging than testing traditional applications because of the added complexity of the architecture.

Over-engineering: It is possible to over-engineer an MVC application, creating unnecessary layers of abstraction that can make the codebase more complex and harder to maintain.

Scalability: MVC can be challenging to scale because it can be difficult to distribute the workload evenly between the Model, View, and Controller.

Overall, while MVC is a powerful architecture that can provide many benefits, it also comes with some common challenges that developers need to be aware of and address in their software development projects.

@motaz99
Copy link

motaz99 commented May 4, 2023

@noorin99, @zakarie, @nour, @motaz99 @Mahmod

  1. The MVC (Model-View-Controller) architecture is a software design pattern that separates the application logic into three interconnected components:

       1. Model: Represents the data and business logic of the application.
       2. View: Represents the user interface of the application.
       3. Controller: Acts as the intermediary between the Model and the View, processing user input and updating the Model as necessary, and rendering the appropriate View based on the updated Model.
    
  2. In the Model-View-Controller (MVC) architecture, the Model component represents the application's data and business logic. It is responsible for storing and managing data, as well as providing methods to access and manipulate that data. The Model component typically interacts with a database or other data storage mechanism.

  3. In the Model-View-Controller (MVC) architecture, the View component represents the user interface of the application. It is responsible for presenting the data to the user in a visually appealing and user-friendly way. The View component is typically composed of HTML, CSS, and JavaScript code. like:
    - Web pages: HTML, CSS, and JavaScript code is used to create web pages that display data to the user.

  4. In the MVC architecture, the Controller component processes user input, updates the Model as necessary, and notifies the View of any changes. It acts as the intermediary between the Model and the View components. When the user interacts with the application, the Controller receives the input and decides which action to take based on the input. It updates the Model and notifies the View to render the updated data on the screen.

  5. Learning curve: The MVC architecture can have a steep learning curve for developers who are new to the concept.

  • Separation of concerns: Separating the application logic into three components can sometimes be difficult to implement, especially for small applications.

  • Complexity: As the application grows in size and complexity, managing the interconnections between the Model, View, and Controller components can become challenging.

  • Testing: Testing can be difficult when components are tightly coupled. In MVC, testing can be challenging because the Model, View, and Controller components are often tightly coupled.

  • Over-engineering: Over-engineering can be a problem when trying to implement MVC. Some developers may try to make it more complex than necessary, leading to additional work and potential performance issues.

@houzifahabbo
Copy link

Team members: @houzifahabbo ,@ahmad Ramin ,@Eng.NUREDDIN ,@badrnasher

1- MVC is abbreviated as Model View Controller is a design pattern created for developing applications specifically web applications. As the name suggests, it has three major parts. The traditional software design pattern works in an "Input - Process - Output" pattern whereas MVC works as "Controller -Model - View" approach. With the emergence of the MVC model, creation of application takes different aspects individually into consideration. These aspects of the application are:
- UI Logic
- Input logic
- Business Logic
Benefits of using MVC architecture:
- Logical clustering of related acts on any controller can be achieved through MVC.
- Various developers can work at the same time on different parts the same application-controller, model, and the views part.
- In MVC, models can have numerous views.
image

2- Model: The Model encloses the clean application related data. But the model does not deal with any logic about how to present the data.

class person {
   final String name;
   final int age;
   final bool active;
}

3- View: The View element is used for presenting the data of the model to the user. This element deals with how to link up with the model's data but doesn't provide any logic regarding what this data all about or how users can use these data. Basically, it shows the user how the data looks like.
Examples: HTML, CSS, and sometimes JavaScript code

4- The controller is the manager of the data it transfers data between the viewer and the model and controls the flow of the application or website
5- using MVC for server data source and local data source
Learning Curve
Complexity
Tight Coupling
Testing
Scalability
Framework Limitations

@TasneemAkkad
Copy link

@tarik310 @heisenberg550 @Sara-Nefise

  1. The Model-View-Controller (MVC) is an architectural pattern that separates an application into three main logical components: the model, the view, and the controller. Each of these components are built to handle specific development aspects of an application,
    Model: The model represents the data and the logic of the application. View: The view is responsible for presenting the data to the user in a graphical form. Controller: The controller acts as an intermediary between the model and the view. By using MVC can change the view to update the user interface without changing the underlying data or logic.
  2. The model component stores data and its related logic. It represents data that is being transferred between controller components or any other related business logic.
  3. View component is responsible for presenting the data to the user in a graphical form. It is an interface that displays the data and allows the user to interact with it. View component in web development is typically implemented using HTML, CSS, and JavaScript.
  • Complexity: MVC can be complex to understand and implement, especially for developers who are not familiar with the architecture.
    -Over engineering: There is a risk of over-engineering the application when using MVC.
    -Testing: Testing the application can be challenging, especially when testing the interactions between the components.
    5.Common challenges of using MVC in software development include a steeper learning curve for developers who are not familiar with it, and potentially more overhead in implementing the separate Model, View, and Controller components.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment