Sunday, December 28, 2008

Stuff that Jeremy do like

  • http://codebetter.com/blogs/jeremy.miller/archive/2008/12.aspx

    How does this guy get the time to read and try all this stuff.
    Excellent and cool list.



    1. New Architectural Guidance coming from patterns and practice.


    2. The general direction of xUnit
    My Comment: I will stick with MSTest right now.

    3. AAA syntax and mocking styles in Rhino Mocks and Moq.
    My Comment: Loved it. I liked more Moq for its simplicity but keep Rhino Mocks as back up.

    4. Nate Kohari's approach to convention based setter injection in Ninject
    http://dojo.ninject.org/Conventions-Based%20Binding.ashx
    My Comment: Interesting. I am okay with Configuration or Custom Attributes approach for AOP. Convention approach sounds little backward but can be handy in certain situations.

    5. Autofac’s extensibility Model
    http://code.google.com/p/autofac/wiki/GettingStarted
    My Comment: Another DI framework

    6. StructureMap


    7. New Language features in .NET 3.5
    1) Lambda expression
    2) Var
    3) Object Initializer
    4) Collection Initializer
    5) Extension Methods
    6) Anonymous Types
    7) Auto Implemented Methods
    8) Partial Methods

    8. Expression Tree

    9. JQuery
    http://jquery.com/
    My comment:- I am going to buy a book to master this javascript framework.

    10. MassTransit
    http://code.google.com/p/masstransit/wiki/BatchMessaging

    http://ayende.com/Blog/archive/2008/06/04/Reviewing-Mass-Transit.aspx
    http://www.infoq.com/news/2007/09/nservicebus
    My Comment:- It sounds more like command pattern. There may be more. I need to investigate more into this.


    11. Linq to NHibernate and Linq in general of course
    My Comment: Since Generics in .NET2.0, LINQ is best thing that has happened in .NET3.5

    12. More powerful Auto Mapping and convention support for Fluent Nhibernate
    http://code.google.com/p/fluent-nhibernate/
    My Comment:- I will stick to LINQ for SQL time being. I hated the XML configuration for Nhibernate as it was error prone. Active record was a compromise.


    13. Bellware's SpecUnit assertion extensions
    My Comment:- Makes unit test more readable and maintainable.

    14. Fluent Fixture
    http://blog.eleutian.com/2007/09/29/FluentFixtures.aspx

    15. Prism Project
    Composite Application Guidance for WPF

    16. MVC
    My Comment- MVC rocks

    17. Common Service Locator

    18. Any Tool written by Jet Brains
    Resharper Rocks

    19. AutoMocker and Interaction Context base Classes

    20. Dino Esposito's latest book on .Net architecture
    My Comment:- I did a quick reading at book store. My rating 5 out of 5.

    21. Ben Scheirman's new fluent API for testing routes in MVC

    22. Rake Build Tool

    24. DotNetRock Guest List

Saturday, December 27, 2008

CLSA .Net 3.6 Overiew

http://www.lhotka.net/weblog/OverviewOfCSLANET36ForWindowsAndSilverlight.aspx


I have added the Expert 2008 Busines Objects to my 'to read' list.
I also share the Rocky's view that UI future belongs to WPF/Silverlight/XAML .


Subsystems of CSLA.NET 3.6

1. 90% of the code will be shared between .net and silverlight applications,with less than 10% code being different.
My Comment - Amen

2. Databinding
My Comment -Databinding reduces the plumbing between UI and business objects. That is something our frameworks should exploit

3. Object Status Tracking(new, changed , marked for deletion)
My Comment - Cool


4. Standardization of business and validation rule processing

5. Integration with, and simplification of , .NET authentication model.

6. Undo capabilities
Not too exciting feature for Web Based applicaions.

7.Enhanced support for LINQ queries against your business model.
My Comment--
LINQ is for major enhancement in .NET 3.5 platform since Generics in .NET 2.0
LINQ is something definately that one should exploit.

8. Aysnchronous data access and Asynchronous Validation Rules
My Comment--
I can understand that one can run the queries and expect to notified by the system.Aysnchronous Validation. Beats me.


These subsystems are exposed through a set of base classes from which you inherit to create your business objects. These base classes enable a set of object stereotypes:
1. Editable Root
2. Editable Child
3. Dynamic list -- Not for asp.net
4. Read-only root
5. Read-only Child
6. Name/Value List
7. Command

My Comment-
Only Command Pattern sounds interesting other bases classes sounds more like noise in the framework.
It is interesting how one can abstract Command Pattern in the framework.


Mobile Objects-
My Comment - With Remoting out of favor, Mobile objects sound more like a philosphical approach than tactical solution.


CSLADataSource & DataMapper
My Comment -- Having burnt my fingers with Object Data Source, having Custom Object Data Source is way to go. With Mobile Objects out of favor, you need DataMapper to convert proxy objects/Data Objects into real Business Objects.


WindowFlowManger:-
Simplifies launching,suspending and resuming a workflow instance.


CSLA.Net for SilverLight

Thursday, December 25, 2008

Moq,RhinoMock and Lambda(AAA) expressions

Last time I played with RhinoMock , I was in state of shock and awe. I was awed because it improved my design. It requrired that the code under test should to be isolated from rest of application. That was done using Interfaces . Contract based programming is always best way of programming. I could test behavioral aspect of my code.It would have been little difficult using xUnit framework. It was almost creating a simulation flight envrionment and enjoying the pleasure of real flights.

I was also shocked by the fact that my behavioral tesing Line of codes were many times more than code under test.

I was left in no doubt that Mocking is very powerful and advance technique of TDD. Also at the same time, It will make selling TDD difficult to people new to programming.

Hopefully Lambda expression may help in that direction.

Sunday, December 14, 2008

Design and Testability

Good Question.

Can you write effective unit tests without knowlegde of designing ?
I think that Jeremy is right in saying no.
OOP is all about design.
Concepts like Object, Collaboration and Messaging or Inheritance,Polymorphism and Encapsulation are all about design.

If a person does not understand OOP,Domain Driven Design, he can hardly write effective unit tests.

In OOP , one has to take 100 design decisions(which code goes to which class or layer) per day.

TDD is advance concept to master. One has to learn OOP and Design Patterns before that.

Monday, September 22, 2008

97 Things Every Software Architect Should Know




Some highlights: 1. Don't put resume ahead of requirements SOA == WebSerices came from above. 2. Chances are you biggest problem is not technical 3. Learn from Architect of Buildings. Survic is not going to like this one 4. My Additions: 1. User Interface rules. Ignore it at your peril. http://97-things.near-time.net/wiki/show/97-things-every-software-architect-should-know-the-book

Saturday, August 23, 2008

Houston, We have a memory leak

Recently I was investigating a memory leak with other colleagues. The windows service was giving out of memory exception. This windows services in short does lot of xml processing and serializes xml into business objects.

Naturally, first our needle of suspicion fell upon usual suspects i.e.. XMLDocument and XMLReader. Calling close and set them null multiple times didn’t help. While googling for a strong evidence against XMLDocument, I stumbled upon a clue that we were looking at wrong places and culprit may be XMLSerializer class. I googled for a connection between XMLSerializer and found tons of damning blogs and articles.

It is even documented by Microsoft in their MSDN documentation
To increase performance, the XML serialization infrastructure dynamically generates assemblies to serialize and deserialize specified types. The infrastructure finds and reuses those assemblies. This behavior occurs only when using the following constructors:

XmlSerializer..::.XmlSerializer(Type)

XmlSerializer..::.XmlSerializer(Type, String)

If you use any of the other constructors, multiple versions of the same assembly are generated and never unloaded, which results in a memory leak and poor performance. The easiest solution is to use one of the previously mentioned two constructors. Otherwise, you must cache the assemblies in a Hashtable, as shown in the following example.



Reference:

http://msdn.microsoft.com/en-us/library/system.xml.serialization.xmlserializer.aspx
http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=98384


A very good article about debugging memory leaks

http://msdn.microsoft.com/en-us/magazine/cc163491.aspx

A nice website about memory leaks

http://blogs.msdn.com/tess/archive/2006/02/15/532804.aspx

There a knowledge base article about this problem
http://support.microsoft.com/kb/886385/en-us


Are we facing a a virtual bytes leak, a native leak or a .NET leak
Important Counters

1.Process\Private Bytes
2.Process\Virtual Bytes
3. .NET CLR Memory\# Bytes in all heaps
4. .NET CLR Memory\# Total committed bytes
5. .NET CLR Memory\# Total reserved bytes
6. .NET CLR Loading\Current Assemblies


If the curves for private bytes and bytes in all heaps diverge we either have a "native leak" which means that we have a native component that is leaking (in which case debug diag would be the next step), or we have an assembly leak.


http://blogs.msdn.com/tess/archive/2008/03/17/net-debugging-demos-lab-6-memory-leak.aspx

Sunday, May 04, 2008

Thursday, November 22, 2007

SOA and CRUD

SOA and CRUD

There is complete census that CRUD is Anti-SOA pattern


Simon thinks that one can think of CRUD as business events rather than service operations

http://www-128.ibm.com/developerworks/blogs/page/johnston?entry=crud_vs_business_operations_events


Maarten Mullender’s says to take the best of both worlds. Use CRUD interfaces for service when concurrent updates can be avoided because
1. Updates are seldom, or
2. Updates have only one source (person or system)

http://blogs.msdn.com/maarten_mullender/archive/2004/07/23/193524.aspx


Ramkumar Kothandaraman writes
If one of the services fails to handle the CRUD request, then the EA service should be able to handle this business exception. One of the mechanisms to handle a business exception involves executing a flow that compensates for prior activities.
A Business Analyst usually determines Compensation Logic. Compensation Logic can be either automated or manual. For example, a compensation action may involve alerting the monitoring facility when one of the services returns a business exception, leading to a manual resolution.

http://msdn2.microsoft.com/en-us/library/ms954596.aspx


My thoughts
There are going to be CRUD operation even for a SOA scoped Application. Best way of writing optimum CRUD operations is to visualizing a client talking to a service rather than a traditional RPC application.
Service APIs will be designed or dictated by client application and it is responsibilty of client to submit bulk CRUD operation with concise payload. It is responsibility of client to make sure that it has correct state.

Wednesday, August 08, 2007

ObjectMother vs Mock/Stub

http://vikasnetdev.blogspot.com/2007/01/no-stubs-no-mocks-just-use.html
I was quoted on following forum
http://www.infoq.com/news/2007/08/object_mother

Very interesting article and also do read the comments.

I think that I am on the same page with vast majority of programmatic TDD practitioners.

Wednesday, May 30, 2007

How do you introduce NHibernate to VB6.0 programmers

Recently I tried to use nhibernate with a small project and have spent 60 hours to figure it out and still trying to figure out. I think that it is too many hours for a small project. In Midway, I thought of droping the idea of using NHibernate.

Best documentation for Nhibernate or best place to start is reading Java book for Hibernate or Hibernate documentation.

Ayende has some useful posts.

Let me quote from Java Experts first

Richard Conway. JDJ.SYS-CON.COM writes


Hibernate has come a long way since it was first released. It has a bewildering number of options for configuring your object persistence mappings and behavior – as well as great tools to make it if not painless then at least no so painful.

If you want to quickly persist your objects for a small project and you can manage uniqueness and referential integrity within your application code – look no further than DB4O. It just doesn’t get any easier.

The Cache/Jalapeno combination provides a compelling option for quickly persisting your java objects with a minimum of effort while providing excellent control over database-specific functionality.


Bruce A. Tate of Beyond Java book fame writes


Most of us try to learn an object relational mapper, like Hibernate. While it does relieve some of your persistence burdens, it also imposes a steep learning curve.


My Advice for fellow ex-VB6.0 programmers
Go for Code Generation route if you can go

Very soon I am going to write some posts showing O/R mapping examples using Nhibernate Custom Attributes.

Monday, April 16, 2007

Agile Methodology /Domain Driven Design wih Rich Client Application

Recently I tried Agile Methodology/Domain Driven Design for a small project. It simply rocks.
Some highlights


Step 1 Architecture



Step 2 Architecture



1. Non-disposable clean prototype.
It resulted in Non-disposable prototype. Nothing more connects with users like Screen Designs/Working prototype. Previously, I used to create disposable prototype, I was designing Screens backed by dummy database (by using DataControls). At the end, the prototype was so corrupted and had so bad references and bad code, We have to abandon the prototype.
Prototype fired by an Object Oriented Engine is real application (Tracer bullet)

2. Rich Middle Tier
Was able to nail process/Workflow classed early in the stage


3. Technical Feasibility
I was able to evaluate technical feasibility, efforts required and hence financial feasibility quite early in the game.

4. Agile
Having no database is really helping me at this time. Making changes to business objects and factory objects is very quick as compared to making changed to database and propagating it to middle tier. Carry less baggage in early really helps but I am reaching a point where I will need a database very soon.


5. 100 percent utilization of efforts

You may say that set up data for business objects is waste of time. Take a breath. I am using this code for my setup for tests. They will represent the functional tests and they are going to be independent of database and hence faster.

6. Free Set up for Functional Unit Tests


7. Window Forms Rock
Sometime back, Survic posted that he is going to use Windows Forms to develop prototype for Web Applications. It really shocked me. Now I see some weight in that argument. I remember that to get the docking, anchoring and other effects in older visual basic version, I have to write some very mathematics intensive routines. Now it is coming out of box.


8. Design Patterns Applied

1. Factory
2. Proxy
3. Clone

9. Application Validation Block Rocks

It is very easy to use (within one hour, I was able to set it and use it comfortably.
It is extensible enough to coexist with others custom validation manager like CLSA.
It also supports reading validation messages from Resource Files which is very essential for global applications. I highly recommended for small projects. Since it uses custom attributes and reflection, one may be careful about batch validation.


10. NHibernate

Very extensible and complex. It requires a hugh learning curve. I don't recommend it to fellow ex-VB6 developers to try in a time-critical project for first time.

11. Resharper Rocks
Excellent productiviy booster. It is must have tool for C# developers. I am going to buy a personal copy very soon. I used the evaluation copy.


12. Under Investingation
1. Windows Form Databinding
3. Licensing Software
3. Microsoft Map