Friday, February 25, 2011

FubuMVC - IOC Container

Another niceties of FubuMVC is that it has its own IOC in its heart. Right now just StructureMap is supported but it's been said that other well-known IOC containers might be supported in future (Castle windsor, Autofac,.. even Unity!!)

Look how easy it is to bootstrap IOC in application's startup evet:
 
// ConfigureFubuMVC is explained in the last post



And NhibernateRegsitry class contains all information for our interfaces.
    public class NHibernateRegistry : Registry
    {
        public NHibernateRegistry()
        {
            ForSingletonOf().Use();
            For().HybridHttpOrThreadLocalScoped().Use();
            ....
            .......
        }
    }


Friday, February 18, 2011

FubuMVC - Startup Conventions

FubuMVC is working based on conventions. Although some conventions are set as default in the heart of framework, you as a developer may want to extend or install a brand new convention. That makes programming very easy and efficient. There is no need to tell the code which controllers' method should be execute on and on.

Look how we can configure the fubu :



In the first lines, I tell the framework that configuration only applies to MyProject.dll and MyProject.Data.dll.
Then all classes that ends with action are my controllers. (with mvc literature). 
Then ignore all namespaces for action classes also ignore certain suffixes, for example, if an action class is deep in the project like (MyProject.UI.Actions.Exchange.AddExchangeAction), for routing just call AddExchange.

All Views that are using the model on their back, should have the same name as their models.
This stuff is set when the application starts and no needs to reconfigure for each situation.

Friday, January 28, 2011

FubuMVC - Why

ASP.net MVC has been available for .Net developers for over three years. Despite all the good changes, we've seen through CTP (Beta) versions till now, It has not become mainstream in Microsoft and to be honest it could not grab new developers to .Net world as easy as Ruby did the same during last year. On the other side, Microsoft still heavily promotes his/her developers to provide webform solutions on the web. These are all  the reasons I personally believe asp.net mvc has been faced through out these years.

I have had a look at ASP.net MVC since its early CTPs and I have done two different projects by that. However, some architectural limitations led me into very bad software practices. Violating SRP (Single Responsibility Principle) & OCP(Open-Closed Principle) to name a few.   
While I was working around how to best overcome some design points, I have come across a new open-source project (FubuMVC [For US By US MVC]) which supervised by Jeremmy Miller.( Also Author famous IOC container StructureMap)

Technically speaking, all design limitations in asp.net mvc were removed and the project was inspired by Ruby language( convention over configuration). I forked the project and after some days I could write some webpages based on that framework.
Till now, one the problems with this project is poor documentation. Although some new wiki sites have been built to help new developers the whole idea better.

Although most of the contributors to this projects are advanced developers, I actually want to explore more into this framework and will share my understanding to others.

I hope I will write a new web application by this front-end framework soon.

Saturday, February 27, 2010

Default Architecture and its flaws...

   Last night I had a hot discussion with my boss (Reza) about the new project I started to work on. Before anything else, I believe criticizing somebody's code is not challenging his character and I'm sure Reza takes this into consideration.

   In short, Our application (DrCephal) is a win-based dashboard interface. Mostly big shot users can monitor/setup some factors in their organization. It is based on Ms-Analysis Service and its database back-end is supposed to be MS-SQL Server. Of course it is truly database-agnostic and it can be replaced by any RDBMS systems. XML is playing a role when saving and loading dashboards come into picture.

   Now, The challenge was the suitable object model that provides best performance when the user browses data and saves data. we came up with two ideas: one is CQRS, the other one is separating each service into its own project.

   Reza is into the idea of putting services into their own projects. He wanted better isolation either in development side and deployment later.

   On the other hand, I can see most our company's projects have the same architecture but they are a lot different in domain and functionality. So, I don't bring new, flashy architecture into the project just because lots of techie people are talking the days. I believe two concepts (Save & Get) here can be totally separated.

   I hope we can get into the best conclusion.

Friday, February 12, 2010

Surfing on the new waves of change in .Net Community

   I have been developing software for over 8 years mainly with Microsoft technologies. Most of my professional career time spent in the ages when ASP.Net (Webforms) is my single choice for web development and creating data access layer bundled with a set of stored-procedures is the only performant and cost-effective option when talking to database. The Windows-based applications were not better when the domain objects are mingled with presentation layer and binding an ADO.net dataset to a datagrid was considered to be a best practice in lots of .net technical books.

    Since a group of master developers (later named Alt.Net group) have been gathered and challenged Microsoft's best practices toward their alternative approaches, things have changed quite a bit. A new kind of fresh air has been injected to .Net community both in tooling and technology perspective. Some .net open-source projects like Castle Project, NHibernate (ORM tool) , StructureMap (IOC container) have been introduced to .net world and many of them have been widely accepted and progressed by mainstream developers. Even Microsoft itself takes this movement into account at the time of releasing ASP.Net MVC 1.

  Now, (jumping over history and fluff) what I am trying to cover on this blog are my random tidbits about software development as I evolve in my mindset/craft. Currently, I'm interested in agile practices such as test-driven development, re-factoring, continuous integration, some buzz designs!, and more. I'm highly interested in both web and windows development with Microsoft tools and I frequently get excited by new technology. On the other hand, the evolution might be fascinating for some who are experiencing the same dilemma. So, I am trying to publish my steps whenever I find them valuable.  

    My platforms of choice (in no particular order): .NET, Rails, Ubuntu

    Languages: C#, Ruby,

   Last but not least, unfortunately a blog is extremely self-indulgent thing and I suspect every blogger is running the risk of being egomaniac, specifically in IT field where quality is intangible and the gap between what's planned and what's accomplished is huge. I try to be as pragmatic as I can and honestly approve if I will be biased toward anything.

Thanks for looking!