Monday, October 25, 2004

The Discussion continues...

This is what Khurram bhai had to say in my mails response...

hello Hammad,
Nice to hear your comments, let me assure you first that I am not
against .NET (I am MVP yaar :)) and just trying to compare the two
technologies objectively.
In my opinion there are few things Java is better and several other
things that can handle by .NET more nicely. e.g if we need Windows
only development with platform integration features etc.

Now let me answer your comments step by step ,

> 1- Language Design:
I agree with you, I think both Java and C# are equally capable
languages with beautiful syntax. (much better then VB that why I
didn't comments on language features )
But there is important diff. in Java and .NET, every function is
virtual in Java by default, but in .NET we have to explicitly mark the
function as virtual, although its increase the flexibility of the
system but I have to find its usage yet. it would be better in my
opinion if every thing is virtual by default in C# as well.

2- Persistence Frameworks:
I tried NHibernate, but it is in pre-alpha stage so it is not an
option to use in our production env. projects.

Let me explain my point of view regarding OR tools w.r.t your blog.

Q.1
How effective is O/R mapping when you don't look at single objects but
rather need to fetch sets of data (assume the price history for a
stock) based on certain criteria such as a certain time period?

I think OR mapping is useful in single object CRUD(Create, Read ,
Update, Delete) operation or when we have to manipulate the data
(usage of object operations), for reporting purpose or only displaying
data it does not make much sense, but if we are using any Object
Oriented Language like java / C# we have to make objects for data
manipulation in any case and for that OR tools are logical choice.

For Bulk Amount data access OR Tools should not be use. (Please see
also EJB Bulk Data Access pattern)

Q.2
How do you integrate with transactions and how do you assure that you
are in control of the order and locking hints of insert/update
operations to minimize deadlocks/lock contention?
In my JDO / Hibernate experience, OR tools use transaction of database
engine through JDBC or ADO.NET wrappers so it usually has not impact
on transaction handling. (just like simple JDBC or ADO.NET
applications)

Q.3 c)
How tight is the coupling between your relational model and your
objects? Can you change the table layout and indexing of the data
store flexibly as your data volumes change?

--- Most of the JDO and OR tools based on JDBC or ADO.NET
capabilities, table layout or indexing chg usually don't impact much
on simple JDBC/ADO.NET application so that is the case of OR Tools

Q.4
What is the net efficiency gain that O/R mapping gives you in
development? Is it actually making developers more productive in
creating *and maintaining* your software or is it merely "more
elegant"?

In simple operation I found OR tools are more efficient , since they
are using Cache mechanism of queries and results. Also JDO like tools
improve the developer productivity a lot since in most of our business
application CRUD operations contains around 30 to 40% of middle tier
development time. by using transparent persistence layers we can
reduce that time and guarantee the bug free data access layers
development.

In my experience I found JDO like tools much better then hand coded
data access layers , since it is very manual and repetitive tasks.
Also there are middle level between pure OR mappers and hand coded
database logic, you should check the
www.ibatis.com , it provide nice OR tools and must have tool for every
ADO.NET developer.


> 3- Custom Layout:
I was talking about the Winforms and not ASP.NET forms. I don't like
the idea of base Form which have layout functionality, instead design
wise I am more inclined separate Layout managers like in Java.
currently they are not supported.

4- As a side note , I want to see Dynamic proxy equivalent in C# as
well, it is must for any serious AOP programming, Java Dynamic proxy
implementation is cool. (I know there are independent dynamic proxies
exist for .NET , but they are based on remoting framework and I have
doubts in its performance.)

Just my quick thoughts :)

Regards,
Khurram Shakir
MVP (Visual C#)

1 comment:

flav3r said...

hello Khurram,
>But there is important diff. in Java and .NET, every function is
>virtual in Java by default, but in .NET we have to explicitly mark the
>function as virtual, although its increase the flexibility of the
>system but I have to find its usage yet. it would be better in my
>opinion if every thing is virtual by default in C# as well.

virtual function calls are slower than non-virtual function calls. Thats why its better in C#.
Besides, when we declare a method as virtual, we are basically saying that a possibility exists that who ever derives from this class may need to override this default functionality. Its something you want when you are designing a class lib. Now there are 50 private utility functions in my class which I know will never be overriden, do I need to make them virtual? A definite NO.

Ab.