From: "SirGilligan"
<sirgilligan.at.netscape.net (AT) yahoogroups (DOT) at.jhrothjr.com>
To: "extremeprogramming (AT) yahoogroups (DOT) com"
<@yahoogroups.at.jhrothjr.com>
Sent: Tuesday, June 07, 2005 5:27 PM
Subject: [XP] -vs- Procedural (Code Smells)
If procedural code "smells" when it is used in something that could
have been purely object oriented then something needs to be cleaned
up.
But what needs to be cleaned up, what needs to be done?
Maybe we say, "We like this mix."
Maybe we say, "Darn it, let's redesign to something better."
Let's take this a little further. Let's assume that we are trying to
satisfy the idea that all member variables are private. Any thing of
external interest is a public method. This public method represents a
command to "tell" the object to do something. Never are these
commands to be, "tell me the state of some internal member variable".
He is a problem in my mind. I haven't developed a solution yet, too
busy, but here is the problem.
You find yourself at the boundary of the data tier. This data tier is
an SQL database. To perform some query it wants to get the values of
several of the member variables of an instance of some class. But, if
we are true to our rules there is no way to get access to these
values.
class Person
{
private string firstName;
private string lastName;
}
SQL
select * from PersonDB where FirstName = person.firstName and
LastName = person.lastName
We are going from an world to a procedural world. What do we do?
I experience the same "grief" at the boundaries of web services. Web
services are not data is serialized and sent along in the
SAP message. (RMI is more , but I am not working in RMI mode, but
in WebServices mode.)
What is the answer to these situations?
Exactly what you've stated: you're at the boundary between
systems that have very different paradigms. You use a transformation
layer at the boundary. If you're interfacing with a data base, your
transformation layer is a repository; its responsibility is to return the
object(s) you requested, and keep the actual details of querying the
data base and constructing the objects from the returned tables private.
If you're dealing with an XML query from a web services application,
your responder constructs a command object from the XML so the
rest of the application doesn't have to know what the actual format of
the transmission is all about.
John Roth
Geoff
>
>
>
>
>
To Post a message, send it to: extremeprogramming (AT) eGroups (DOT) com
To Unsubscribe, send a blank message to:
extremeprogramming-unsubscribe (AT) eGroups (DOT) com
ad-free courtesy of objectmentor.com
Yahoo! Groups Links
>
>
>
>
>
>
To Post a message, send it to: extremeprogramming (AT) eGroups (DOT) com
To Unsubscribe, send a blank message to: extremeprogramming-unsubscribe (AT) eGroups (DOT) com
ad-free courtesy of objectmentor.com
Yahoo! Groups Links
<*To visit your group on the web, go to:
<*To unsubscribe from this group, send an email to:
extremeprogramming-unsubscribe (AT) yahoogroups (DOT) com
<*Your use of Yahoo! Groups is subject to: