The Design of Software (CLOSED)

A public forum for discussing the design of software, from the user interface to the code architecture. Now closed.

The "Design of Software" discussion group has been merged with the main Joel on Software discussion group.

The archives will remain online indefinitely.

Is this technically incorrect ???

it has been decided to pass interfaces between layers on our system.

e.g. OrderDataAccessObject.WriteOrder(IOrder)

fair enough but this go me thinking.....
cant we make a form implement the interface too so we can pass this instead of the objects around or is this just plain nasty ????


public class Myform: System.Web.UI.Page, IOrder
then in form....


or you could pass this to a business object
am I missing something because i have never seen this in code ergo, i'm thinking this this bad, if so why ?

would be very appreciative of comments
Andy D Send private email
Monday, November 07, 2005
Well, there is technically nothing wrong with it but it seems odd that you would have a form implement IOrder. It seems to violate OOP principles. Is a form an order? Probably not. A form is a form. If you make it also be an order then you are mixing GUI with Business Logic. I would personally have an object that is call an Order that also implements the IOrder interface (if that's what you want to do).

Also, keep in mind that you are passing a reference to an object that implements the order interface. It currently looks like you are doing that through a direct call. But in the future, you may also want to pass the "Order" to a web service. This would mean that it would have to be serialized into XML and sent across the wire. You wouldn't want to have to serialize a form and all of its extra data just to send an order to a web service.
Turtle Rustler
Monday, November 07, 2005
One more thing... forms are very dynamic and are constantly being changed. However, orders probably aren't. Going back to the web service idea, a constantly changing form means a constantly changing interface to a web service which is a really bad thing. Keep "Order" simple and just let the form work with an instance of it. You'll be much happier that way.
Turtle Rustler
Monday, November 07, 2005
I agree with all that Turtle Rustler said, but I wanted to add just one thing. Making a form implement an IOrder interface is a violation of layer separation principle. You are moving things to different layers to avoid coupling between them. And once you separate them, you don't want to mix them back.
Tuesday, November 08, 2005

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics
Powered by FogBugz