How do you build enterprise websites?

web-on-monitor-shows-internet-www-or-net-100215024

Welcome to the latest news from TalkIT. This month we are going to consider the options available to build enterprise websites. In the Microsoft arena we will focus on the choice between ASP.Net Web Forms and MVC. Which technology offers the most benefits? How do we create testable scalable applications? What’s important; speed, clean design, simplicity, maintainability …? These are just my ideas, based on 12 years experience training and developing. Just add your comments at the bottom of the blog. Introduction ASP.Net Web Forms ASP.Net MVC Can you solve this coding problem? Other Bits

Introduction

Today web developers are offered lots of choice. They can develop in PHP, ASP.NET, Java, ColdFusion … Here are the results of a W3 Tech survey: http://w3techs.com/ Server-side Programming Languages Most popular server-side programming languages

     
  PHP 82.0%  
  ASP.NET 17.5%  
  Java 2.7%  
  ColdFusion 0.8%  
  Perl 0.6%  
                         percentages of sites
 

Let’s start with a bit of history. Microsoft’s initial offering was “classicASP. This embedded Visual Basic script blocks in HTML tags. The script was executed on the web server. This is not really suitable for enterprise applications where the UI, business and database tiers need separating. About 15 years ago Microsoft introduced ASP.Net Web Forms as part of the .Net Framework. This massive leap forward avoided the clumsiness of classic ASP.

 Let’s  Start With The Form Using ASP.Net Web Formsjob-searching-100248983

The main problem with Web Forms is that the application tends to be structured, as the name implies, around the Form. Web Forms actually evolved from Windows forms. They are principally a very effective way of designing pages by dragging controls from a toolbox to design surface. They also provide many very clever server controls and web features. For example they help work with data access, signing up, validation and state management. But here are some of the significant issues with Web Forms:

  • The code-behind pattern encourages developers to mix presentation and application logic
  • Web Forms attempt to hide the workings of HTML and HTTP, this can be an obstacle
  • It’s difficult to automate unit testing
  • The page life cycle is complicated and subtle

Last week a client called me about a problem he was having with his Web Forms application. He was creating dynamic controls on a page, and then setting their properties. When his code looked for a newly created textbox, it did not find it. After looking at his code I discovered that the page was rebuilt on post back to the server, but without the textbox. This problem was resolved by creating the textbox again after the post back. This clearly illustrates common issues with Web Forms. Take a look at the TalkIT course and tutorial in Web Forms. http://talk-it.biz/course/training-asp-net-4-5-development/ http://talk-it.biz/tutorial-links/asp-net-web-development-c-using-visual-studio-2012-2/

Let’s  Start With The Pattern Using ASP.Net MVCtriangle-and-eye-10041825

 The ASP.Net MVC (Model View Controller) design pattern has been gaining popularity over the last 5 years. This pattern is radically different from Web Forms. Much more of the underlying nature of the internet is revealed. Developers work more closely with HTML and HTTP. Here are the components of the pattern: MVC Model; manages business logic classes and data access View; renders model objects with client-slide intelligence Controller; Handles incoming requests then chooses a view to render Here are the key benefits:

  • MVC pattern encourages separation of presentation and application logic
  • Reusable and consistent model classes for application logic
  • Easy to include unit tests
  • You decide the application URLs via flexible routing system
  • Tight control over HTML that is standards-compliant
  • Employs rich features of the ASP.NET platform
  • Simplifies JavaScript/Ajax integration

Key new features in MVC3 and MVC 4:

  • Expressive views, including the new Razor view engine
  • Internet and Intranet project templates
  • HTML 5 support
  • Hooks for Dependency Injection and global action filters
  • JavaScript and Ajax improvements
  • Model validation improvements
  • Page caching and data caching
  • Mobile development, including jQuery mobile support
  • Asynchronous methods
  • Azure SDK, for cloud computing
  • Logins from Facebook and other similar sites

ASP.NET MVC 5 adds the following:

  • Attribute based routing in MVC 5
  • Filter Overrides for action methods
  • ASP.NET Identity for 3rd part authentication

So do we use ASP.NET Web Forms or MVC? Web Forms still makes sense with small web applications where MVC would be overkill. Also for quick-to-market apps where you don’t really care about unit testing or long-term maintenance. Here the drag-and-drop simplicity of Web Forms outweighs its weaknesses Take a look at the TalkIT course and tutorial in MVC. http://talk-it.biz/course/training-in-asp-net-mvc-4-web-development/ http://talk-it.biz/tutorial-links/creating-asp-net-mvc-4-application/

 Can you solve this coding problem?

Here is a coding puzzle. The aim is to write a short and elegant program.

Write a program in a language of your choice the outputs the trigonometric sine of any angle. Inputs an angle in radians.Problems

  1. Find all the sine of that angle using the below series
  2. Display the results.

The sine of an angle is, of course, the ratio of the length of the side that is opposite that angle to the length of the hypotenuse. The sine of an angle can be found by this series. Where n! is n factorial, i.e. n * n-1 * n-2 …

sin(x) = x – x3/3! + x5/5! – x7/7! + x9/9! – …

 

Other Bits

TalkIT in collaboration with VBug organises monthly Geek Speak talks for techies in Bristol. The talks are aimed at developers and team leaders. We have some interesting talks scheduled for 2014. June 17th 2014 – 6.30 p.m. Visual Studio Online Application Insights  – Matteo Emili For descriptions just click: http://talk-it.biz/2013/06/geek-speak-free-talks-bristol-update/ New online courses in MVC, C#.Net and HTML5 will be added to the TalkIT site this year. Take an advanced look at what is in the courses: MVC http://talk-it.biz/course/training-in-asp-net-mvc-4-web-development/ C# http://talk-it.biz/course-products/csharp/ HTML5 CSS3 and JavaScript http://talk-it.biz/course/html5-css3-javascript/

Thanks to Andy Olsen for his clever MVC slides.

Photos www.freedigitalphotos.net/

David Ringsell 2014 ©

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top