Saturday, January 25, 2014

To model first approach or …

A thoughtful blog post by Frans Bouma:

After years of debating over model-first approach has made it easy to test your application and POCOs. After I picked NHibernate 6 years ago, I realized making the changes to the model was a breeze. 

The changes are more manageable and smoothly ripple through your classes and database tables.
However, looking back on it seems more interesting to me. 

The idea is pretty valid to me. We do not persist objects to database, we persist their contents, which are their entity instances. On the hand, serializing data from technology to the other usually means having same the content. For instance, .Net objects can be easily serialized to Json. But in this case, objects are mapped to tables and saved.



Saturday, December 14, 2013

Maintaining existing software architecture

Evolutionary design is a very hard to tackle task. All of us have been in the situation when joining a new team and wanted to augment an old feature to a new design. It’s really hard to be in sync with other team members. 
Many times when a developer complain about messy code, it’s really because of a lack of consistency in the design. Adding a new feature needs assessment and so does the evolutionary design.

The article by Jimmy Bogard (Curbing long tail design) elaborated on the ‘Law of two’. Meaning only allow at most two designs in your system. Before doing other changes to the design, move all existing features to the new design. If you’re working in small steps, this shouldn't be much of a problem.

Saturday, November 23, 2013

Why we do not document code?

This post led to a hot technical discuss today.


If we’re serious about the piece of code, we have to write some useful documentation. Amazingly, I have noticed among many of my colleagues that the hard part is not coming from laziness! It’s the full understanding of a system/component that makes you feel sluggish to write a decent document for your code.

Some business processes are really complex to rephrase them into human language. Of course, the fear of any misunderstanding gap seems to be the source of all ignorance.



Friday, October 7, 2011

FubuMVC - Upgrade to 0.9 Note

Just a quick note:

I upgraded my fubuMVC project to version 0.9.1.. and it couldn't load my WebForms. After some emailing with the group, I figured out my fubuRegistry needs to get my view-engine's config. Unfortunately, it's not mentioned in the techie documents.



So, Please add this statement right into your FubuRegistry class if you use 0.9. versions and above.
It is noteworthy to say that FubuMVC is going to hit the 1.0 very soon.

Tuesday, August 30, 2011

FubuMVC - Nuget

FubuMVC now is available via Nuget.Org.

You can install this package in Visual Studio's Package Manager Console by this command.

Install-Package FubuMVC

if you are not interested in Fubu's other packages( Spark, FubuMVC.Validation...) you can get the minimal version on nuget.

Install-Package FubuMVC.References

Also, a nice document is designed by the development team.
Take look at FubuMVC Documents.

Friday, August 26, 2011

EF Code-First in the shape of NHibernate - Profiling



ORM tools made datacentric programs too easy to develop, but if it's been used without care, it will soon face a disaster in terms of SQL efficiency.
Microsoft proposes a tool for the developers who wants to know what is happening under the hood in EF.
It means, all SQL statements and information can be traced and logged in a file based on the developer's desire.
All you have to do is :
   1. Install two wrappers for EntityFramework from Nuget.org

  •    CommunityEFProviderWrappers.EFProviderWrapperToolkit
  •    CommunityEFProviderWrappers.EFTracingProvider

   2. Create a DbConnection object that is configured to log SQL staements like the one below and inject this object into DbContext.

var context = new DbContext(CreateTracingConnection(connectionString, "System.Data.SqlClient");
        detail implementation of CreateTracingConnection is written below.


   3. EnableTracing for data context.

      ((IObjectContextAdapter)this).ObjectContext.EnableTracing();

By this approach, you definitely know what commands are being executed when your application is running in debug mode.




Friday, June 24, 2011

EF Code-First in the shape of NHibernate - Using (5/5)



Once your database is built, using EF Code-First for the rest of the project is as easy as NHibenate. Same Patterns like Repository, Unit of work... can be applied to the codes in your application.

Even there is no difference between Code-First or Database-First (the one that you create your model out of your database) mode in your business logic code.

By this approach your model (Genrally POCO [ Plain Old CLR Object]) is first initialized and database is built as the result of your object model. By some tricks like migrations you can narrow your database recreation down to some field name modification or changes in size.