3 layers that do nothing except calling each other

G

Guest

Hi,
I was given an ASP.NET (C#) application to modify.
The code looks really strange.
It's supposed to do simple things but it has
Facade/BusinessRules/Common/DataAccess layers.
For example,
simple method in Navigate.ascx.cs is instantiating a new object
and calls obj1.COBdateInit().
obj1 does exactly the same thing.
It call obj2.COBDateInit()
obj2 does the same thing again, it call obj3.COBdateInit()
and that one retrieves data.

Is it OOP? Why not to get data at the first step?
Isn't it an overkill?

Thanks,
RO
 
W

Ward Bekker

Hi Riga,

It is difficult to judge if the structure is in this case overkill, but
judging from the example you gave this might be the case here. Because
why does the facade need to call a method that is present 3 layers deep?
The presentation layer should not be bothered how a certain object
that is only used by the data access layer is initialized.

Let's assume it's bad design, your still are asked to modify the
application. A good start might be to read "Working Effectively With
Legacy Code" (see link below). As re-writing is most of the times not
very pragmatic it's good to know how to deal with legacy code when you
need to change it.

http://www.objectmentor.com/resources/articles/WorkingEffectivelyWithLegacyCode.pdf

--
Ward Bekker
"Asp.Net Discussions for the Professional Developer"
http://www.dotnettaxi.com

"Free .Net 2.0 C# to/from VB.Net Code Converter"
http://www.dotnettaxi.com/Tools/Converter.aspx
 
S

sloan

Tiered development and OO are 2 different things.

I do not think your code is circular, because circular references usually
bomb out.

Presentation calls the BusinessLayer
BusinessLayer calls the DataLayer
DataLayer returns something (DataSet, IDataReader, Scalar) to the
BusinessLayer.
BusinessLayer uses the return object(DataSet,IDataReader,Scalar) to do
something usually. (Create a collection, check values, sometimes it just
shoots the DataSet up to the Presentation layer)
Presentation Layer "presents" the thing it got from the BusinessLayer.

Sometimes developers use the same names for the method calls.

I wouldn't un-architect this....until you understand what it does..and if
they are perhaps just using a decent 3tier design.

...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,567
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top