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?
@omikay
Copy link

omikay commented May 4, 2023

Omid Kayhani | Fatima Ali | Younes Nourzehi | Abdullah Karkarli

  1. It's a design structure and architecture to create separate components of code into Model, View, and Controller.
  2. It is a part of the code that is responsible for fetching data from databases and manipulating it as prompted.
  3. It is a part of the code responsible for showing the data on the client side. a homepage of a company website is handled by the view components.
  4. controller sits between the view and model components is basically responsible for creating a connection between what the UI and the data model.
  5. it's hard to separate our code into interconnected components,
    the complexity in code navigation (with all updates, the structure becomes more complex),
    the cost of frequent changes and updates,
    MVC pattern can be hard to understand due to the complexity and updates,
    MVC must have strict rules over methods (appropriate reactions from Controller),
    developers need to know multiple technologies in order to understand and use MVC.

@Mustapha909
Copy link

@AsliSema @handedemirbay @ilaydanurguzel1

1-Model–view–controller (MVC) is a software design pattern commonly used for developing user interfaces that divide the related program logic into three interconnected elements.
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 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.

3-In the Model-View-Controller (MVC) pattern, the view handles the app's data presentation and user interaction. Examples : HTML templates, XML templates, PDF templates, Mobile app views

4- Controllers act as an interface between Model and View components to process all the business logic and incoming requests, manipulate data using the Model component and interact with the Views to render the final output. For example, the Customer controller will handle all the interactions and inputs from the Customer View and update the database using the Customer Model. The same controller will be used to view the Customer data.

5-Usage of MVC depends upon various factors such as whether our applications consist of UI, does it requires scalability or extensibility or testability, or maintenance, like a simple web page sharing basic information, does not require MVC implementation but a dynamic interactive page needs it. Major drawbacks of MVC in react js include manipulation of DOM which is very expensive and also the cost of time and memory wastage. There is no formal validation support for MVC. The code/implementation is generally difficult to read, understand, unit test, and reuse the model which is a major disadvantage so cannot be used at microscopic(small) levels.

@cansucreates
Copy link

Team members: @cyberRasam , @TesnimNakilci , @MOHAMMAD-ALMOHAMMAD, @cansucreates

1 - MVC is a pattern which stands for "Model, View, Controller".
This pattern is favored because of its alignment with the computer science design principle, separation of concerns, Links to an external site.. We can divide up functional responsibilities within our file structure and separate business logic from display handling. For example, we can have our database connection in one file and API routes in another file.
In object-oriented programming development, model-view-controller (MVC) is the name of a methodology or design pattern for successfully and efficiently relating the user interface to underlying data models.

2 -The Model component is where the schemas of the database should be placed. This can represent either the data that is being transferred between the View and Controller components or any other business logic-related data.

3 - the View component represents the user interface of an application. It is responsible for displaying the data from the Model component to the user and enabling them to interact with it. The View component is designed to be passive and has no knowledge of the application's logic or data.

The View component typically includes the following tasks:

Presentation logic: It defines how the data is presented to the user, such as formatting, styling, and layout.

User input handling: It enables the user to interact with the data, such as entering data, clicking buttons, and selecting options.

Event handling: It responds to events generated by the user interface, such as button clicks or key presses, and communicates with the Controller component accordingly.

Some common examples of Views in web development include:

HTML/CSS templates: These are pre-designed layouts that display data from the Model component. They define the structure, styling, and formatting of the user interface.

Web pages: Web pages are the primary way users interact with web applications. They use HTML/CSS templates to display data and enable user interaction through forms, buttons, and links.

User interfaces: User interfaces are interactive components of web applications, such as dropdown menus, pop-up windows, and sliders.

Mobile applications: Mobile applications use Views to display data and enable user interaction through touchscreens and other mobile-specific features.

Overall, the View component is a crucial part of the MVC architecture as it provides the user interface and enables users to interact with the application's data. The separation between the View component and the Model component allows developers to work on each component independently, making the development process more efficient and less error-prone.

4 - The Controller component in the MVC (Model-View-Controller) pattern is responsible for receiving and handling requests from users and coordinating the actions of the Model and View components. It acts as the mediator between these two components, serving as an intermediary to ensure that the View is always displaying the most up-to-date information from the Model. When a user interacts with the View component, such as by clicking a button or entering data into a form, the View sends a request to the Controller. The Controller then processes the request, updates the Model accordingly, and sends a response back to the View with the updated information. The View then displays the updated information to the user.

5 - Shortcomings/Disadvantages of MVC Design Patterns:

Complexity: Implementing the MVC pattern can add complexity to the codebase, especially for smaller projects. This can make it harder to maintain and debug the code.

Proper Separation of Concerns: The MVC pattern requires a clear separation of concerns between the Model, View, and Controller components. However, it can be challenging to determine what functionality belongs in each component, especially in more complex applications.

Consistency: It can be difficult to ensure consistency across multiple View components that display the same data in different formats. For example, ensuring that the formatting and validation rules are the same across multiple Views can be a challenge.

Testing: Properly testing a MVC application can be more challenging than testing applications built on other architectures. Since MVC separates the concerns of presentation and business logic, testing the Model and Controller components can require different tools and techniques than testing the View component.
Learning Curve: Developers who are not familiar with the MVC pattern may require additional training and time to become proficient in its use. This can add additional costs and time to the development process.

Learning Curve: Developers who are not familiar with the MVC pattern may require additional training and time to become proficient in its use. This can add additional costs and time to the development process.

@sncey
Copy link

sncey commented May 4, 2023

@aydinfz @radmanlo @HishamWattar @abdulrahmanalbakkar @tomiece317

1- The Model-View-Controller (MVC) architecture is a design pattern used in software development to separate an application's concerns into three interconnected components: the Model, which represents the application's data and business logic; the View, which is responsible for displaying the data to the user; and the Controller, which handles user input and updates the Model and View accordingly. This separation of concerns improves code maintainability, allows for easier testing and modification, and promotes code reusability.

image

2- The Model component in the Model-View-Controller (MVC) architecture is responsible for managing the data and business logic of an application. It interacts with the database or any data source and provides methods to perform all the operations related to data manipulation, such as creating, reading, updating, and deleting data. The Model acts as the single source of truth for the data in the application, and the other components, View and Controller, interact with it to access and manipulate the data. By separating the data and business logic from the user interface, the Model component makes it easier to maintain and test the application.

3- The View component in MVC is responsible for displaying data to the user and handling the user interface. It is independent of the data or business logic in the application and can be designed in different ways. Examples of Views in web development include web pages, templates, and forms, which create user interfaces for interaction with the data provided by the Model component. For example, the Customer view will include all the UI components such as text boxes, dropdowns, etc. that the final user interacts with.

4- The Controller component in MVC manages user input, updates the Model accordingly, and controls the flow of data between the Model and View components. It acts as an intermediary between the two, receiving requests from the View for data and retrieving the necessary data from the Model. The Controller is responsible for managing user input, updating the Model, and controlling the flow of data in an MVC application. The controller doesn’t have to worry about handling data logic, it just tells the model what to do.

5- Some common challenges of using the Model-View-Controller (MVC) architecture in software development include:

  • Complexity: The MVC architecture can be more complex to implement and maintain than other design patterns, especially for smaller applications.

  • Learning curve: Developers may need to learn new skills and tools to effectively implement the MVC architecture.

  • Separation of concerns: Proper separation of concerns can be difficult to achieve, leading to an overlap in responsibilities between components.

  • Performance: The MVC architecture can add overhead and reduce performance due to the increased number of components and interactions between them.

  • Testing: Testing can be more complex in MVC applications due to the need to test each component separately and in combination.

@AmmarAlmuain
Copy link

image
1- Model-View-Controller (MVC) is a software architectural pattern commonly used for developing user interfaces that divide the related program logic into three interconnected elements: the model, the view, and the controller 1. This is done to separate internal representations of information from the ways information is presented to and accepted from the user.
2- The Model-View-Controller (MVC) architectural pattern separates an application into three main components: the model, the view, and the controller.
3- The View component in MVC is responsible for presenting content through the user interface . In web development, common examples of Views include dynamic navigation menus, tag clouds, sign-in panels, shopping carts, recently published articles, and sidebar content on a blog.
4- the browser sends a request to the Controller. Then, the Controller interacts with the Model to send and receive data. The Controller then interacts with the View to render the data.
-The Controller component in the Model-View-Controller (MVC) pattern is responsible for handling user requests, updating the model, and updating the view.

The primary responsibility of the Controller is to receive user input, such as HTTP requests, and translate that input into actions that the Model and View components can understand. The Controller then updates the Model component to reflect the changes requested by the user, and updates the View component to display the updated state of the Model to the user.
In summary, the Controller acts as an intermediary between the user, the Model, and the View. It receives user input, updates the Model accordingly, and then updates the View to reflect the changes in the Model. By separating the responsibilities of the application into distinct components, MVC promotes modular design, code reusability, and maintainability.

5- An MVC structure has difficulty with its bidirectional communication, which made it difficult to debug and comprehend when a change in one object had a cascading effect on the entire codebase.

@ozlemkeles
Copy link

Atakan Serbes, Yasir Irzooqi @Irzooqi, Özlem Keleş, Ahmad Alashtar @ahmadalashtar

  1. MVC is a way to organize software into three parts: the part that deals with data and logic (model), the part that shows data to the user (view), and the part that handles user input and controls the model and view (controller). This separation makes it easier to build, test, and maintain software.

  2. The model is responsible for managing the data and enforcing the rules that apply to that data. It provides a way for the rest of the software to interact with the data in a consistent way.

  3. The view is what the user sees and interacts with. It's responsible for presenting data to the user and allowing the user to interact with the software.

  4. The controller is responsible for handling user input and making sure the model and view are updated accordingly. It's the part of the software that contains the "brains" and decides what should happen when a user interacts with the software.

  5. MVC is a popular architecture for building software because it makes it easier to manage complexity and maintain code over time. However, it can also be challenging to implement, especially for new developers. To make it work well, developers need to follow best practices and use appropriate tools and frameworks.

@idincer944
Copy link

members: İsmail Dincer - Berra Mahmut - Said Baradai - Abdurrahman Abuzaid
1- MVC is a kind of artitectural design that makes our project easier to manage and maintain by splitting our project into three main compononets.

2- Model is a folder that contains models of our project (user, product etc.) and the business code.

3- View component is responsible for displaying and rendering the user interface. It also contains the data that controller gets from the model. All the pages on the frontend side. (html, css, etc.)

4- Controller is the intermediary between the model and view. It gets the request from the user and sends it to the model then gets the data from it and redirects it to the responsible view.

5- It is awesome! No challanege for us.

@0Rawan
Copy link

0Rawan commented May 4, 2023

@irodamrj @nezirAydin @zeynepdumlupinar @0Rawan

  1. The Model-View-Controller (MVC) architecture is a software design pattern that separates an application's data (Model), user interface (View), and control flow (Controller) into distinct components. - The View is responsible for displaying the data to the user and handling user input. UI
  • The Controller acts as the mediator between the Model and the View. It receives input from the user via the View and translates it into actions that update the Model. The Controller also communicates with the View to update the user interface based on changes in the Model. it helps to create applications that are modular, flexible, and easy to maintain.
  1. Model consists of the structure of our data and handles operations to be performed on the database
  2. View: The part of our application handles everything to be shown to the user, an example is the user interface like buttons, text fields, images, and text.
  3. Controller: This has all the logic to control and respond to the requests that the user is sending by interacting with the views. The controller routes commands to the model and views parts.
  4. has difficulty with its bidirectional communication, which made it difficult to debug and comprehend when a change in one object had a cascading effect on the entire codebase so it'll be difficult to scale, and test.

@afrakucukaydin
Copy link

Room members: @sheidanouri- @OmarQaqish - @Gulllied - @afrakucukaydin

1- Model View Controller (MVC) architecture is a software development pattern that separates an application into three main components: Models, Views, and Controllers. Models store the data logic and interact with databases. Views display the data to the user interface. Controllers handle the user requests and work with the models to perform actions or retrieve results. MVC architecture follows the principle of separation of concerns, which aims to address different and specific issues in each component. MVC architecture is widely used for web and mobile applications

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. For example, a Customer object will retrieve the customer information from the database, manipulate it and update it data back to the database or use it to render data.

3- The View Component defines logic in InvokeAsync method which returns IViewComponentResult. Required parameters directly come from invocation of the View Component. It never handles a request directly. The View Component initializes the model and passes to the View using "View" method

4- Controllers act as an interface between Model and View components to process all the business logic and incoming requests, manipulate data using the Model component and interact with the Views to render the final output. For example, the Customer controller will handle all the interactions and inputs from the Customer View and update the database using the Customer Model. The same controller will be used to view the Customer data

5- There are a few disadvantages of MVC architecture:

the complexity in code navigation (with all updates, the structure becomes more complex),
the cost of frequent changes and updates,
MVC pattern can be hard to understand due to the complexity and updates,
MVC must have strict rules over methods (appropriate reactions from Controller),
developers need to know multiple technologies in order to understand and use MVC.

@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