[Tutor] get name of calling class at runtime

Kent Johnson kent37 at tds.net
Sat Aug 22 03:25:21 CEST 2009


On Fri, Aug 21, 2009 at 6:58 PM, Alan Gauld<alan.gauld at btinternet.com> wrote:
> "Serdar Tumgoren" <zstumgoren at gmail.com> wrote
>
>> I'm trying to create a data-retriever class that executes certain SQL
>> statements based on the name of a calling class
>
> This is a really bad "smell" from an OO design point of view.
>
>> can group a bunch of SQL statements in one place; they're currently
>> scattered all over the program and it's getting unwieldy).
>
> Normally in an OO program the SQL for each class is in the methods for that
> class. That way any changes to the class canbe easily reflected in the
> related SQL.

But if all the classes need nearly the same SQL, it may make sense to
abstract that out to a common location.That is what Serdar is trying
to do. Duplication is also a bad smell.

Kent


More information about the Tutor mailing list