Monday, December 25, 2006

My Default SOA Architecture using WCF

Continued from http://vikasnetdev.blogspot.com/2006/07/soa-friendly-architecture-version-of.htmlWith the advent of Net3.0, I am upgrading the implementation of my default SOA friendly architecture to use WCF as a medium to connect my business layer with database layer


Note: The author of this blog does not believe that you should use WebSevice/WCF in standalone application when none required. But we live in a world where we don't make rules. If you database is protected by another firewall, you may find this architecture handy. It is more important to have logically separation in architecture that will scale well if application is deployed in a distributed manner.


Here is SOA friendly Architecture


Here is deployment view


Major Components

1. UI Components/Views:
Provide User Interface

Controllers
Get the Business Objects from Gateway and provides to UI

Gateway/Factory
It is factory layer that provides the business object. It knows how to create or get the object across the network boundaries. First looks in repository if none, gets the object across the wire.Our example is going to exploit the capabilities of Web Service. It will convert the proxy object into real domain object using Mapper utility.

References:
http://www.martinfowler.com/eaaCatalog/gateway.html
http://www.martinfowler.com/eaaCatalog/repository.html
http://www.martinfowler.com/eaaCatalog/dataTransferObject.html


Business Object Manager
It populates the business object using data object. This is where one can aggregate the business objects before transferred across the network.


Business Object/Entity Object
Contains the Attributes and operations related to domain entity

Process Object/Workflow Object
Business objects collaborate together to perform some useful operations to users.


Data Object
Data Objects retrieve the data from Database. Will contain all the CRUD operations.

Here is Code.

Gateway


namespace Gateway
{
public class Contact
{
static Contact()
{
//
}
private static List contactListCache = null;
private static Object syncRoot = new Object();
public static void ClearCache()
{
lock (syncRoot)
{
contactListCache = null;
}
}
public List GetContact()
{
return ContactList;
}

public List ContactList
{
get
{
if (contactListCache == null)
{
lock (syncRoot)
{
contactListCache = new List();
ContractServiceWS.ContractServiceClient contractService = new ContractServiceWS.ContractServiceClient("WSHttpBinding_IContractService");
ContractServiceWS.Contact[] proxyContactList = contractService.GetContract();
for (int i = 0; i <= proxyContactList.Length - 1; i++) { BusinessObject.Contact contact = new BusinessObject.Contact(proxyContactList[i].UserName, proxyContactList[i].Name, proxyContactList[i].PhoneNumber, proxyContactList[i].Age); contactListCache.Add(contact); } contactListCache = (List)Converter.MapProperties_Fields((System.Collections.IList)proxyContactList, typeof(List), typeof(BusinessObject.Contact));
}


}
return (contactListCache);
}
}
}
}


namespace Gateway
{
public abstract class Mapper
{

public static object MapProperties_Fields(object SourceObj, Type DestinationType)
{
if (SourceObj == null)
{
return null;
}
Type sourceType = SourceObj.GetType();
object destinationObj = Activator.CreateInstance(DestinationType);

foreach (PropertyInfo sourceProperty in sourceType.GetProperties())
{


if (sourceProperty.Name.Equals("ExtensionData") == false)
{
MemberInfo destinationMember = DestinationType.GetMember(sourceProperty.Name)[0];

if (destinationMember.MemberType == MemberTypes.Property)
{
PropertyInfo destinationProperty = ((PropertyInfo)(destinationMember));
if ((destinationProperty.CanWrite == true))
{
if (destinationProperty.PropertyType.Equals(sourceProperty.PropertyType))
{
destinationProperty.SetValue(destinationObj, sourceProperty.GetValue(SourceObj, null), null);
}
}
}
}
}
return destinationObj;
}



public static IList MapProperties_Fields(IList SourceList, Type DestinationListType, Type DestinationElementType)
{
if (SourceList == null)
{
return null;
}
IList destinationList = ((IList)(Activator.CreateInstance(DestinationListType)));
foreach (object sourceObj in SourceList)
{
destinationList.Add(MapProperties_Fields(sourceObj, DestinationElementType));
}
return destinationList;
}
}
}





WCF Service

[ServiceContract()]
public interface IContractService
{
[OperationContract]
IList GetContract();
}

public class MyService : IContractService
{
public IList GetContract()
{
BusinessObjectManager.Contact contactManager = new BusinessObjectManager.Contact();
return contactManager.GetContacts();
}
}



Business Object Manager

namespace BusinessObjectManager
{
public class Contact
{
public List GetContacts()
{
DataTable dataTable;
List list = new List();
dataTable = DataObject.Contact.GetContact();
try
{
foreach (DataRow dataRow in dataTable.Rows)
{
BusinessObject.Contact contact = new BusinessObject.Contact(dataRow[0].ToString(), dataRow[1].ToString(), dataRow[2].ToString(), Int32.Parse(dataRow[3].ToString()));
list.Add(contact);
}
}
catch (Exception ex)
{
throw ex;
}
finally
{
dataTable = null;
}
return(list);
}
}
}



Business Object


namespace BusinessObject
{
[DataContract]
public class Contact
{
private String _userName;
private String _name;
private String _phoneNumber;
private int _age;
public Contact()
{
}
public Contact(string userName, string name,String phoneNumber, int age)
{
_userName = userName;
_name = name;
_phoneNumber = phoneNumber;
_age = age;
}
[DataMember]
public String UserName
{
get
{
return _userName;
}
set
{
_userName = value;
}
}
[DataMember]
public String Name
{
get
{
return _name;
}
set
{
_name = value;
}
}
[DataMember]
public String PhoneNumber
{
get
{
return _phoneNumber;
}
set
{
_phoneNumber = value;
}
}
[DataMember]
public int Age
{
get
{
return _age;
}
set
{
_age = value;
}
}
}
}



Data Object
namespace DataObject
{
public class Contact
{
private const String ContactTableName = "Contact";

private class Fields
{
public const string UserName = "ContactUser_Name";
public const string Name = "Contact_Name";
public const string PhoneNumber = "Contact_Phone_Number";
public const string Age = "Contact_Age";
}


public static DataTable GetContact()
{
System.Text.StringBuilder sql = new System.Text.StringBuilder();
System.Data.DataTable dataTable;

//Build the SQL

AppendBaseSelectColumns(sql);

sql.Append(" FROM");
sql.Append( " " + ContactTableName);

try
{
dataTable = GetDataTable(sql.ToString());
}
catch (Exception ex)
{
//Log the error
throw ex;
}


return(dataTable);


}

private static String AppendBaseSelectColumns(System.Text.StringBuilder sql)
{

sql.Append("SELECT");
sql.Append(" " + Fields.UserName + ",");
sql.Append(" " + Fields.Name + ",");
sql.Append(" " + Fields.PhoneNumber + ",");
sql.Append(" " + Fields.Age );
return sql.ToString();

}

private static DataTable GetDataTable(string sql)
{
//Real life one will connect to Database and return the
DataTable dataTable = new DataTable();
dataTable.Columns.Add(new DataColumn("Contact_User_Name", typeof(String)));
dataTable.Columns.Add(new DataColumn("Contact_Name", typeof(String)));
dataTable.Columns.Add(new DataColumn("Contact_Phone_Number", typeof(String)));
dataTable.Columns.Add(new DataColumn("Contact_Age", typeof(System.Int32)));
dataTable.Rows.Add(new Object[]{ "VK", "Vikas","222-222-2222",int.MaxValue});
dataTable.Rows.Add(new Object[] { "SV", "Survic", "222-222-9999", int.MaxValue });
return dataTable;

}

}
}


Presenter/Controller
namespace Presenter
{
public class ContactPresenter
{
public ContactPresenter(View.IContactView view)
{
_view = view;
_view.LookUp += new EventHandler(_view_LookUp);
_view.Persist += new EventHandler(_view_Persist);
}

private View.IContactView _view;
private BusinessObject.Contact _currentContact;


public View.IContactView View
{
get { return _view; }
}
public BusinessObject.Contact CurrentContact
{
get { return _currentContact; }
}


public void SaveContact()
{
if (_currentContact != null)
{
_currentContact.Name = _view.ContactName;
_currentContact.PhoneNumber = _view.ContactPhoneNumber;
_currentContact.Age = _view.ContactAge;
}
}

public void LookUpContactByUserName(string userName)
{
Gateway.Contact contactGateway = new Gateway.Contact();
List contactList = contactGateway.GetContact();

foreach (BusinessObject.Contact contact in contactList)
{
if (contact.UserName.ToUpper().Trim().Equals(userName.ToUpper().Trim()))
{
_currentContact = contact;
break;
}
}

_view.ContactUserName = _currentContact.UserName;
_view.ContactName = _currentContact.Name;
_view.ContactPhoneNumber = _currentContact.PhoneNumber;
_view.ContactAge = _currentContact.Age;
}

private void _view_LookUp(object sender, EventArgs e)
{
this.LookUpContactByUserName(_view.UserNameToLookUp);
}

private void _view_Persist(object sender, EventArgs e)
{
this.SaveContact();
}
}
}


Saturday, December 23, 2006

Pitfalls of Development Driven Testing -- TDD

There comes a time during battles when elite commandos have to throw away their best gadgets which may include sophisticated gears, body armors, tools and weapons and resort to hand-to-hand combat. During one of those moments, I wrote the following blog post
Confessions of a failed extreme programmer

After the fog of war was over, I was told by my colleagues about the bugs in my components in certain scenarios. These bugs would have been never there, if only I had written my unit tests. So I started writing my tests using the framework which I prepared.
To me surprise, my test was succeeding while in real condition, it should have failed. After serious debugging, I found a serious bug in my framework and as a result, 40% of my automated tests were flawed.


Well, if you survived your hand-to-hand combat, you have to oil your gear.

Moral of the story: It does not hurt to use a knife during hand-to-hand combat. Not using it may prove to be fatal. Automated Unit tests are knives to Developers locked in a mortal combat with very aggressive deadlines.

Tuesday, October 31, 2006

Why are all great developers not the best Architects and vice-versa?

I have seen lot of exceptions though.

First the philosophical spin. Michael Plat says that Architect are analytic thinkers and programmers are logical thinkers and hence the mis-match. He gives a simple test to figure out whether you are a Architect or not. I failed the test but I still believe that I have excellent Architect’s prospective. :)


I think that real issue is that strong programmer fails to abstract or trivialize certain aspects of system. They are too involved in details and thus , are unable to see the system from 18000 feet.

As Survic said, "abstract a little -- not too high level, but a little bit higher than programming - "design pattern."

If you abstract too high, it is time to ask your management to promote you to astronaut or ivory-tower architect designation. Don’t mistake me, I don’t have any contempt for them. I do think that Corporate needs them also very badly.

Sunday, October 29, 2006

.Net Pet shop 4.0 Architecture

Petshop Architecture 4.0

I have used earlier Petshop Architecture. It left a mixed feeling. It was simple to start with but not extensible enough for complex distributed computing needs.
I decided to revisit the new Petshop Architecture 4.0. My thoughts


Architectural ConcernObservationMy Rating
High level Diagramhttp://msdn.microsoft.com/library/en-us/dnbda/html/bdasamppet409L.gifA+
Exploiting ASP.NET 2.0Generics ,Provider ,Caching, Transaction A+
Seperation of Business Logic and Persistence LogicBLL,Model,
Pattern for transferring data between Business Layer and Data LayerModel(Data Tranfer Object)A+
Optimized for Distributed ScenarioWhether Chunky Interfaces are possible between BLL and DLL Under Evaluation
Is optimized for Service Oriented Architecture? Under Evaluation
Business Rule Processor :Under Evaluation
Businses Layer Richness Under Evaluation


References
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnbda/html/bdasamppet4.asp



Setting up PetShop Application
Setting up .Net PetShop Application has been a very daunting and time-consuming exercise.

1. Do read the ReadMe.Html File. It contain very critical steps to performed before one can run the application

2 . Try running the InstallDatabases.cmd.

3. You can Install SQL Express from this link


4. If you get error that your script is failing because remote is not allowed for SQL Express ,try this link
http://blogs.vertigosoftware.com/petshop/archive/2005/10/13/Enabling_Remote_Connections_to_SQL_Server_Express.aspx

5. If it does not work like it did not work for me , go to your
Edit \.NET Pet Shop 4.0\DatabaseScripts\Sql and run the individual scripts.

Under Security Folder in SQL Server Management Studio Express, do add your user account.


6. Edit \Web\Web.config:
a. Modify the server path in SQLProfileConnString, SQLMembershipConnString, SQLConnString1, SQLConnString2, and SQLConnString3 connection strings, using host_name\instance_name schema. Example: server=(local)\sqlexpress;.

7. Add this section after decrypting the Web.Config file using the utility DecryptWebConfig.bat

More Information
http://msdn2.microsoft.com/en-us/library/ms998283.aspx



{"The database 'MSPetShop4' is not enabled for SQL cache notification.\r\n\r\nTo enable a database for SQL cache notification, please use the System.Web.Caching.SqlCacheDependencyAdmin.EnableNotifications method, or the command line tool aspnet_regsql. To use the tool, please run 'aspnet_regsql.exe -?' for more information."}

C:\Program Files\Microsoft\.NET Pet Shop 4.0>aspnet_regsql.exe -d MsPetShop4 -ed
-E

8. You cannot enable Notification with SQL Express, so just comment the code and voila.
http://www.microsoft.com/sql/prodinfo/features/compare-features.mspx




Proposed changes

Monday, October 09, 2006

Agile Methodology- Process vs Anti-Process

Survic wrote very interesting comments in response to my observation on Rockford Lhotka's blog.


Since Survic has not recorded in his blog, I am reproducting it in my blog :)

Survic Wrote

Vikas said: “At least, it is giving some structure/discipline/framework where none existed”.

That remind me a weird observation of TDD in .net.

Basically, it is the downside of the same fact that Vikas pointed out.

In java, TDD represents the lightweight force -- it attracts guys who are tired of heavy process stuff. As a result, most practitioners in java TDD tend to cut corners: 100% unit testing, GUI unit testing, property unit testing? -- shut up and give me break! That is so “natural”; that goes without saying: come on, this is XP!

However, in .net TDD attracts guys who can waste time!!! -- I am sorry to say this, but it is the insight I got after a lot of surprises I got from .net’s TDD guys – TDD in .net represents process, not anti-process. It is very weird and sometimes even shameful and dishonest, in the sense that TDD is anti-process -- how can a person abuse TDD to drive the agenda to create a heavy hierarchy!

This weirdness in .Net TDD is that classic VB’s RAD is much more lightweight, so, people who likes lightweight will not be attracted to TDD. And people is the determining factor of a (sub)culture. So, TDD in .Net is pro-process!

Combining the above factor with another factor that TDD, by its default configuration, is against consulting designing, it is no wonder a person who is working on consulting framework design, and has a healthy dose of classic VB RAD sense, will be antipathy about TDD in .Net.

I am with you, Rocky ;-)

I was not sarcastic when I say “I am with you” ;-), let’s me explain:

1. We can re-interpret XP/TDD to such way that it supports or even requires using framework. It is really very simple: using a “metaphor” in XP/TDD really means picking a framework among a few well-known frameworks. Consulting in design phase means to establish the “metaphor” for a project. It requires tear apart well-known frameworks and combine those parts together.

2. The pro-process factors, which are minimal in XP’s origin (small talk), and are still heath in java (because it is fighting with heavy processes), become absolutely ridiculous in .Net -- because XP/TDD is actually fighting the classic VB RAD, go figure! So, it is right to cut those pro-process craps in TDD in .net.


Conclusion
I think that Survic has made very excellent, thought-provoking observations. After reading this, I think that I know why I have reservations about using extreme programming for a industrial-strength software (because of my process oriented bias).

I think that neither anti-process morts nor process-oriented purists are going to embrace extreme programming in .Net arena, it is going to restricted to a small cult of programmers ( I would definitely use it for short term project)

For record, I do use a hybrid of Agile and Waterfall Methodologies very successfully.

Note: I am going to refine my thoughts

Tuesday, September 26, 2006

Integrating MStests with Nant

Intgrating MSTests with Nant

MSTest.exe is command line utility which can be executed using Exec Task of Nant

MSTest Command Line Options
http://msdn2.microsoft.com/en-us/library/ms182489.aspx


BeginTag exec
program ="C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\MSTest.exe" commandline="/testcontainer:C:\Projects\ProjectName\Build\WebTests\Matrix.WebApplication.Tests.dll /resultsfile:C:\Projects\ProjectName\Build\WebTests\a.trx" basedir="C:\Projects\ProjectName\Build\WebTests" >
EndTag exec

testcontainer: Load a file that contains tests
runconfig: Load a file that contains tests
resultsfile: Save the test run results to the specified file


CruiseControl and MSTests


http://confluence.public.thoughtworks.org/display/CCNET/Using+CruiseControl.NET+with+MSTest
http://blogs.blackmarble.co.uk/blogs/bm-bloggers/archive/2006/06/14/5255.aspx



Running Unit Test on Build Server
In order to run tests during build, Team Edition for Testers must be installed on the build computer. In order to run unit testing, code coverage or code analysis, Team Edition for Developers must be installed on the build computer.

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

Saturday, September 23, 2006

Design is back. Long live design

It is very encouraging to read from the experiences of agile practitioners that they think up-front design (Architecture and framework) is too important to be left implicit in any methodology. I always believed in up-front design and evolutionary design facilitated by effective refactoring and automated testing, being core parts of any methodology. There are complimentary to each other, rather than forcing a programmer to use one over another. You dismiss one; you have a very lousy software at hand.

Martin Fowler also advocates nicely in making use of best of both worlds. It makes more sense now.
http://www.martinfowler.com/articles/designDead.html


http://codebetter.com/blogs/sam.gentile/archive/2006/09/06/Being-an-Agile-Architect.aspx
Being an Agile Architect
We found that a year down the road that there was still a lot missing. Too many "infrastructure" or "framework" things were blowing by in this delirious rush to crunch out 100% business functionality every week no matter what. Someone with Architecture experience needs to perform explicitly the role of Agile Architect and restore these capabilities to a team

http://codebetter.com/blogs/scott.bellware/archive/2006/09/19/149368.aspx

Sam's post on agile architecture has led to the death of my last vestiges of my denial in regards to a need for some formal recognition of software design on an agile team.


The absence of explicit software design activities on our team has lead to some degradation of software design that is leading the code down the slippery slope to opaqueness and to the initial indications of software entropy. We're trying to add a bit more formality to software design and software design guidance into our process. Recognizing a software designer's role on the team tasked with up-front design and continuous software design quality assurance is part of this effort.


Footnote:
It pays to be a coward Extreme Programmer

Monday, September 18, 2006

Re-read Head First Design Pattern-- my rating -- 5/5

Readability : 5/5
Information about Subject : 5/5

Couple of years back when I was exposed to Design Patterns, I went on buying spree for every computer book with design pattern somewhere in title. In that buying spree, I bought this book as soon as it hit the market. Now I am glad to see that this book is on every Architect’s book shelf. If GOF’s Design Pattern book was a Bible which only high priest(C++ Guys) could read and understand, this book spread the word of Design God to ordinary mortals(vb) and connected the ordinary programmers to OOP.
After reading these books, ordinary mortals could come up with a good or not so good OOP solution but never had they gone back to procedure programming.


After reading first few chapters, I think that Strategy Pattern can very useful.

If you could never understand Command Pattern, try this book.

Tuesday, September 05, 2006

Why do I perfer Custom Collection over Dataset?

I don't like dataset as a mechanism to transfer data between two layers for following reasons

1. Not a true OOP concept
I seriously follow Rockford Lhotka's writing and agree with him on this.

2. Bad Performance.
I did some benchmarking tests on Custom Collections vs. Dataset as being transport mechanism in Web Services Scenario in Net 1.0. Custom collections performed four times better than Dataset. I am sure in remoting scenario , difference would be more dramatic. I am going to perform very soon some benchmarks tests on .Net 2.0

More Details


3. More Code
One ends up writing more code in packaging and unpackaging data in dataset.Remoting and WebServices infrastructure takes care lot of Serialization and Deserialization issue. Before Generics, by getting rid of dataset, I was able to get rid of 1000s line of code and get more performance.
Recently I did some benchmark tests on generics from my office computer (Which has less memory) and got more encouraging results. I will post them very soon on my blog

4. Not SOA friendly
If datasets are exposed through WebSerivecs, only .net Clients can use these Web-Services.

Chirdeep Shetty has very a nice post about problems that he faced to convert C# WebServices to Java WebServices because of dataset and workaround.



Having said that I may use Dataset/DataTable in following situations
1. When I have a situation where columns of a custom collection are variable. DataTable/Dataset IMO offers more clean solution.
2. Disconnected rich client architecture

Friday, August 25, 2006

Is 3 Layered Architecture = MVC

Very nice discussion is going on this thread.

http://forums.asp.net/thread/1379168.aspx

At first after reading the post, I also got confused by striking similarities between two patterns thought one is design pattern other one is application pattern.
Survic has written a nice post on confusion regarding MVC.

This is one of best articulated posts that I have come across on this topic.


If you don’t understand confusion about MVC then read

First there are two documented versions of MVC
http://www.javaworld.com/javaworld/jw-12-1999/jw-12-ssj-jspmvc.html

Here is sample of discussion on MVC and ASP.Net in which I took part
http://forums.asp.net/2/1249964/ShowThread.aspx


If you thought that this is enough then there is a MVP pattern.

Example of
http://codebetter.com/blogs/jeremy.miller/archive/2006/07/11/147305.aspx

After that Martin Fowler splits MVP into two parts to clear confusion (But now I am more confused)
http://geekswithblogs.net/billy/archive/2006/07/20/85815.aspx
http://martinfowler.com/eaaDev/PassiveScreen.html
http://martinfowler.com/eaaDev/SupervisingPresenter.html



I always use MVC as GUI or WEB based design pattern.
MVC is a design pattern for Interactive Interfaces.(LudovicoVan corrected me)
MVC in web context is more geared towards streaming HTML to different devices that understand HTML while 3 layer architecture is independent of any technology.
http://www.martinfowler.com/eaaCatalog/
http://www.martinfowler.com/eaaCatalog/modelViewController.html

One comment was that we should implement MVC in every layer of application.
I think that I know what the poster is implying.
Generally I believe in understanding the intent of pattern and implementing it my way that suits my project. But at the same time, we have to maintain some essence of design pattern for clear communication. While I understand what the poster is implying, I think that are specific patterns (factory,fascade,process layer,Aggregation etc) to describe the patterns applicable to good enterprise distributed computing needs.

Note: I am going to revisit this post

Wednesday, August 16, 2006

Showing Chinese or Japanese Characters in Charting / Graphing Tools

I was evaluating third party Charting Controls for our application. Somehow I was not able to show Chinese/Japanese characters properly on my machine. I was wondering whether it is problem with third party tools or my code. Finally after working with vendors, I found out problem was with my machine.
I am documenting this in my blog just in cause someone needs this info.

It is possible to show Chinese/Japanese characters in most of the charting tools. The only thing you need to do is have the Asian language pack installed. To do this; go to control panel -> Regional and Language Options then click on the language tab. From here, check the “install files for East Asian languages”. This will allow you to view Chinese on your machine. Once this is installed, all you need to do paste the text directly into the fields in the chart and it will show up properly.

Sunday, August 06, 2006

Domain Driven Design based on Entity Model vs E/R Model

Continued from
http://vikasnetdev.blogspot.com/2006/07/domain-driven-design-vs-data-driven.html

Survic said
“I agree with you about the size of projects; but deep in my heart, I also believe that all larger business projects can be split into smaller projects, so, I do not believe “TDD with mocks and DDD without data” is good for anything -- I will keep an open mind though”


Hi Survic,
Thanks for pointing to Scott W. Ambler.’s book ‘The Object Primer’. It helped me to write this post. That is what I wanted to articulate in first place
First thing nobody is underestimating the importance of Data in Domain Driven Design. But there are following problems or realities in Enterprise Data Design (Scott calls Legacy Database design but DBAs continue to employ for consistency purpose)

1. A single data field is use for several purposes.
2. The purpose of a data field is determined by the value of one or more other columns.
3. Inconsistent values are stored in a single data field.
4. There is inconsistent/incorrect data formatting within a column
5. Some data values are missing with in a data field
6. One or more data fields that require do not exist.
7. Additional data fields that your application will need to support if it uses the legacy data exist
8. Multiple source exist for the same data and it is not clear which one to use
9. Important entities, attributes and relationship are hidden and floating in text fields
10. Data values can stray from their field descriptions and business rules.
11. Various key strategies are used to identify the same type of entity
12. You require a relationship between data records that is not supported by legacy data.
13. One attribute is stored in several fields.
14. Special characters within a data field are inconsistently used.
15. Different data types are used for similar columns.
16. The legacy data do not contain sufficient detail.
17. The legacy data contain too much data.
18. The legacy data are read-only, yet you require update access.
19. The timeliness of data varies from what you require
20. The default value used by a legacy application does not reflect the default value required by your system.
21. Different representations of the data exist.
22. The naming conventions used are difficult to understand

As per my experience with DBAs in past,Some decisions may be right in their own way. They are more concerned about efficient storage of data; need to be consistent with existing databases (what Scott calls legacy) and future extensibility at data storage level.

Some of above factors limit the database design diagram to be used as effective communication tool with all stakeholders. We need a abstraction above database which hide these complexities and communicate more clearly Problem Domain/System Blueprints to users.

This is where come entity classes’ diagrams (Since we both agree on importance of process classes diagrams, activity diagrams, Sequence diagrams etc.) which can hide all above mentioned storage details from system users. It will help the programmer to nail down the requirement and prepare the blueprints with out waiting for database design to be over. Once requirements are completely nailed, data storage/retrieval is more implementation details.

This debate is similar to XML Hell debate. Nobody is arguing against the importance of XML but we need an abstraction/Graphical tools to hide its rawness as discussed in the following mail
http://vikasnetdev.blogspot.com/2006/06/xml-hell.html

Reference:
The Object Primer – By Scott W. Ambler

Tuesday, August 01, 2006

Domain Driven Design-- My Rating 3-4/5 -- Currently Reading

This book will influence one to employ Domain Driven Methodology even in a pure Waterfall or fixed bid project. You will not like to be caught with out a Domain blueprint in Design phase after reading first five chapters book and will know the importance of Ubiquitous Language.

My criticism of book is that if you are well-verse in design patterns,Analysis patterns ,OOP concepts that book discusses, you may find little value in chapter 6 - 13. Authors should have shortened them into two or three chapters.

If you are new to Application and Design Patterns,Analysis Patterns and OOP , you will find this book more useful.
I am glad that I read it and it is over. (read 60%). I have to still read Chapter 14-17. May be some other time.

Tuesday, July 25, 2006

SOA Friendly Architecture version of Jeffrey Palermo's Architecture -- Part 2 -- Architecture

As always, Survic raised excellent Questions and gave excellent suggestions about my previous post. Survic comments/questions are in bold.


“Business Object Manager” (I guess it is the “Façade Object” -- it is very popular to use "XX_Manager" and "XX_Facade" interchangeably)Business Object Manager is a Mediator between Business/Entity Object and Data Object Layer. It provide an opportunity to aggregate the business objects on Database server and send aggregate object at once to Application Server. This particular element is missing in Jeffery’s Architecture (I could be wrong) or in Pet Shop Architecture (I am very sure because I am burnt by it).
It also enables Business Object Layer and Business Transfer Object to one layer instead of being multiple layers as shown in the code.


Process Object” (I guess it is the “Workflow Object”)


Yes, Survic is right.
All the Workflow logic, additional processing, co-ordination and control logic will go there.


Repository Object” (I’m pretty sure it is the “Façade Object”).
In my case, it is responsibility of Gateway/Factory Layer. I may take out of Architecture diagram.

Application architectures” and “service architectures” are critically different?No. There are subtle but major Design differences.

SOA = Good Distributed Programming Practices + Message Version Control + More Loose Coupling
In Distributed Architecture/Client Server Architecture, generally you may have control over client applications. In my internal application architecture, I can make changes to Business Object layer and regenerate the proxy object and recompile the Gateway/Factory Layer and make changes to UI. So there is little tight coupling between server side component and consumer application. Basically I am sharing code with Consumer application. Performance is big concern. It is more RPC style of communication
Distributed computing is also more end-to-end integration. Component A connects to Component B and component B connects to Component C

In Service Oriented Architecture, you don't have control over client applications or other consumer Services. in general. You have to be more subtle over version control. You share contract and chances are that your application may support multiple contracts.In that scenario, I design the Incoming message as XML string and share XML Schema with client. That way Interface of Service always remain same (no need to regenrate WSDL )but you message structure may change. It is more Document Style of communiction.
SOA is more like workflow. Component A may connect to Componet B or may be Component C.
Here is nice article by Rockford Lhotka

However I think that if you have good Middle Layer, adding a true service layer should be a small issue.

Microsoft Architectue
Do they have some implementation code? My interpretation is same like you. It is decent architecture if we both are right. Last time , I used pet shot .net architecture, it left a very bad taste in mouth. :)

Friday, July 21, 2006

SOA Friendly Architecture version of Jeffrey Palermo's Architecture -- Architecture

Please Note:
I am retiring this implmentation with a new implmentation using WCF, though the
Architecture remains same.
http://vikasnetdev.blogspot.com/2006/12/my-default-soa-architecture-using-wcf.html


This post is inspired by Jeffrey Palermo's post on Application's Architecture


Though it is quite superior as compared to .Net Petshop Architecture, I really doubt that this architecture will scale for distributed computed scenario like petshop architecture does not. Jeffrey may have answer for this. So I came up this SOA friendly architecture which is being used at one of my client's place. I am also going include some feature from Jeffrey'a Architecture like Presentation layer (MVP vs MVC) in my architecture

Note: The author of this blog does not believe that you should use WebSevice in standalone application when none required. But we live in a world where we don't make rules. If you database is protected by another firewall, you may find this architecture handy. It is more important to have logically separation in architecture that will scale well if application is deployed in a distributed manner.


Here is SOA friendly Architecture


Here is deployment view


Major Components

1. UI Components/Views:
Provide User Interface

Controllers
Get the Business Objects from Gateway and provides to UI

Gateway/Factory
It is factory layer that provides the business object. It knows how to create or get the object across the network boundaries. First looks in repository if none, gets the object across the wire.Our example is going to exploit the capabilities of Web Service. It will convert the proxy object into real domain object using Mapper utility.

References:
http://www.martinfowler.com/eaaCatalog/gateway.html
http://www.martinfowler.com/eaaCatalog/repository.html
http://www.martinfowler.com/eaaCatalog/dataTransferObject.html


Business Object Manager
It populates the business object using data object. This is where one can aggregate the business objects before transferred across the network.


Business Object/Entity Object
Contains the Attributes and operations related to domain entity

Process Object/Workflow Object
Business objects collaborate together to perform some useful operations to users.


Data Object
Data Objects retrieve the data from Database. Will contain all the CRUD operations.

Here is Code.

Gateway

namespace Gateway
{
public class Contact
{
static Contact()
{
//
}

private static List contactListCache = null;
private static Object syncRoot = new Object();

public static void ClearCache()
{
lock (syncRoot)
{
contactListCache = null;
}
}

public List GetContact()
{
return ContactList;
}


public List ContactList
{
get
{
if (contactListCache == null)
{

lock (syncRoot)
{
contactListCache = new List();
ContactWS.ContactService ws = new ContactWS.ContactService();
ContactWS.Contact[] proxyContactList = ws.GetContacts();
contactListCache = (List)Mapper.MapProperties_Fields((System.Collections.IList)proxyContactList, typeof(List), typeof(BusinessObject.Contact));
}

}
return (contactListCache);
}
}

}
}



namespace Gateway
{
public abstract class Mapper
{

public static object MapProperties_Fields(object SourceObj, Type DestinationType)
{
if (SourceObj == null)
{
return null;
}
Type sourceType = SourceObj.GetType();
object destinationObj = Activator.CreateInstance(DestinationType);

foreach (PropertyInfo sourceProperty in sourceType.GetProperties())
{
MemberInfo destinationMember = DestinationType.GetMember(sourceProperty.Name)[0];

if (destinationMember.MemberType == MemberTypes.Property)
{
PropertyInfo destinationProperty = ((PropertyInfo)(destinationMember));
if ((destinationProperty.CanWrite == true))
{
if (destinationProperty.PropertyType.Equals(sourceProperty.PropertyType))
{
destinationProperty.SetValue(destinationObj, sourceProperty.GetValue(SourceObj, null), null);
}

}
}
}
return destinationObj;
}



public static IList MapProperties_Fields(IList SourceList, Type DestinationListType, Type DestinationElementType)
{
if (SourceList == null)
{
return null;
}
IList destinationList = ((IList)(Activator.CreateInstance(DestinationListType)));
foreach (object sourceObj in SourceList)
{
destinationList.Add(MapProperties_Fields(sourceObj, DestinationElementType));
}
return destinationList;
}



}
}




WebService
namespace BusinessObjectWebservice
{
///
/// Summary description for Service1
///

[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[ToolboxItem(false)]
public class Service1 : System.Web.Services.WebService
{

[WebMethod]
public List GetContacts()
{
BusinessObjectManager.Contact contactManager = new BusinessObjectManager.Contact();
return(contactManager.GetContacts());
}
}
}



Business Object Manager
namespace BusinessObjectManager
{
public class Contact
{
public List GetContacts()
{
DataTable dataTable;
List list = new List();

dataTable = DataObject.Contact.GetContact();
try
{
foreach (DataRow dataRow in dataTable.Rows)
{
BusinessObject.Contact contact = new BusinessObject.Contact(dataRow[0].ToString(), dataRow[1].ToString(), dataRow[2].ToString(), Int32.Parse(dataRow[3].ToString()));
list.Add(contact);
}
}
catch (Exception ex)
{
throw ex;
}
finally
{
dataTable = null;
}

return(list);
}

}
}


Business Object

namespace BusinessObject
{
public class Contact
{

private String _userName;
private String _name;
private String _phoneNumber;
private int _age;

public Contact()
{
}

public Contact(string userName, string name,String phoneNumber, int age)
{
_userName = userName;
_name = name;
_phoneNumber = phoneNumber;
_age = age;
}


public String UserName
{
get
{
return _userName;
}
set
{
_userName = value;
}
}

public String Name
{
get
{
return _name;
}
set
{
_name = value;
}
}

public String PhoneNumber
{
get
{
return _phoneNumber;
}
set
{
_phoneNumber = value;
}
}


public int Age
{
get
{
return _age;
}
set
{
_age = value;
}
}

}
}


Data Object
namespace DataObject
{
public class Contact
{
private const String ContactTableName = "Contact";

private class Fields
{
public const string UserName = "ContactUser_Name";
public const string Name = "Contact_Name";
public const string PhoneNumber = "Contact_Phone_Number";
public const string Age = "Contact_Age";
}


public static DataTable GetContact()
{
System.Text.StringBuilder sql = new System.Text.StringBuilder();
System.Data.DataTable dataTable;

//Build the SQL

AppendBaseSelectColumns(sql);

sql.Append(" FROM");
sql.Append( " " + ContactTableName);

try
{
dataTable = GetDataTable(sql.ToString());
}
catch (Exception ex)
{
//Log the error
throw ex;
}


return(dataTable);


}

private static String AppendBaseSelectColumns(System.Text.StringBuilder sql)
{

sql.Append("SELECT");
sql.Append(" " + Fields.UserName + ",");
sql.Append(" " + Fields.Name + ",");
sql.Append(" " + Fields.PhoneNumber + ",");
sql.Append(" " + Fields.Age );
return sql.ToString();

}

private static DataTable GetDataTable(string sql)
{
//Real life one will connect to Database and return the
DataTable dataTable = new DataTable();
dataTable.Columns.Add(new DataColumn("Contact_User_Name", typeof(String)));
dataTable.Columns.Add(new DataColumn("Contact_Name", typeof(String)));
dataTable.Columns.Add(new DataColumn("Contact_Phone_Number", typeof(String)));
dataTable.Columns.Add(new DataColumn("Contact_Age", typeof(System.Int32)));
dataTable.Rows.Add(new Object[]{ "VK", "Vikas","222-222-2222",int.MaxValue});
dataTable.Rows.Add(new Object[] { "SV", "Survic", "222-222-9999", int.MaxValue });
return dataTable;

}

}
}


Presenter/Controller
namespace Presenter
{
public class ContactPresenter
{
public ContactPresenter(View.IContactView view)
{
_view = view;
_view.LookUp += new EventHandler(_view_LookUp);
_view.Persist += new EventHandler(_view_Persist);
}

private View.IContactView _view;
private BusinessObject.Contact _currentContact;


public View.IContactView View
{
get { return _view; }
}
public BusinessObject.Contact CurrentContact
{
get { return _currentContact; }
}


public void SaveContact()
{
if (_currentContact != null)
{
_currentContact.Name = _view.ContactName;
_currentContact.PhoneNumber = _view.ContactPhoneNumber;
_currentContact.Age = _view.ContactAge;
}
}

public void LookUpContactByUserName(string userName)
{
Gateway.Contact contactGateway = new Gateway.Contact();
List contactList = contactGateway.GetContact();

foreach (BusinessObject.Contact contact in contactList)
{
if (contact.UserName.ToUpper().Trim().Equals(userName.ToUpper().Trim()))
{
_currentContact = contact;
break;
}
}

_view.ContactUserName = _currentContact.UserName;
_view.ContactName = _currentContact.Name;
_view.ContactPhoneNumber = _currentContact.PhoneNumber;
_view.ContactAge = _currentContact.Age;
}

private void _view_LookUp(object sender, EventArgs e)
{
this.LookUpContactByUserName(_view.UserNameToLookUp);
}

private void _view_Persist(object sender, EventArgs e)
{
this.SaveContact();
}
}
}

Converting NUnit Tests to MSTest


I have been deliberating for some time whether to stick with NUnit or go for MSTest.
http://vikasnetdev.blogspot.com/2006/07/eight-point-checks-for-servicing.html

Advantages of MSTest over NUnit
1. Excellent IDE Integration
2. Code Generation
3. New Attributes
4. Enhancements to the Assert class
5. Built-in Support for testing non-public memembers.

After hearing from the colleague that debugging NUnit tests is not working great with Visual Studio 2005, I decided to plunge into MSTest. First step is figure out how move previous NUnit tests to MSTest. Here are steps

Step 1: Start with James NewKirk’s blog post

Step 2: Download the NUnit Converter V1.0 RC1 from workspace


Step 3: Install the Guidance Automation Extensions & Toolkits from link


Step 4:Double-click the file: “NUnit Converter.msi” to install the converter. One caveat: It has not been tested in any other directory than the default directory. This of course does not mean it will not work in a different directory it just means that it might not. Also the rest of the instructions assume you have put it in the default directory. You can think of this as a strong hint to leave it in the default directory.

Step 5: Start Visual Studio 2005 Team System.
Step 6: Open a solution file that has existing NUnit test code.
On the Tools menu, click Guidance Package Manager. A dialog box should open, see below. You should check to make sure that the “Convert NUnit Test Code” Recipe is present. Then click Close.





Step 7: You have completed the installation.


Step 8: Back-up the files and their associated project and solution files. This step is critically important. There is no automated restore of your files back to a previous state.

Step 9:Start Visual Studio 2005 Team System.
On the File menu, navigate to Open, click Project/Solution. Navigate to the directory where the Project/Solution is contained and then select the file you wish to open.
On the File menu, navigate to New, click Project. Select the appropriate (C# or VB.NET) test project and place it in the directory of your choosing. See “Tests must be in a Test Project” below.
Copy each file that contains NUnit test code that you want to be converted into the test project.
Add any required references (including a reference to NUnit) and compile the test project. Once the code compiles, run the tests in NUnit to ensure that you are starting with a working test harness. This step is optional but I like to do it because if the conversion process introduces problems, I know that I started with a working baseline.
Step 10: Now onto the conversion process. Right-Click the test project that you created in previous step in the Solution Explorer. Click the Convert NUnit Test Code. As each file is being converted it will be opened in Visual Studio. When the conversion is complete, the conversion results will be displayed.
Once you have completed the conversion process you should disable the guidance package. The reason is that every time you right-click in the Solution View the guidance package looks for NUnit test code. If there isn’t any to find it just wastes time. On the Tools menu, click Guidance Package Manager. A dialog box should open. Click Enable/Disable Packages. You should uncheck “NUnit Test Code Conversion”. Then click OK.

Saturday, July 15, 2006

Domain Driven Design vs Data Driven Design -- Domain Driven Design

Subscribe to my youtube channel "Software Architecture Matters!!!"







Survic has very nicely argued that database storage and retrieval is 80% ( I would say 70%) portion of application. Mocks ups, Screen Design and database will help to achieve completion of 80 percent of system.
I agree 100% with you that if you have a short term project with no future releases, data driven design is more efficient. My argument is Mock ups, Domain Design and Database Design (in that order. Domain Design and Database Design could be parallel activities in some organizations) will not only help achieve 100% but is also cost effective for project with multiple releases.

Rest of 20% is too important to left open to risks of communication failure
Nothing more make sense to Business User more than Mock ups, Screen Shots or prototype. You win the 80 percent battle if you have these ready with Database design. But left 20% is too important to left open to communication failure.
Rest 20% is like collaboration mechanism that integrates all the parts of plane and help you fly the plane and reach the destination. Fact that you all parts are complete and you get the mechanism wrong would result in system failure.
Now back to real world, we get the 20% right in the sense; they deliver the business value but are written in procedural style hard-coded in the front end. Thus it results in weak business layer. Experience developers will notice patterns and in next iteration, we will refactor the 20%. That brings me to next point

Domain Driven Design requires more time.
Domain Driven Design is a more reverse thought process. As you put it, first figure out the data needs and perform the domain design. Problem is thinking in terms of data needs will create communication failure. There is good case study example in Domain Driven Design ( I have read only 10% of book). Here is excerpt from book

Users:

So when we change the customs clearance point, we need to redo the whole routing plan.

Developer:
Right. We'll delete all the rows in the shipment table with that cargo id and we will pass the origin, destination, and the new customs clearance point into the Routing Service, and it will re-populate the table. We'll have to have a Boolean in the Cargo so we'll know there is data in the shipment table

Users:
Delete the rows. OK, whatever

Reference: Domain Driven Design -- by Eric Evans.

There is no concept of any domain analysis in most project that I have done. You have screen shots, process flow or activity diagrams and database ready, let us move to development. Class diagrams more reflect the database rather than domain.
So you are going to be get all entity classes right and no or light controller or process classes. Experienced developers will notice all common patterns but there is not time to apply patterns as there is a deadline to meet. In next release, experienced developers will sneak in design patterns, controllers and process classes. If something breaks down in application that was scoped not to be affected during impact analysis in release, you will to answer the Project Manager.

Domain Driven Design is good and no Domain Driven Design has costs
In my analysis, Domain Driven analysis will help you get 10 – 15% out of 20% right in first release. Returns on investment are higher in long term and less risk. Performing Domain Analysis first before data requirement will help the communication and no Domain Analysis has costs.


People understand Mock Screens More
In theory, perhaps, you could present a user with any view of a system, regardless of what lies beneath. But, in practice, a mismatch causes confusion at best—bugs at worst. Consider a simple example of how users are misled by superimposed model of bookmarks for Web sites in current releases of Microsoft Internet Explorer.

Of course, an unadorned view of the domain model would definitely not be convient for the user in most cases. But trying to create in the UI an illusion of a model other than the domain model will cause confusion unless the illusion is perfect.


People don’t understand Objects
MODEL_DRIVEN DESIGN calls for an implementation technology in tune with the particular modeling paradigm bend applied. At present, the dominant paradigm is object-oriented design and most complex projects these days set out to use objects, some are circumstantial, and others derive from the advantages that come from wide usage itself.

Many of reasons teams choose the object paradigm are not technological, or even intrinsic to objects. But right out of the gate, object modeling strike a nice balance of simplicity and sophistication.

The fundamentals of object oriented design seem to come naturally to most people. Although some developers miss the subtleties of modeling, even non technologists can follow a diagram of an object model.
Yet, simple as the concept of object modeling is, it has been rich enough to capture important domain knowledge. And it has been supported from the outset by development tools that allowed a model to be expressed in software.

Objects are already understood by a community of thousands of developers, project managers, and all other specialists involved in project work.


When a design is based on a model that reflects the basic concerns of users and domain experts, the bones of the design can be revealed to the user to a greater extent than with other design approaches. Revealing the model gives user more access ot the potential of the software and yields consistent, predictable behavior

Reference: Domain Driven Design – by Eric Evans

Monday, July 10, 2006

Data Driven Design to Domain Driven Design—Facilitator Fit -- Fit

After exploring Fit, I am convinced that Domain Driven Design is way to go.

Data Driven Design creates a communication gap between business user and programmer. Data driven design forces programmer to think more about persistence and data storage needs rather than problem domain. Programmer ends up throwing lot of technical mumbo jumbos at business user. This leads to communication failure.
When business user and programmer arrive at Fit table, next step is to map Fit table to Software’s Business Layer to validate the Fit Table. Mapping will be smoother if Business Layer Class Model mirrors the problem domain. Close mirroring will encourage the programmer to speak in business user’s language and facilitates good communication.
I was employing data driven design with pragmatic use of Design Pattern. Now I am going to focus on Domain Driven Design and speak in Business Users language.
For a start, I am going to read Domain Driven Design by Eric Evans

Tuesday, July 04, 2006

Eight Point Checks for Servicing Software -- Servicing Software Part 3

I am updating my post part 2. I am replacing terms nunit with automated testing and nant with continuous integration build.

With the advent of Team System, I think that I am going to explore its automated unit testing and continuous integration capabilities. It was a hard decision since I really loved these open source frameworks. I think that they did a great service and have outlived its utility.

I am hoping that Team System has done a good job of integrating these frameworks with IDE.

Next couple of days I am going to Explore Team System capabilities

Friday, June 30, 2006

RowFixture Example in C# -- Fit


EmployeePayRecordsRowFixture.cs
using System;


public class EmployeePayRecordsRowFixture : fit.RowFixture
{
public override Object[] Query()
{

EmployeePayRecord[] records = new EmployeePayRecord[2];
records[0] = new EmployeePayRecord(1, 1000);
records[1] = new EmployeePayRecord(2,2000);
return records;
}

public override System.Type GetTargetClass()
{
return typeof(EmployeePayRecord);
}
}


EmployeePayRecord.Cs
using System;
public class EmployeePayRecord
{
public int id;
private double salary;
public EmployeePayRecord(int id, double salary)
{
this.id = id;
this.salary = salary;
}
public double pay()
{
return salary;
}
}

Monday, June 12, 2006

Nice interview questions found in a Job Posting

Subscribe to my youtube channel "Software Architecture Matters!!!"







Architecture - client requires at least rudimentary skills in these areas.
What is SOA? Benefits? SOA principles for WS?

Name standard architecture patterns you know

Design Patterns

What is a singleton class? Where one should use it and what is the advantage of using it?

What kind of UML diagrams do you know?

Explain how garbage collection works in .NET. How to properly release object resources?

How to expose COM dll to be reused in .NET?

How to use .NET dll in ASP 1.1?

Web Services - client requires expertise in these areas.

How to convert a class into a Web Service? Attributes to use?

When and how do you implement the asynchronous WS call? Does .NET have a support for this?

What is the transport protocol you use to call a Web service?

What does WSDL stand for?

How you make your WS discoverable?

What is WSE? What does it include?

AD- client requires at least rudimentary skills in these areas.
What is Active Directory?

What is Global Catalog?

User display name = Nick Kazanskiy, Container=users in OU=DolUsers. server= usatrame5101.staging.dmz.dtt. Write a LDAP connection string.

COM+ - client requires solid skills in these areas.

Explain transaction atomicity.


Explain consistency.



Explain integrity.



Explain durability.



Explain object pooling.

Explain JIT activation.

Explain role-based security

Explain queued components.

Explain loosely coupled events

Define scalability.
Define reliability.

Define availability.

Define security.

Define manageability.

Which namespace do the classes, allowing you to support COM functionality, are located?

How do you make a NET component talk to a COM component?.

XML- client requires solid skills in these areas.
What is XPath?

What is XSLT? And what's its use?

How to load XML in .NET? What methods and objects could be used?

How to search in XML using XPath if the namespace is defined in XML?

SQL Server – client requires some knowledge of these skills as it relates to development.
What are benefits of using views?

What kind of triggers exists?

What are restrictions on User defined functions?

What are partition views?

What does referential integrity (also called relational integrity) prevent?

What is denormalization and when would you go for it?

What's the difference between a primary key and a unique key?

Define candidate key, alternate key, and composite key.

What are defaults? Is there a column to which a default can't be bound?

What's the difference between DELETE TABLE and TRUNCATE TABLE commands?

What is an index? What are the types of indexes? How many clustered indexes can be created on a table? I create a separate index on each column of a table. what are the advantages and disadvantages of this approach?

What is replication? How many different types of replication exist?



ASP.NET - client requires solid skills in these areas.
Explain the differences between Server-side and Client-side code?

What type of code (server or client) is found in a Code-Behind class?

Should user input data validation occur server-side or client-side? Why?

What is the difference between Server.Transfer and Response.Redirect? Why would I choose one over the other?
http://msdn2.microsoft.com/ru-ru/library/aa332847(VS.71).aspx
http://msdn2.microsoft.com/en-gb/library/t9dwyts4.aspx

What is the Global.asax used for?

What are the Application_Start and Session_Start subroutines used for?

Describe the role of inetinfo.exe, aspnet_isapi.dll andaspnet_wp.exe in the page loading process.

What’s the difference between Response.Write() and Response.Output.Write()?

What methods are fired during the page load?

What is ViewState?

What is the lifespan for items stored in ViewState?

What does the "EnableViewState" property do? Why would I want it on or off?

What are the different types of Session state management options available with ASP.NET?

When during the page processing cycle is ViewState available?

What is assembly? What are assembly components?



C#- client requires solid skills in these areas.
I was trying to use an “out int” parameter in one of my functions. How should I declare the variable that I am passing to it?

If I return out of a try/finally in C#, does the code in the finally-clause run? Describe how the try/catch block works and in what sequence the exceptions need to be processed.

What statement is used to synchronize the code execution?

What is the difference between a struct and a class in C#?
http://msdn2.microsoft.com/en-us/library/ah19swz4.aspx


Is it possible to have different access modifiers on the get/set methods of a property?

Is there a way to force garbage collection?

How do you convert a string into an integer in .NET?

OOP
What is difference between Interface and Inheritance
http://msdn2.microsoft.com/en-us/library/87d83y5b.aspx
http://msdn2.microsoft.com/en-us/library/ms173149.aspx

Does .Net support Multiple Inheritance ? If not, what are alternatives?

Can you have private abstract methods?

What are the methods of object you should overwrite?

What is binary search algorithm?

What is difference between Value Types and Reference Types?

All types derive from which base type
Ans. System.Object

What is delegate


Eight Point Checks for Servicing Software -- Servicing Software Part 2

Scenario
You as a part of Software Service Professional have been allocated to service software. User Interface Looks great and it has been meeting the existing business requirements. There has been complains of production problems, production down time and software slow to new business needs.

Point 1 Architectural Check #: Is there any Architecture in the system?
Observation : None. There is no logical layer or physical layer to separate the UI Layer, Business Layer, Data Layer
Consequence: Software Stays in Software Service Shop for a long time.
Action to be taken:
Step1: Understand the enemy. Just fix and learn the business knowledge and understand the code
Step2. Move the Data Logic and business logic to Middle Layer. No need to domain or CRC analysis at this stage.
Step3: Insert the new Architecture for new development.




Point 2 Automated Testability Check #: Is there factory layer or façade layer between UI and Middle Layer
Observation: None
Action to be taken:
Step 1: Create the factory layer for Middle Layer. Factory Layer provides high level abstraction




Point 3 Automated Tests Existence Check#: Do we have automated tests for factory layer or façade layer.
Observation: None
Step 1: Write the automated unit tests.


Point 4 Middle Tier Design Check#: Does Middle Layer Design maps to problem Domain?
Observation: None
Action to be taken:
Step1. Perform Domain Driven Design or CRC Analysis or Data Driven Design
Step2. Run automated unit tests.
Step3 Perform Continuous Integration (using NANT and CruiseControl or MSBuild)


Point 5 Logging Check#: Some behavior can be observed only during execution in production environment. Does system enable logging for that?
Observation: None.
Acton to be taken:
Step1: Writing your own logging routines
Or
User Microsoft Application Blocks
Or
User Log4net



Point 6 Exception Check#: Exceptions raised during production time are being logged
Observation: None
Action to be taken
Step1: Write your own Exception Mechanism
Or
Use Exception Application Block




Advance Checks#
All or None scenario creating problem in production. Are components using transaction?
Observation: None
Action to be taken
Step 1: Implement Enterprise Service or ADO Transactions


Point 8 Design Patterns Checks#
Will Design Patterns’ injection make the maintenance easier?
Observation: Yes
Action to be taken
Step 1: Implement Design Patterns
Step 2: Run automated unit tests
Step 3: Run the daily build


Good Reads

Survic has written a nice post

Saturday, June 10, 2006

What if we can maintain our Software Systems like our cars ?

My Comment : World would be a a happy place to live.

Problem:
I have come across a comment from software professionals that they know that some parts of their software oulived its utility. They would love to replace it with new parts but their business users would not allow it. Business users’ opinion is if they are not getting new functionality from software then they don’t want any change.

Solution:
What if we have ‘Maintenance Check’ or ‘Overhauling” phases in our software life cycle? We allocate time and resources for maintenance check in our project plans. Qualifies Software Professionals would check software and see what parts are worn out or need oil and tuning. Worn software are removed with new, others are refactored and tuned.

Do I like paying for Car Service? No. Do I go for every car schedule to keep my car running? Yes. I think that it is a time to educate Business Users about Software servicing. They have choice to pay tens of thousand dollars for software servicing or million of dollars for software rewrite. Because Software System is going to die with
out service ultimately.


Till it happens, let us sneak changes as refactoring with next release.

Sunday, March 12, 2006

BPMN and UML Activity Diagram

I think that consolidation of UML Activity Flow Diagram and BPMN would be a great thing to happen.


BPMN will eventually be passed on to an organization to formalize its status
as standard. The OMG is a likely candidate to eventually take in the BPMN
standards and there have been discussions between BPMI and the OMG to
facilitate this transfer in the future. Considering that the OMG is currently developing UML, which includes Activity Diagrams,it is possible that a
consolidation of BPMN Business Process Diagrams and UML Activity Diagrams will
take place.



Reference:
Stephen A. White, IBM Corporation
http://www.bpmn.org/Documents/Introduction%20to%20BPMN.pdf