Your first project using ASP.NET MVC – Part 1 – Modeling your Solution

August 10th, 2010

When you  start to build something, a lot of concerns must be enumerated, when we talk about software development it´s not so different.

I have experience with .net framework since the version 1.1 , and nothing is made to be unchanged, because our needs are constantly changing and demanding others features to improve the quality of what we are working. So we can say that .net framework was embraced by a huge improvement when we talk about web development.

Asp.Net Web forms tried for a long time to make something statelless by default (web architecture) to be used like something statefull, and it was used even like that because the .net framework is an awesome framework to develop software, it´s friendly, secure and have a lot of knowledge encapsulated to handle a huge variety of software development technical scenarios and  purposes.

Well, so asp.net mvc project comes to offer another choice, an architectural pattern well knew for those who are working with web application development outside .Net framework.

So, I spent one month writing my considerations about systems that are making use of web front-ends,  enumerating who have been working to improve Asp.Net MVC since it was created and some communities that are working hard to spread this concept and all other good pratices and benefits that this architectural pattern can provide.

Now it´s time to share some code techniques based on blogs, events and books.

First of all, I would like to comment what Jimmy Bogard wrote in his blog about how to organize the solution: “So why not just do one UI project?  Put all the code in there, and get the absolute fastest and the most flexible experience?  Content structure is a completely different concern with completely different reasons for changethan organizing code.  However you decide to organize your code, keeping the code out of the UI project ensures that you don’t mix code and content organization.”

There are two different organizations, one of them is related with your code, and another about your content.  So we will focus how to organize our Content:

Jimmy Bogard´s aproach described at http://www.lostechies.com/blogs/jimmy_bogard/archive/2009/12/08/organizing-asp-net-mvc-solutions.aspx

image

You can see in the solution above: We just have 2 projects, while project UI stores javascript inside Scripts Folder,  aspx pages inside Views folder and Images/Videos/CSS  inside the Content folder, the another project  Core stores everything else, all controllers are placed in there and some smart ideas make it works unplugged and easily replaceable, the article Part 2 will describe how the Core project works, with references of all other articles written by some great asp.net MVC professionals.

See you soon in my next post!

admin aspnetmvc

MVC Conference 2010 – Do you really think that your current knowledge is enough?

July 30th, 2010

I made a post a couple of weeks ago about microsoft MVPs around the world that I like to follow. I had a chance to join them in live meetings discussing about a huge list of subjects. MvcConf is a free web conference organized to share  knowledge about microsoft .net strategies around the world.

#MVCConf presentations, sourcecodes, and the complete schedule : http://www.mvcconf.com/

ASP.NET Model View Controler Conference

I think that is impressive how these incredible professionals use their skills naturally without any arrogance. Well, the lesson that we can learn might come not just by their lines of code but also by their behaviors.

I  laughed a lot during Jeffrey Palermo´s presentation, because I was involved in a intense discussion in the official IRC channel about architects thinking how we must try to figure out the correct size of the scenario that they are working. So Jefrey Palermo made a statement to someone that asked about “tiny scenarios” . He said:  “If you are modeling something tiny, you don´t even need to use Object Oriented Programming” and everyone in the chat have started to go nuts! (Funny flame!).

But what he tried to explain with that statement?  If you don´t know who is Jeffrey Palermo, search about him in my blog, and take your time reading his books, this guy is impressive and he tried to shock everyone with that statement (and he got it!).

The word is: “Code Refactoring” .

An evolutionary methodology must admit that an application will need a refactory soon or later and when it happens, you as an architect must really be prepared to do it.

Do it, because it´s necessary, you don´t have to proof that you know a technique using it in any solution that you model. (See what Palermo said  about OOP).

Even in your lives, in your behaviors,  in your jobs,  if you don´t agree with something and you think that it can be improved, just do it! Fight for it!  Specifically in our development context, refactoring is necessary to provide viability to your scenarios, if you have a tiny scenario, deliver something tiny, it´s not necessary to develop a huge architecture at the first time just to proof that you know how to do it, what you should do is to care about the scenario, attend what is needed, let the architecture scalable and extensible  to get advantage of some techniques when necessary. What a MVC,IOC,ORM  frameworks do you like to use? If you don´t use them , is it just because you don´t know how to do it, or because you in fact decided that in your scenario it´s not necessary YET?

If you don´t know how these frameworks can be used:  I recommend you to stop, breath, spend 5 minutes to yell with your monitor, admit and try to get this knowledge, because eternal tiny scenarios absolutely will not hire you to work on them paying what you deserve. I´m from an old school, using the .net framework since version 1.1  during long nights and weekends, but today, I´m not using a single line of code as I did before, I have screammed a lot with my monitor and started a new jorney to get knowledge when it was necessary.

MVCConf Videos: http://www.viddler.com/explore/mvcconf/videos/

Here is the link of  Jeffrey Palermo´s presentation: http://www.viddler.com/explore/mvcconf/videos/14/

admin Microsoft, aspnetmvc ,

.NET User Groups, MVPs and Technical Magazines in Brazil – Sao Paulo

July 12th, 2010

Brazil is a huge country with great possibilities and some information sources are growing fast according with the increased professional demand. You can find bellow a list of user groups in Sao Paulo with presencial meetings and some online communities available to everyone.

Community Name Location Technologies Link
.NET Architects São Paulo .NET Development – Best Practices http://www.dotnetarchitects.net
AzureServiceBR Online Azure Technologies http://azureservicesbr.ning.com
Codificando.NET São Paulo Software Development http://www.codificando.net/
Desenvolvendo para Web Online Software Development http://www.desenvolvendoparaweb.net
Dynamic CRM São Paulo Dynamic CRM http://www.dynamicscrm.com.br/
IIS Help Online Internet Information Service http://www.iishelp.com.br/
PangeaNET Online Software Architecture – Competitor http://pangeanet.org
SharePoint Brasil São Paulo SharePoint Technologies http://www.sharepointbrasil.net/
SilverlightBrasil Online Silverlight http://silverlightbrasil.ning.com/
SQL Server Day Online SQL Server http://www.sqlserverday.com.br/
Super C# Online Visual C# http://supercsharp.ning.com
VSTS Brazil Online Visual Studio Team System http://www.vstsbrasil.net/
WCF Brasil São Paulo Windows Communication Foundation www.wcfbrasil.ning.com
WinAjuda Online Windows Client http://www.winajuda.com
WinSec São Paulo Infrastructure Management & Security http://www.winsec.org

“List source:” http://mvpbrasil.spaces.live.com/blog/cns!F5F4692D000CDE16!1143.entry

I´ve done my registration on these two user groups:

“.NET Architects”, google user group: http://groups.google.com/group/dotnetarchitects

“Codificando.Net”, you can find me here: http://comunidade.codificando.net/profile/VanderleiPereira

I had many recommendations about these user groups, “.NET Architects” have participation of a Microsoft MVP that writes good technical blog in Portuguese-br:
Giovanni Bassi | Blog and “Codificando.Net” have participation of two Microsoft MVPs:
Alexandre Tarifa | Blog
Diego Nogare | Blog

Two magazines in Brazil available for .net programmers and architects, I´ve made my signature a couple of years ago and I like it very much:
.Net Magazine Technical Editor: Giovanni Bassi
Mundo .Net Technical Editor: Marcelo D’avila Pauli


Another Brazilian blogs that I like to follow:
Caio Proiete | Blog
Ivan Paulovich from: Netraptors
Eduardo Spaki | Blog

admin Microsoft Brazil

Asp.Net MVC knowledge base from MVPs

July 12th, 2010

I´ve found some Microsoft professionals developing samples, writing books and blog articles, providing online trainings for free, teaching and sharing information about how ASP.NET MVC can be used and working hard to collaborate with the technology itself making new releases and components with a lot of interesting improvements, but I must confess that all these efforts comes so fast than the time you have to read and apply everything, so I´m taking time to read, test and check with some proof of concepts using it in my current business scenario and I can say that I´m getting great results up to now.
Who should we follow to get the best information as possible to develop a real strategy to implement ASP.NET MVC in our web application architectures? Well, I found some profiles of these guys on facebook, technical blogs on MSDN community and other personal blogs. These guys are Microsoft MVPs mostly, with great passion about software development. Here is my recommended main list up to now:

Phil Haack: Blog
Scott Hanselman: Blog
John Galoway: Blog
Scott Guthrie: Blog
Dino Espósito: Blog
Jeffrey Palermo: Blog
Rob Conery: Blog
Ben Scheirman: Blog
Jimmy Bogard: Blog
Eric Hexter: Blog
Matthew Hinze: Blog

My recommended list of their written books:
Wrox Professional ASP NET MVC 1: Available at Amazon.com
Wrox Professional ASP NET MVC 2: Available at Amazon.com
ASP.NET MVC in Action: Available at Amazon.com
ASP.NET MVC 2 in Action: Available at Amazon.com
Microsoft Press Programming Microsoft ASP NET MVC: Available at Amazon.com

admin aspnetmvc ,

Microsoft TechEd Brazil 2010

July 9th, 2010

Ok, here we go. Why is someone writing technical articles in english if he lives in Brazil?  First of all, we must remember the fact that when you complete your computer science degrees you should be abble to read/write in english, because it will improve your research habilities and it´s a  brazilian educational  requirement.  Today we live in a powerfull dynamic software development market, you should be abble to get involved. Let me tell how it is  important: I´m a brazilian guy,  japanese descendent, developing .net softwares with 99.9% of my coleagues communicating with me from Lebanon, where the company is based.

Now imagine my entire life without any english idiom skill:

1) I understand less than 100 words in japanese, my cousins don´t even know less than 30 words in brazilian portuguese, but these distant parents might speak in english, so: it´s ok!

2) I’m still learning arabic, but I understand less than 30 words right now for sure, my coleagues working with me on the same development team probabily undestand up to 30 words in brazilian portuguese too, but again all of us might speak, read and write in english, so: (Thanks god) it´s ok!

After this overconfident moment, here we go: The Microsoft TechEd Brazil 2010 will happen in september 2010. São Paulo is a big city and will host the event with all conditions that it deserves.

Check it out: http://www.teched.com.br/2010/

Microsoft TechEd 2010 Brazil

admin Microsoft, Microsoft Brazil ,

Asp.Net presentation layer techniques

July 9th, 2010

We have many different ways to model a presentation layer, some techniques are useful but not to all projects, some cases have requirements that can´t be satisfied just using a single technique, so we found a lot of candidates ASP.NET architectures that are proposed to handle all these particularities and bypass some critical aspects:

To expose your business layer methods to your presentation layer, you can use WebServices and it will collaborate with flexibility, because you can easily replace a asp.net web form based presentation layer for another technique like ASP.NET MVC or simply taking advantage of the separation of concerns (Behavior, Content and Presentation) .Some articles shows developers using ASP.NET pages static methods instead of WebServices, what it´s a great possibility at the first look but it´s not so useful and powerful as WebServices: When you call ASP.NET pages static methods, all sessions are enabled and their data flows together with all requisitions, slowing the time that you must spend to retrieve results, but when you use WebServices, you can disable sessions easily and plus of it, you can call these webservices asynchronily while page static methods must be synchronous by definition.

To retrieve and send information from WebServices you might choose JSON to serialize and deserialize objects using JavaScript and it can works pretty fast, there´s a lot of developers showing different performance tests recommending this approach in comparison of the old approach using some ASP.NET Web Forms based presentation layer techniques as: asp.net postback, asp.net web user controls, asp.net viewstate and asp.net codebehind.

To improve the speed of your communication with your presentation layer the best term used is Ajax that means Asynchronous JavaScript and XML, but this acronym was used commonly to represent everything that breaks all tendencies to process everything on server side, making it run fast processing directly in the client side. Microsoft offers the Microsoft Ajax Toolkit, ASP.NET Ajax and the good old raw api XmlHttpRequest aka JavaScript Ajax*12, plus we have the open format called JSON (JavaScript Serialization Object Notation) that allows to not just handle xml data, but also serialized data to fill objects and take advantage of client processing. When a lot of scripts starts to run in the client side, some script management must be offered, so .Net framework has some special objects to handle client side processing like the ScriptManager and the UpdatePanel that avoid the browser to refresh the entire page to get and post data.

To  downsize the data that are travelling between the server and the client, some developers are considering UpdatePanel incredibly inefficient and actually adding additional overhead, though they can reduce the amount of bandwidth used as opposed to full round trip, another structure is being used with the same way: To retrieve and send information from WebServices, you can ASP.NET Ajax to handle everything including a  ScriptManager, but it generates some performance issues that can be 10 times easily handled using Jquery to run your client scripts for cross browsers purposes and improving your presentation layer responsiveness, there´s a lot of developers showing different performance tests recommending this approach, plus of these arguments, Microsoft recently announced that Jquery will be handled as part of the .net framework.

To improve the responsiveness of your presentation layer, you can handle the retrieved data to fill html controls in different ways like: using Jquery to download plugins and fill jquery templates, using ASP.NET Ajax  to download Microsoft ASP .NET AJAX client templating engine from codeplex and fill aspx templates or using ASP.NET MVC.

ASP.NET MVC is a part of the ASP.NET Web application framework. It is one of the two different programming models you can use to create ASP.NET Web applications, the other being ASP.NET Web Forms.

I will post another articles specifically about ASP.NET MVC, web application responsiveness and comparisons between this new approach and ASP.NET webforms. If you wanna have some fun and read about it, try to start with this amazing post from 2008 written by Phil Haack: http://haacked.com/archive/2008/11/13/future-of-aspnet.aspx

admin asp.net, aspnetmvc , , ,