Bi-monthly news update from IsDB-BISEW IT Scholarship Programme (September 2021)

 

Empower


Welcome to the September 2021 issue of Empower, the periodic newsletter of the IsDB-BISEW IT Scholarship Programme. This edition includes the following topics of note:

  • What is ASP.NET MVC? (Continuation of “An overview of the Microsoft .NET Platform”)
  • Career Snapshots of Graduates of the IT Scholarship Programme
    • From Hotel Management to Software Engineering – A Personal Account

What is ASP.NET MVC?

ASP.NET MVC is basically a web development framework from Microsoft, which combines the features of MVC (Model-View-Controller) architecture, the most up-to-date ideas and techniques from Agile development, and the best parts of the existing ASP.NET platform.

ASP.NET MVC is not something, which is built from ground zero. It is a complete alternative to traditional ASP.NET Web Forms. It is built on the top of ASP.NET, so developers enjoy almost all the ASP.NET features while building the MVC application.

 

History

ASP.NET 1.0 was released on January 5, 2002, as part of .Net Framework version 1.0. At that time, it was easy to think of ASP.NET and Web Forms as one and the same thing. ASP.NET has however always supported two layers of abstraction −

  • Web.UI− The Web Forms layer, comprising server controls, ViewState, and so on.
  • Web− It supplies the basic web stack, including modules, handlers, the HTTP stack, etc.

By the time ASP.NET MVC was announced in 2007, the MVC pattern was becoming one of the most popular ways of building web frameworks.

In April 2009, the ASP.NET MVC source code was released under the Microsoft Public License (MS-PL). "ASP.NET MVC framework is a lightweight, highly testable presentation framework that is integrated with the existing ASP.NET features.

Some of these integrated features are master pages and membership-based authentication. The MVC framework is defined in the System.Web.Mvc assembly.

In March 2012, Microsoft had released part of its web stack (including ASP.NET MVC, Razor and Web API) under an open-source license (Apache License 2.0). ASP.NET Web Forms was not included in this initiative.

 

Why ASP.NET MVC?

Microsoft decided to create their own MVC framework for building web applications. The MVC framework simply builds on top of ASP.NET. When you are building a web application with ASP.NET MVC, there will be no illusions of state, there will not be such a thing as a page load and no page life cycle at all, etc.

Another design goal for ASP.NET MVC was to be extensible throughout all aspects of the framework. So, when we talk about views, views have to be rendered by a particular type of view engine. The default view engine is still something that can take an ASPX file. But if you don't like using ASPX files, you can use something else and plug in your own view engine.

There is a component inside the MVC framework that will instantiate your controllers. You might not like the way that the MVC framework instantiates your controller, you might want to handle that job yourself. So, there are lots of places in MVC where you can inject your own custom logic to handle tasks.

The whole idea behind using the Model View Controller design pattern is that you maintain a separation of concerns. Your controller is no longer encumbered with a lot of ties to the ASP.NET runtime or ties to the ASPX page, which is very hard to test. You now just have a class with regular methods on it that you can invoke in unit tests to find out if that controller is going to behave correctly.

Benefits of ASP.NET MVC

Following are the benefits of using ASP.NET MVC −

  • Makes it easier to manage complexity by dividing an application into the model, the view, and the controller.
  • Enables full control over the rendered HTML and provides a clean separation of concerns.
  • Direct control over HTML also means better accessibility for implementing compliance with evolving Web standards.
  • Facilitates adding more interactivity and responsiveness to existing apps.
  • Provides better support for test-driven development (TDD).
  • Works well for Web applications that are supported by large teams of developers and for Web designers who need a high degree of control over the application behaviour.

 

ASP.NET MVC - Pattern

The MVC (Model-View-Controller) design pattern has actually been around for a few decades, and it's been used across many different technologies. Everything from Smalltalk to C++ to Java, and now C Sharp and .NET use this design pattern to build a user interface.

Following are some salient features of the MVC pattern −

  • Originally it was named Thing-Model-View-Editor in 1979, and then it was later simplified to Model- View-Controller.
  • It is a powerful and elegant means of separating concerns within an application (for example, separating data access logic from display logic) and applies itself extremely well to web applications.
  • Its explicit separation of concerns does add a small amount of extra complexity to an application’s design, but the extraordinary benefits outweigh the extra effort.

The MVC architectural pattern separates the user interface (UI) of an application into three main parts.

  • The Model− A set of classes that describes the data you are working with as well as the business logic.
  • The View− Defines how the application’s UI will be displayed. It is a pure HTML, which decides how the UI is going to look like.
  • The Controller− A set of classes that handles communication from the user, overall application flow, and application-specific logic.

Idea Behind MVC

The idea is that you'll have a component called the view, which is solely responsible for rendering this user interface whether that be HTML or whether it actually be UI widgets on a desktop application.

The view talks to a model, and that model contains all of the data that the view needs to display. Views generally don't have much logic inside of them at all.

In a web application, the view might not have any code associated with it at all. It might just have HTML and then some expressions of where to take pieces of data from the model and plug them into the correct places inside the HTML template that you've built in the view.

The controller that organizes is everything. When an HTTP request arrives for an MVC application, that request gets routed to a controller, and then it's up to the controller to talk to either the database, the file system, or the model.

 

Overview of ASP.NET Core MVC

ASP.NET Core MVC is a rich framework for building web apps and APIs using the Model-View-Controller design pattern.

What is the MVC pattern?

The Model-View-Controller (MVC) architectural pattern separates an application into three main groups of components: Models, Views, and Controllers. This pattern helps to achieve separation of concerns. Using this pattern, user requests are routed to a Controller which is responsible for working with the Model to perform user actions and/or retrieve results of queries. The Controller chooses the View to display to the user, and provides it with any Model data it requires.

This delineation of responsibilities helps you scale the application in terms of complexity because it's easier to code, debug, and test something (model, view, or controller) that has a single job. It's more difficult to update, test, and debug code that has dependencies spread across two or more of these three areas. For example, user interface logic tends to change more frequently than business logic. If presentation code and business logic are combined in a single object, an object containing business logic must be modified every time the user interface is changed. This often introduces errors and requires the retesting of business logic after every minimal user interface change.

Note

Both the view and the controller depend on the model. However, the model depends on neither the view nor the controller. This is one of the key benefits of the separation. This separation allows the model to be built and tested independent of the visual presentation.

Model Responsibilities

The Model in an MVC application represents the state of the application and any business logic or operations that should be performed by it. Business logic should be encapsulated in the model, along with any implementation logic for persisting the state of the application. Strongly-typed views typically use ViewModel types designed to contain the data to display on that view. The controller creates and populates these ViewModel instances from the model.

View Responsibilities

Views are responsible for presenting content through the user interface. They use the Razor view engine to embed .NET code in HTML markup. There should be minimal logic within views, and any logic in them should relate to presenting content. If you find the need to perform a great deal of logic in view files in order to display data from a complex model, consider using a View Component, ViewModel, or view template to simplify the view.

Controller Responsibilities

Controllers are the components that handle user interaction, work with the model, and ultimately select a view to render. In an MVC application, the view only displays information; the controller handles and responds to user input and interaction. In the MVC pattern, the controller is the initial entry point, and is responsible for selecting which model types to work with and which view to render (hence its name - it controls how the app responds to a given request).

 

Note: Controllers shouldn't be overly complicated by too many responsibilities. To keep controller logic from becoming overly complex, push business logic out of the controller and into the domain model.

 

What is ASP.NET Core MVC

The ASP.NET Core MVC framework is a lightweight, open source, highly testable presentation framework optimized for use with ASP.NET Core.

ASP.NET Core MVC provides a patterns-based way to build dynamic websites that enables a clean separation of concerns. It gives you full control over markup, supports TDD-friendly development and uses the latest web standards.

Features

ASP.NET Core MVC includes the following features:

  • Routing
  • Model binding
  • Model validation
  • Dependency injection
  • Filters
  • Areas
  • Web APIs
  • Testability
  • Razor view engine
  • Strongly typed views
  • Tag Helpers
  • View Components

 


Career Snapshots of Graduates of the IT Scholarship Programme

From Hotel Management to Software Engineering – A Personal Account

 

Md. Al Amin (ID: 1239745), Course: Enterprise Systems Analysis & Design with C#.NET, Round: 35

Position: Software Engineer, Organization: Digital Intelligence System Ltd

 

Md. Al Amin currently works as a Software Engineer for Digital Intelligence System Ltd. Al Amin feels both pleased and grateful as he looks back at the turn of events that brought him to this point in life.

 

The year 2015 saw Al Amin graduate with a bachelor’s degree in Hotel Management. After frantically applying for jobs for a few months the only offer he got was from a small resort located at far-off Kuakata in the district of Patuakhali. The low salary offered was not enough for his upkeep in that location. To be fair, Al Amin had had never managed to set his heart to a career in hotel management. He had chosen the field of Hotel Management only after not being able to get into in any subject of his own choice.

 

After completing his 4-years of study Al Amin was faced with the prospect of working at remote location while being underpaid. This was when he came across an advertisement for a scholarship in IT from IsDB-BISEW while visiting the computer marketplace at IsDB-BISEW. He promptly applied and after clearing the screening process in a few weeks, was inducted in Round-35 of the programme.

 

The rigour and the high standard of the training in the scholarship programme impressed Al Amin. He found the world of programming highly interesting and threw himself into his studies. The 14 month long intensive training ended in October 2018 and Al Amin became a full-fledged software developer specializing in Microsoft’s Dot.NET platform. Soon after, he landed his first job in as a developer in Better Life Hospital in Dhaka working on a hospital information system.

 

At present, Al Amin is a Software Engineer at Digital Intelligence Systems in the engineering and support areas. His work involves designing and developing Enterprise Resource Planning (ERP) software and providing support to high-value clients. He finds his job fulfilling and rewarding in all respects. Switching from hotel management to IT has paid off handsomely for Al Amin and he feels grateful to the IsDB-BISEW for giving him the opportunity that has changed his life.