Saturday, August 10, 2013

ASP.NET MVC: Why Should I Move From Web Forms

Having used ASP.NET MVC quite extensively, I can tell you that ASP.NET Web Forms is quite good for prototyping. However, when you get to building Internet applications, ASP.NET MVC provides you with a lot of control over the markup of your application. Sure, it is more effort when you want to build the user interface and at times I did think that something I was building would have taken lesser time to build with ASP.NET Web Forms - quite possibly one of the reasons why Microsoft announced one ASP.NET, a statement that you can mix ASP.NET MVC and ASP.NET WebForms code within the same project.

ASP.NET MVC provides scaffolding (through code-generation) to reduce the effort involved in creating ASP.NET MVC user interfaces. Well, it is supposed to - it is still buggy when dealing with relationships between entities but when you have unrelated entities it works perfectly. This is most likely something that would be fixed in the next release or in one of the updates to Visual Studio. You can also take advantage of a wide variety of HTML/CSS/Javascript user interface components that you can use with ASP.NET MVC so if you need to build a user interface coherent with one built using PHP, Python, or Ruby, you don't have to create subclasses of the Label, TextBox, GridView, and ListView controls or add 'hacky' (seriously, doing a find-and-replace on the generated markup is an unnecessary CPU overhead) event handlers to alter the markup. The additional effort that you put into create the MVC views does pay off because with model binding, ASP.NET MVC can perform validation with nothing more than annotations (attributes) on your model. HTML 5 control rendering is also possible through adding attributes to your model. Sure, purists would argue that you shouldn't be adding attributes on your model to affect the presentation of your application but all you are doing is further describing the type of data being stored using the model and the view simply adapts (if you want it to).

I would also like to mention that when you do see performance benchmarks comparing a Hello World page in ASP.NET MVC, make sure that the benchmarks compared the ASP.NET MVC framework to another MVC framework - there are some comparisons of a Handler-like (ASHX) processing mechanism on other platforms to a Hello World on ASP.NET MVC and that just isn't fair - as soon as you use MVC, you've got routing and that adds additional processing to the application so you are bound to get lower performance scores when compared to a non-MVC framework. 

Friday, April 10, 2009

Cache-Control Header

The Cache-Control HTTP header directive is used to specify the behavior of proxy servers or caches for caching data.

Public
This setting enables caching on shared as well as single-user caches

Private
This setting disables caching on shared caches but allows caching on single-user caches

No-store
Prevents caching by storing to persistent storage

No-cache
Prevents caching entirely

Sunday, April 5, 2009

An Architect Is...

I came across this on a set of slides on SlideShare, but only one of the seven slides had actual content so instead of embedded the entire presentation, I just posted this text:

Accepting my responsibility as an architect, I will strive daily to learn and perfect my trade.

Readily will I defend my organization’s I.T. investments from complexity, our greatest enemy.

Changing requirements will not break my design for it will be flexible and able to change with the requirements.

Helping developers to understand the reasons for the architecture and seeking their input is of great importance to our success.

I will never use acronyms or suggest technologies that are not pertinent to the problem at hand.

Technologies evolve and I know that solid architectures should accommodate and enable these evolutions.

Every day, I will strive to help our software achieve ideals that will make it flexible and easy to maintain.

Concern for the success of my organization’s I.T. investments will drive me to make appropriate decisions.

Teaching others about my trade will be an overarching responsibility that I accept as a part of my duties.

Twitter Tools For Recruiting

10 Social Media Resources for Executive Job Search

PostgreSQL 8.4



Thursday, April 2, 2009

Top-N query

I've been Googling for how you would implement a Top-N query with different databases and here's what I could find on a discussion thread at StackOverflow:

IBM DB2:
SELECT * FROM emp FETCH FIRST 10 ROWS ONLY

Informix, InterBase/Firebird:
SELECT FIRST 10 * FROM emp

MS SQL:
SELECT TOP 10 * FROM emp

MySQL, PostgreSQL, SQLite:
SELECT * FROM emp LIMIT 10

Oracle:
SELECT * FROM emp WHERE ROWNUM <= 10

Unfortunately, ANSI-SQL doesn't provide any way to do this :-(