Friday, February 27, 2009

NHibernate Series : How to Setting up Configuration - part 1

 

On of the most important thing when you want to start with NHibernate is to know how make NHibernate configuration. I will show you using normal approach and Fluent NHibernate.

1. Configuration properties in App.config / Web.config

You need to create all NHibernate configuration properties in App.config or Web.config. This is an example of how to specify the database connection properties inside a config file.

<?xml version="1.0" encoding="utf-8"?>


<configuration>


  <configSections>


    <section name="hibernate-configuration"         


             type="NHibernate.Cfg.ConfigurationSectionHandler, NHibernate" />


  </configSections>


 


  <hibernate-configuration xmlns="urn:nhibernate-configuration-2.2">


    <session-factory>


      <property name="connection.provider">NHibernate.Connection.DriverConnectionProvider</property>


      <property name="connection.driver_class">NHibernate.Driver.SqlClientDriver</property>


      <property name="connection.connection_string">Server=(local);database=dbase;Integrated Security=SSPI; </property>


      <property name="dialect">NHibernate.Dialect.MsSql2005Dialect</property>


      <property name="show_sql">true</property>


    </session-factory>


 


  </hibernate-configuration>


 


  <!-- other app specific config follows... -->


  


</configuration>


 


2. Configuration properties in hibernate.cfg.xml



You can also configure NHibernate configuration properties in hibernate.cfg.xml and this file need to save into bin directory otherwise NHibernate claim it’s not found the resource file.




<?xml version="1.0" encoding="utf-8" ?>


<hibernate-configuration xmlns="urn:nhibernate-configuration-2.2">


  <session-factory name="UnitTest">


    <property name="connection.connection_string_name">Server=(local);initial catalog=Test;user id=sa;password=qwe123</property>


    <property name="dialect">NHibernate.Dialect.MsSql2005Dialect</property>


    <property name="connection.provider">NHibernate.Connection.DriverConnectionProvider</property>


    <property name="connection.driver_class">NHibernate.Driver.SqlClientDriver</property>


    <property name="show_sql">true</property>


    <property name="connection.release_mode">auto</property>


    <property name="adonet.batch_size">500</property>


  </session-factory>


</hibernate-configuration>




Time to test.


I will use nunit to test that nhibernate can read this config file





        Configuration cfg;


 


        [TestFixtureSetUp]


        public void ConfigureUsingNormalApproach()


        {


            cfg = new Configuration().Configure();


            cfg.AddAssembly(Assembly.Load("ScrumDev.Domain"));


        }












You should get the test result in green color.

Software Design and Humanity Architecture Design

Actually I’m not very good in writing document either for technical or business proposal. My last position as Head Of Technical (.Net) doesn’t much involve to that area . The scenario is totally different now where  I have to manage few subordinates and also more then 10 staffs report directly to me. One thing I’m appreciate to work with my current team because they are open to suggestions and comments. I’m no expert and many things I need to learn. After more than one year to be Solution Architect at my current company I’m realize that I’m not only need to plan how the system/software should be look like but more than that is to plan for the people and give them a good * humanity design (environment etc) so that they can work accordingly towards the goal. Failing to do that will also impact the overall software architect design. To make your software design reality is not just related to a machine but also related to whose is the man behind that.

* humanity design refer to services, infrastructure to help rebuild from communities crisis – i believe this still can be used in software development

Thursday, February 26, 2009

I’m using Windows Live Writer

This is my second post using Windows Live Writer. I’m really like this application. You can get it from here

http://windowslivewriter.spaces.live.com/

How I do agile - Part 2

In the previous post i had written a little bit about the import thing need to do in the initial process when we start software development project.  Project Statement from the Product Owner point of view is quite important. You really need to know exactly what project/software you are dealing with. Once your have high level overview of the project you can start jump to the core process in Scrum agile framework. Product backlog is the heart of Scrum.  The product backlog is basically a prioritized list of requirements, or stories, or features, or whatevers. Things that the customer wants, described using the customer’s terminology.

Step 2 ( Define Product Backlog)

The way we define our Product Backlog is to ask our customer/domain expert to write it what they want/need in the system using their own terminology (their understanding of the process). Product backlog actually contains a list of user stories. In my experience you need to guide them how to write a good user story otherwise they will write non process statement like their dream that nothing to do with the system.  Last year I  had an opportunity to help one company to start with agile process in their company. The software is about real estate solution. I had give simple briefing how to write user story , but because I’m didn’t guide them personally, I’m quite shock many of them write user story that are not reflected to the business of real estate but more like the comment /suggestion they want from the top management. For example “As an Agent, I want more money, so that i can buy another house“.  Actually this is not wrong , this can be our guide to ask them until we get good user story. We need to go detail with this user,and ask them how to get more money using this system? and what should they expect from the system that give them more money?. This is the question that I’m dealing with when i need to know from the customer/user.

My prefered user story template is taken from Mike Cohn .

As a [user role], I want to [goal], so I can [reason].

Hopefully this can help you to start a simple agile process within your team. I will continue InsyAllah..

Friday, February 13, 2009

Domain Driven Design : How to start

Recently there is a lot of interest in DDD come from a book, article etc. You may the one who are interested to start the real project with DDD. From my experience involving in a few projects that take DDD as its core architecture guideline, i'm no expert to claim the best way to build using DDD'ish but i can share my little knowledge.

I think very few people could claim to have done full blown on DDD, you can read stuff Jimmy Nilsson, Greg Young, Colin Jack, Udi Dahan and of course Eric Evans.

For a start you can read Domain Driven Design book

Thursday, February 12, 2009

Hire People Smarter Than You

What do you think, if you have right to hire people do you will take this challenge and ignore your ego?

How I do agile in my team - Part 1

Maybe you have read many article about agile approach like xp, scrum, lean etc. You wanted to try in your team but sometime it quite difficult to implement it and after that you realize that does agile is the correct approach to go in software development. Actually you still can deliver you software project to your client without knowing or practice agile.It's only the guideline on how you manage your software development process (team, workflow, communication) from the beginning until the end of the project (release).

Based on my experience implemented agile in my team, i would like to share how i execute agile framework in my team. For your information i had failed a few times when adopting agile in my team. So my advice to you guys who plan to try agile framework in your software development don't give up if the end result is not what have you expected.

Step 1 (Overview Of The Project)
When i asked to develop new software project, the first thing i will do is to call for a discussion session with domain expert an get the overview of the project. In this session all team members must join.

Sunday, February 08, 2009

Consultation Project

Currently I'm handling 3 freelances project on software architecture as a consultant. The biggest project is an Idea Collection Management System. I'm still working at Al-Madinah International University as Software Architect and Alhamdulillah my team able to release a 2 big project since i joined in Dec 2007.