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

Thursday, January 04, 2007

No Stubs, No Mocks -- just use ObjectMother -- TDD

http://vikasnetdev.blogspot.com/2006/05/when-to-use-mock-objects.html
Couple of days back, I wrote that I am not using Mock/Stub objects but I have moved creation of my complex business objects in my testing framework to another helper classes. Today I came to know that there is pattern for this concept from Thoughtworks named as ObjectMother

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