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.

Thursday, November 06, 2008

You have something..

You have something in your mind but you don't know how to express it in non technical word..what should you do, appoint someone to write for you?.. get you friends to translate for you..or just leave it in your brain until you die. In Islam knowledge should be shared to the community even one word right. I'm trying to practice this with my team, but sometime i feel to difficult. Currently I'm in the process to discipline myself to write any knowledge that's good for my team in Wiki.. let see the result. InsyAllah, I du'a to Allah to give me the strength to continues work on that.

Friday, May 23, 2008

mood tak de nak update

Aku tak de mood sgt nak update, sebab tu lah site nie aku tak update..

Wednesday, February 20, 2008

Monday, February 11, 2008

Masa

Hampir 2 bulan 1/2 aku tak update web nie dan hampir juga 2 bulan 1/2 aku bekerja ditempat baru, perancangan awal hendak menulis tentang agile process pun tidak kesampaian. Kerja di tempat baru memang mencabar, sangat mencabar dari segi teknikal dan team management, sekarang dalam team aku 6 orang dan plan tahun nie akan bertambah menjadi 15 orang. InsyAllah , aku kena kuatkan semangat untuk bersama team aku deliver sistem-sistem yang telah di rancangkan.

Kenkadang aku terasa , dalam masa 2 bulan nie banyak ilmu,tips aku ketinggalan, aku jarang dapat cari masa nak membaca artikel atau menulis code...

Nak menulis dalam nie pun dah penat.....

Sunday, December 02, 2007

Domain Model Design :Siri 2

User Story : Siri 1

Aku akan cuba menjadi domain expert dan pada masa yang sama sebagai developer untuk menjayakan siri demo agile process ini. Maka segala user story yang ditulis adalah berdasarkan pemahaman aku sahaja tapi aku akan cuba sebaik mungkin menjadi domain expert.

Aku nak cuba pendekkan beberapa penerangan, so rancangan aku ialah dari user story aku akan terus buat simple domain model design. Cara aku nie short cut sedikit kerana jika mengikut process sebenar apabila mendapat senarai user story, team lead dengan developer/system analyst hendaklah berbincang dengan domain expert untuk dapatkan lebih maklumat berkaitan user story, ini adalah kerana user story hanya seperti check list antara domain expert dan developer team. Domain expert akan letakkan priority untuk setiap user story dan team akan berbincang dengan domain expert pemilihan user story yang akan dimasukkan kedalam iteration 1.

Aku rasa penerangan lebih lanjut berkaitan process tersebut aku biarkan dalam tulisan yang lain buat masa ini aku nak fokuskan kepada domain model design berdasarkan user story yang telah pun ditulis.

Sebagai User/Domain Expert/StakeHolder, aku boleh:
- Rekodkan maklumat user story, oleh itu aku boleh tahu detail user story yang aku rekodkan dan perlukan dalam project

Berdasarkan user story diatas context utama domain expert ialah merekodkan setiap user story kedalam sesuatu project. Jadi bila dianalisa terdapat 2 domain yang penting untuk merealisasikan context/tujuan tersebut iaitu:
- User
- UserStory
- Project

Untuk itu aku biasanya akan design seperti berikut:


Visual design diatas masih belum lengkap kerana relation antara domain-domain tersebut boleh dikategori sebagai kompleks.Perlu diingat relation bidirectioanal akan mengakibat relation domain mesti mengetahui antara satu sama lain. Jadi apabila design setiap relation memerlukan penelitian adakah perlu relation domain A ke domain B perlu saling kenal mengenali. Jika tidak perlu pastikan relation dalam satu hala (unidirectional). Aku akan bagi 2 solution unutk difikirkan solution mana yang lagi sesuai

Kerja baru

Esok aku akan berkerja ditempat baru sebagai Solution Architect, arghh terasa berat tanggungjawab yang aku ambil apabila terima tawaran berkerja di syarikat baru ini. Aku berharap aku boleh memenuhi tanggungjawab tersebut, dan sudah semestinya sokongan dari team members yang lain amat dihargai.

Aku juga berdoa perancangan aku untuk menjadikan team ini sebagai satu team yang mantap dalam agile process berjaya dan aku akui bukan satu kerja mudah untuk melaksanakan impian tersebut. Semoga Allah membantu aku Aminn!!

11.30 pm

Saturday, December 01, 2007

User Story : Siri 1

Siri pertama aku untuk demo agile teknik gabungan beberapa tools/lib dan process dalam software development.
Aku plan hendak guna style video tapi laptop kat rumah aku nie tak de microphone, kalau aku record pun tak de suara.

Pertama aku nak perkenalkan User Story, kemudian dari user story aku akan buat simple domain model dan kemudian buat unit test yang juga simple untuk melihat keberkesanan domain model tersebut dan buat refactor kepada domain model jika ada dan juga refactor semula unit test untuk kembangkan lagi kemungkinan-kemungkinan yang difikirkan sesuai. Tapi yang penting bermula dengan kecil dan yang mudah dan jgn sesekali terover design dan juga terover test tidak bagus untuk kesihatan developer :)

Aku plan untuk buat User Story Application XPProgramming dimana applikasi ini berkeupayaan untuk merekodkan user story. User story mempunyai pelbagai variasi untuk dibuat. Aku suka style BDD user story.
Start:
Sebagai User/DomainExpert/StakeHolder, aku boleh:
- Rekodkan maklumat user story, oleh itu aku boleh tahu detail user story yang aku rekodkan dan perlukan dalam sesuatu project


Sebagai Solution Architect, aku boleh:
- Rekodkan maklumat project yang akan di bina, oleh itu aku boleh perkenalkan overview tentang sesuatu project
- Boleh pilih project dan setkan berapa kali iteration untuk project, oleh itu aku boleh setkan masa mula dan expected masa tamat sesuatu project.
- Boleh pilih user story dan letakkan tugas pembinaan kepada developer yang dipilih.
- Boleh letakkan priority pada setiap user story.
- Boleh setkan point untuk setiap user story atau point untuk project.
- Boleh setkan untuk setiap iteration ada berapa minggu didalamnya.
- Boleh setkan unutk setiap iteration user story yang akan dimasukkan.


Sebagai Developer, aku boleh:
- Lihat rekod user story yang ditulis User, oleh itu aku boleh tahu senarai user story yang telah direkod oleh user.
- Lihat rekod user story yang diletakkan pada diri sendiri.
- Lihat rekod user story yang diletakkan pada developer lain.
- Boleh letakkan estimate masa untuk setiap user story yang diberi berdasarkan point.

Sejarah

Aku sengaja letak tajuk sejarah sebab tulisan ini ada kaitan dengan sejarah tetapi bukan sejarah Malaysia atau sesiapa ,tetapi serba sedikit cerita bagaimana aku terjebak dalam gejala agile methodology.

Aku memang peminat Domain Driven Design dan Test Driven Development dan aku memang practice kedua-dua cabang ilmu ini dalam software development sekarang ini. Memang niat aku dari dulu nak kongsi bersama, tetapi halangan masa dan lain-lain mengakibat niat untuk menulis dengan lebih mendalam perlaksanaan kedua-dua methodology ini belum tercapai.
Kenapa aku pilih Domain Driven Design? Permulaan perjalanan software development aku dalam Object Oriented bermula dari teknik yang dikenali sebagai Database Driven Design, segala maklumat yang disampaikan oleh pelanggan akan di terjermahkan kedalam bentuk Database Relational Design. Tapi bila semakin lama terlibat dalam analisis design dan apabila mula terlibat dengan beberapa project yang agak besar dan sebagai mana diketahui umum requirement biasanya selalu ada perubahan walaupun disaat akhir development. Kesakitan untuk membuat penukaran design amat terasa dengan penggunaan Database Driven Design. Penggunaan strored procedure seperti menjadi kepastian dalam software development aku ketika itu. Aku pernah terlibat dengan Aplikasi Pengeluaran ubat-ubatan farmasi dimana keseluruhan table berjumlah 130 dan bayangkan apabila jika logic ditulis didalam stored procedure, jika terdapat perubahan pada mana-mana bahagian business process, selalunya aku cadangkan untuk buat change request kerana untuk menyemak semula business logic mengguna Database Driven Design adalah amat mencabar. Aku mula mencari alternative lain yang memudahkan kerja aku, pada masa tersebut aku tak dengar lagi perkataan agile apatah lagi memahami process agile yang sebenar. Tapi pada masa tersebut walaupun aku mengguna Database Driven Design aku seboleh-bolehnya cuba untuk tarik keluar semaksima logic yang boleh digunakan dia dalam code, pada ketika itu aku dah mula memahami serba sedikit design pattern walaupun tidak mahir, pernah aku cuba masukkan beberapa design pattern yang mudah,tapi hampa kerana kekurangan ilmu.
Apabila didatangi masalah dan process development menjadi perlahan, aku cuba mencari maklumat berkaitan analisis pattern . Aku mula diperkenalkan dengan teknik Peter Coad iaitu UML In Color oleh brother Hamdi, aku juga mula mendapat maklumat berkaitan Hibernate/NHibernate. Setelah beberapa bulan mencuba NHibernate aku terasa development aku semakin laju sekarang tapi masih lagi kekurangan dari segi design/architecture. Alhamdulillah sekitar tahun 2004 aku terjumpa satu artikel berkaitan Domain Driven Design menerangkan kepentingan Domain Model design dan aku agak tertarik unutk mengetahui dengan lebih mendalam. Aku mula join group Domain Driven Design dan aku mula membeli buku Domain Driven Design. Pertama kali aku baca buku tersebut aku tidak faham sangat apa yang cuba disampaikan oleh penulis buku tersebut, kerana ianya agak baru benrbanding cara yang aku gunakan. Aku juga bertanya soalan didalam group tersebut dan aku cuba memahami beberapa pattern penting didalam buku tersebut dengan buat beberapa simple test project.

Semasa melayari group DDD, ada juga beberapa artikel menerangkan tentang combination TDD+DDD dan terdetik pada ketika itu aku tertarik untuk mengetahui apa itu TDD, aku start mendapat maklumat dari group XP Programing dan aku bertambah seronok dalam software development. Combination TDD+DDD=Agile.

Friday, November 30, 2007

Hari terakhir di IT Lab

Aku dah submit handover document yang perlu pada rushdan untuk dia take over software development work di IT Lab, emm semalam last demo aku pada CMS community team dan aku happy sebab dapat tunjukkan prototype CMS sebelum aku berhijrah ke tempat lain.

Sepanjang tempoh 1 tahun 2 bulan aku kat IT Lab macam-macam pengalaman menarik aku dapat disini, belajar menangani pelabagai ragam vendor yang cuba mempermainkan group kita org. Tak semua vendor yang berfikiran sebegitu , cuma sebahagian yang fikir mereka ini hebat terutama vender S*P dan apabila dibalas balik dengan fakta-fakta soft dev.. terdiam tergolek-golek mereka nak menepis serangan dari group kita orang.. hehe. Pada masa tu bos kita org..kita gelar guru Hamdi pakar OOAD, setiap pagi kita orang akan ada status update bermula seawal pukul 8pg.. yang kebiasaan nyer lewat aku le tapi lewat 10 min je selalunya, biasalah aku kat Shah Alam (alasan lemah nie..) bos aku lagi jauh, jalan Kebun 7.30 dia dah sampai.

Pada team-team member yang lain Kak Kartinah, manager yang best dan baik hati :) , guru Hafiz pakar Java, banyak agile skill dan teknik aku dapat belajar dari beliau. .Net team Rushdan , Java Team Fadhlan dan Faisal, Analyst team Yusnizam aka Bob dan Zehan, SAP Team Nani dan team-team lain yang terlibat dalam project PITTIS.

Selamat berjuang IT Lab, semoga dapat berjumpa lagi...

Tuesday, November 20, 2007

Project Structure dalam DDD


Sebelum ini aku mempunyai pelbagai versi domain model project structure berdasarkan pemahaman aku ketika itu, dan juga ada juga cara solution yang cuba-cuba. Cuma sekarang ini aku lebih tumpukan kepada style Domain Driven Design, maka domain model structure juga aku follow DDD, cuma dalam DDD group tak ada standard domain model structure.


Cara aku design ialah dengan groupkan domain model dalam Aggregate dimana nama folder akan follow nama Aggregate Root, untuk domain project diatas UML design adalah seperti berikut.

Cuma didalam domain model repository hanyalah interface bukannya concrete class. Implemantation repository boleh diletak di Infrastructure project atau DataAccess project. Cuma aku masih confuse tentang ApplicationService adakah app service juga mempunyai interface di domain model?

Friday, November 16, 2007

Test 3G Connection di rumah

Aha.. aku saja je nak test connection 3G Celcom nie kat rumah, boleh lah buat kerja unutk browse any information dan send email, sebelum nie kalau ada urgent aku kena tunggu pagi esok kat tempat kerja atau aku kena pergi Cyber Cafe. Alhamdulillah connection 3G kat area rumah aku nie nampak macam ok je. Sebelum nie aku pernah try guna Maxis broadband lagi teruk, nak buka web yang simple mcm google pun tak lepas, jadi aku pulangkan semula package tersebut.

Thursday, November 15, 2007

Agile Methodology

Aku dah lama tak update tentang cerita development, bukan sebab busy tapi tak de idea nak taip pasal apa. Aku insyAllah akan masuk company baru dalam masa 2 minggu, tapi sebelum join telah ada beberapa assigment yang kena aku kena buat untuk company tersebut dan Alhamdulillah 2 assigment besar telah berjaya disiapkan mengikut jadual.Assignment pertama ialah mengenai blue print (guideline) development process yang InsyAllah aku akan guna pakai dan juga assigment kedua ialah documentation berkaitan semua development policy yang perlu diikuti oleh team di sana. Sekarang ini untuk team application dah ada 4 termasuk aku, manakala untuk team multimedia/design dan ada 5 orang. Team application masih memerlukan 3 orang untuk buat beberapa project yang agak besar unutk 1 year punya project.

Aku berharap aku dapat gunakan ilmu-ilmu yang aku dapat semasa dalam team sekarang nie , terutama ilmu yang diturunkan oleh Guru Hamdi dan beberapa pengikut-pengikut agile di sini.