Header Ads

ASP.NET Core 2: Architecture & Design Pattern Ideology

The need of more robust and interactive web experience is growing rapidly and so, is the need of more improved, simpler and developer friendly web technologies are rising in terms of making web development more productive, highly user-friendly & interactive and quicker to develop with less effort. Gone are those days when development of a website consumes a lot of time and expenses as everything needs to be done from scratch by yourself. Now a days, everything is available to a web developer and all that needs to build a website is understanding of the technology and the focus on more productive web development.

Today's demonstration is more theoretical than code base as I will try to elucidate ASP.NET Core 2 architecture and ideology behind some core design patterns being made part of the ASP.NET core 2 development templates.

                                                                    

ASP.NET Core Architecture

The ideology behind the ASP.NET core in general as the name suggests is to layer out web logic, infrastructure and core components from each other in order to provide more development friendly web development environment.  The concept is somewhat similar to "N" tier/layer architecture, the only difference is that ASP.NET core defines the layers as core component of the platform which ease the developer from redefining it in order to make solution more modular and reusable. What happens in ASP.NET core is that main Business logic and UI logic are encapsulated in ASP.NET core Web App layer, while, database access layer, cache services and web API services are encapsulated in infrastructure layer and common utilities, objects, interfaces and reusable business services are encapsulated as micro-services in application core layer.

So, in essences ASP.NET core creates necessary per-defined "N" tier/layers architecture for us developers automatically, which saves our time and effort to worry less about the complexity of necessary "N" tier/architecture of the web project and focus more on the business logic. In non-ASP.NET core environment, what happens in general that we as a developer are more focused on the business logic and the selection of best design patterns not on the architecture side because at the end of the day the final version of our web project is deployed on a single tier machine and we are more focused on managing the complexity of the project in terms of code re-usability and modular components but on a single tier, very few organizations/enterprises actually implement "N" tier/layer architecture to make their product more robust and modular as "N" tier/layer architecture requires more resources consumption, management for scaling the project as necessary and of course hiring of more skilled resources that can build the necessities.

No wonder you will find many modern web development frameworks more pre-build design pattern friendly rather that pre-build tier/layer friendly, for, that matter, a developer need to make the necessary tiers/layer himself/herself and no wonder MVC design pattern is the most popular for web development. Remember that design pattern and architecture are separate concepts, unfortunately, many senior developers refer design pattern and architecture as same, so, they refer MVC as architecture rather than design pattern. So, here comes ASP.NET core that brings the benefit of pre-build architectural framework that ease out tier deployment of the project along with providing pre-build Single Page Application (SPA) design pattern, Razor Pages (Page based more cleaner MVC model) design pattern and traditional MVC (View based model) design pattern. These design patterns are mostly used in hybrid manner, but, can be utilize as individual only pattern as well.

ASP.NET Web Core 2 Project Templates

So, here are the list of project templates that ASP.NET web core 2 provides i.e.
  1. ASP.NET Core Web App (Razor Pages).
  2. ASP.NET Core Web App (Model-View-Controller).
  3. ASP.NET Core Web API (no UI).
  4. ASP.NET Core with Angular (SPA).
  5. ASP.NET Core with React.js (SPA).
  6. ASP.NET Core with React.js and Redux (SPA).

Traditional Web Application Vs Single Page Application (SPA)

There are two approaches in which a web application is being built i.e.
  1. Traditional Web Application.
  2. Single Page Application (SPA).

1) Traditional Web Application

In Traditional Web Application development style, UI application logic is performed at server side. For example, in MVC design pattern application every time user clicks, the web request is sent back to server and on response entire page is reloaded, even with ajax calls to load only necessary component, the logic against any action is done at server level and then necessary UI or component on screen will load. This development style makes frequent web request calls impacting performance of the website.

2) Single Page Application (SPA)

In Single Page Application development style, UI logic is performed at client (web browser) side and server side is communicated primarily for data processing through web api calls. For example, modern front-end framework AngularJS provides all the necessary tools to perform interactive UI logic at client side and make only necessary calls to the server side. This definitely reduces frequent server requests and improves performance.

When to choose Traditional Application vs Single Page Application (SPA) Development Style

Here below is the excerpt from Architecting Modern Web Applications with ASP.NET Core 2 and Microsoft Azure book that explains well about the decision for development approach. Notice that most of the time hybrid approach is being used for development style:

Factor
Traditional Web App
Single Page Application
Required Team Familiarity with JavaScript/TypeScript
Minimal
Required
Support Browsers without Scripting
Supported
Not Supported
Minimal Client-Side Application Behavior
Well-Suited
Overkill
Rich, Complex User Interface Requirements
Limited
Well-Suited


Razor Pages (Page based model)

Razor Pages are the default web development approach in asp.net core. Razor pages are referred as page based model. Razor pages are built into ASP.NET core MVC, it provides all the similar features as MVC pattern provides, but, with its own syntax style and in much more cleaner way. In typical MVC (view based model) style, you will see a lot of folders each for controller, model and views. In case of razor pages, there are no such folders, but one i.e. "Pages" folder which is route folder for all pages. Instead of separate controller with actions and each action represent a view, razor pages are compact version of mvc style that attaches controller or view model directly with the page and there is no multiple views for each page, but, on one and necessary behind logic attach to the page and default endpoint is "OnGet()”" method, this is why it is termed as page based model. In simple terms, those of you who are familiar with WPF development or windows phone development or windows store development might find this style similar to MVVM pattern. So, in short razor pages are web development MVVM pattern in which view model is attach directly to the page.

Microsoft Azure vs IIS Server Deployment

The deployment of asp.net core can be done of personal web hosted server or on Microsoft azure. However, the pre-built architectural benefit that is the essence of the asp.net core will be noticed more on Microsoft Azure as Microsoft azure will automatically handles the tier/layers deployment and scaling automatically with the notice of the developer and do necessary load balancing of requests accordingly. In case of IIS server, asp.net core will be deployed as a regular single tier application requiring necessary steps for application scaling and load balancing the requests.

Conclusion

In this article, you will learn about asp.net core architecture ideology. You will also learn about different project templates that asp.net core 2 provides. You will learn about traditional web application approach and single page application (SPA) approach. You will learn about necessary comparison to choose between traditional application and single page application (SPA) approach. You will learn about asp.net core razor pages. You will also learn about asp.net core deployment advantage on Microsoft Azure instead of IIS server.

Disclaimer

I do not own any image. Images are taken from Architecting Modern Web Applications with ASP.NET Core 2 and Microsoft Azure.

30 comments:

  1. Which is great but with the templates not being kept inline with new releases of the spa frameworks it still works out easier rolling the whole thing by hand from an empty project !

    ReplyDelete
  2. Your site is amazing and your blogs are informative and knowledgeable to my websites.This is one of the best tips in my life.I have in quite some time.Nicely written and great info.Thanks to share the more information's.

    Seo Experts
    Seo Company
    Web Designing Company
    Digital Marketing
    Web Development Company
    App Development

    ReplyDelete
  3. Hey, this is an Amazing article. This article is a good read to know more tips on designing the web.
    ProWeb365

    ReplyDelete
  4. Such A Nice Post, Keep Up The Fantastic Work. Do check the link below:
    custom logo

    ReplyDelete
  5. Usually I never comment on blogs but your article is so convincing
    That I never stop myself to say something about it. You’re doing a
    Great job, Keep it up.

    The Love of People at
    New Orleans, United States

    ReplyDelete
  6. Great post! Thanks for sharing a piece of informative information. It would be helpful for newbies, keep posting. I appreciate your efforts. Click here.

    ReplyDelete
  7. Awesome article. I enjoyed reading your articles. this can be really a good scan for me. wanting forward to reading new articles. maintain the nice work!
    Data Science Courses in Bangalore

    ReplyDelete
  8. Excellent Blog! I would like to thank you for the efforts you have made in writing this post. Gained lots of knowledge.
    Data Analytics Course

    ReplyDelete
  9. What an incredible message this is. Truly one of the best posts I have ever seen in my life. Wow, keep it up.
    AI Courses in Bangalore

    ReplyDelete
  10. I am sure it will help many people. Keep up the good work. It's very compelling and I enjoyed browsing the entire blog.
    Business Analytics Course in Bangalore

    ReplyDelete
  11. You have completed certain reliable points there. I did some research on the subject and found that almost everyone will agree with your blog.

    Data Science Training in Bangalore

    ReplyDelete
  12. Wonderful blog found to be very impressive to come across such an awesome blog. I should really appreciate the blogger for the efforts they have put in to develop such amazing content for all the curious readers who are very keen on being updated across every corner. Ultimately, this is an awesome experience for the readers. Anyways, thanks a lot and keep sharing the content in the future too.

    Digital Marketing Training in Bangalore

    ReplyDelete
  13. I wanted to leave a little comment to support you and wish you the best of luck. We wish you the best of luck in all of your blogging endeavors.

    Artificial Intelligence Training in Bangalore

    ReplyDelete
  14. You actually make it seem like it's really easy with your acting, but I think it's something I think I would never understand. I find that too complicated and extremely broad. I look forward to your next message. I'll try to figure it out!

    Machine Learning Course in Bangalore

    ReplyDelete
  15. This is great job, thanks for sharing it with us.

    Buy law essay

    ReplyDelete

  16. I feel very grateful that I read this. It is very helpful and very informative and I really learned a lot from it.
    Data Analytics Course

    ReplyDelete
  17. I am really enjoying reading your well written articles. I am looking forward to reading new articles. Keep up the good work.
    Data Science Courses in Bangalore

    ReplyDelete
  18. What an incredible message this is. Truly one of the best posts I have ever seen in my life. Wow, keep it up.
    AI Courses in Bangalore

    ReplyDelete
  19. I am sure it will help many people. Keep up the good work. It's very compelling and I enjoyed browsing the entire blog.
    Business Analytics Course in Bangalore

    ReplyDelete
  20. You have completed certain reliable points there. I did some research on the subject and found that almost everyone will agree with your blog.

    Artificial Intelligence Training in Bangalore

    ReplyDelete
  21. Excellent Blog! I would like to thank for the efforts you have made in writing this post. I am hoping the same best work from you in the future as well. I wanted to thank you for this websites! Thanks for sharing. Great websites! Modern Java EE Design Patterns PDF

    ReplyDelete
  22. I have read good things here. Definitely worth to bookmark again. I am amazed at how much effort you put into creating such an informative website.

    Data Science Training in Bangalore

    ReplyDelete
  23. Happy to chat on your blog, I feel like I can't wait to read more reliable posts and think we all want to thank many blog posts to share with us.

    Data Science in Bangalore

    ReplyDelete
  24. Hey friend, it is very well written article, thank you for the valuable and useful information you provide in this post. Keep up the good work! FYI, Pet Care adda
    Credit card processing, Klara and the Sun PDF Download ,my favourite movie essay

    ReplyDelete
  25. Amazingly by and large very interesting post. I was looking for such an information and thoroughly enjoyed examining this one. Keep posting. An obligation of appreciation is all together for sharing.data science course in bhubaneswar

    ReplyDelete
  26. I am more curious to take an interest in some of them. I hope you will provide more information on these topics in your next articles.

    Data Science in Bangalore

    ReplyDelete
  27. I think this is an informative and very useful and knowledgeable blog. therefore, I would like to thank you for your effort.
    Data Science Course in Jaipur

    ReplyDelete
  28. it's really nice and meanful. it's really cool blog. Linking is very useful thing.you have really helped lots of people who visit blog and provide them usefull information. Web Design Oxford

    ReplyDelete