 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
preston Guest
|
Posted: Mon Dec 12, 2005 3:15 pm Post subject: Delphi specific code smells |
|
|
I've been reading "Refactoring to Patterns (Addison-Wesley Signature
Series)", which is a great book BTW.
Anyway, I found the section on smells rather interesting. It's nice to
know these things have names. I was wondering what specific Delphi
smells there are.
What can you think of?
|
|
| Back to top |
|
 |
Joanna Carter [TeamB] Guest
|
Posted: Mon Dec 12, 2005 3:21 pm Post subject: Re: Delphi specific code smells |
|
|
"preston" <oracle (AT) xmission (DOT) com> a écrit dans le message de news:
439d93d4$1 (AT) newsgroups (DOT) borland.com...
| Quote: | Anyway, I found the section on smells rather interesting. It's nice to
know these things have names. I was wondering what specific Delphi
smells there are.
|
Delphi, as a language, of its own, has no smells in terms of patterns. OTOH,
I have seen a great deal of Delphi code written by developers that
absolutely stinks :-)
Joanna
--
Joanna Carter [TeamB]
Consultant Software Engineer
|
|
| Back to top |
|
 |
preston Guest
|
Posted: Mon Dec 12, 2005 3:32 pm Post subject: Re: Delphi specific code smells |
|
|
Joanna Carter [TeamB] wrote:
| Quote: | "preston" <oracle (AT) xmission (DOT) com> a écrit dans le message de news:
439d93d4$1 (AT) newsgroups (DOT) borland.com...
| Anyway, I found the section on smells rather interesting. It's nice to
| know these things have names. I was wondering what specific Delphi
| smells there are.
Delphi, as a language, of its own, has no smells in terms of patterns. OTOH,
I have seen a great deal of Delphi code written by developers that
absolutely stinks :-)
Joanna
|
As an example, I've seen many Delphi apps where 90% of the program is
coded in the event handlers with no object use at all. That's gotta be
something that's unique to Delphi.
|
|
| Back to top |
|
 |
Bart Guest
|
Posted: Mon Dec 12, 2005 3:35 pm Post subject: Re: Delphi specific code smells |
|
|
| Quote: | know these things have names. I was wondering what specific Delphi
smells there are.
|
Jim Cooper published a paper about refactoring.
Bart
|
|
| Back to top |
|
 |
Peter Morris [Droopy eyes Guest
|
Posted: Mon Dec 12, 2005 3:37 pm Post subject: Re: Delphi specific code smells |
|
|
| Quote: | As an example, I've seen many Delphi apps where 90% of the program is
coded in the event handlers with no object use at all. That's gotta be
something that's unique to Delphi.
|
No, VB was exactly the same.
|
|
| Back to top |
|
 |
Joanna Carter [TeamB] Guest
|
Posted: Mon Dec 12, 2005 4:12 pm Post subject: Re: Delphi specific code smells |
|
|
"Peter Morris [Droopy eyes software]" <pete (AT) NO_droopyeyes_SPAM (DOT) com> a écrit
dans le message de news: 439d98eb$1 (AT) newsgroups (DOT) borland.com...
| Quote: | As an example, I've seen many Delphi apps where 90% of the program is
coded in the event handlers with no object use at all. That's gotta be
something that's unique to Delphi.
No, VB was exactly the same.
|
And still is. Even C# allows this style of programming ( The problem is
not the languages, it is the RAD IDE form designers, etc that encourage this
style.
I once went to a company where the "senior" programmer didn't even know what
a parameter was !!! Then you get the time where an application was written
with code in button click event handlers and then the buttons were hidden on
the form because all they were there for was to provide somewhere to put the
code !!???
Joanna
--
Joanna Carter [TeamB]
Consultant Software Engineer
|
|
| Back to top |
|
 |
Iman L Crawford Guest
|
Posted: Mon Dec 12, 2005 4:23 pm Post subject: Re: Delphi specific code smells |
|
|
"Joanna Carter [TeamB]" <joanna (AT) not (DOT) for.spam> wrote in
news:439da147 (AT) newsgroups (DOT) borland.com:
| Quote: | And still is. Even C# allows this style of programming ( The
problem is not the languages, it is the RAD IDE form designers, etc
that encourage this style.
|
IMO, it's because that is the most obvious way to do event driven
programming. I used to see similar bad practices in procedural code. I'm
sure we'll see code just as bad with ECO etc.
--
Iman
|
|
| Back to top |
|
 |
Joanna Carter [TeamB] Guest
|
Posted: Mon Dec 12, 2005 4:42 pm Post subject: Re: Delphi specific code smells |
|
|
"Iman L Crawford" <ilcrawford.at.hotmail.dot.com> a écrit dans le message de
news: Xns972A69A3FE650ilcrwfrd (AT) 207 (DOT) 105.83.66...
| Quote: | IMO, it's because that is the most obvious way to do event driven
programming. I used to see similar bad practices in procedural code. I'm
sure we'll see code just as bad with ECO etc.
|
Sans doute.
Joanna
--
Joanna Carter [TeamB]
Consultant Software Engineer
|
|
| Back to top |
|
 |
Bob Dawson Guest
|
Posted: Mon Dec 12, 2005 5:02 pm Post subject: Re: Delphi specific code smells |
|
|
"Joanna Carter [TeamB]" wrote
| Quote: | because all they were there for was to provide somewhere to put the
code !!???
|
To generalize: any time you see code invoking a user gesture (like calling
MyButton.Click(nil)), that's a big bad smell.
bobD
|
|
| Back to top |
|
 |
Lee_Nover Guest
|
Posted: Mon Dec 12, 2005 5:38 pm Post subject: Re: Delphi specific code smells |
|
|
| Quote: | I once went to a company where the "senior" programmer didn't even know what
a parameter was !!! Then you get the time where an application was written
with code in button click event handlers and then the buttons were hidden on
the form because all they were there for was to provide somewhere to put the
code !!???
|
that's an advanced level
few years back I was supporting a VB project which had hidden editboxes
the logic was coded in the edit's OnChange event .. it used the edit's text as params
now that's a way to shoot yourself in the foot ;)
|
|
| Back to top |
|
 |
Krisztian Pinter Guest
|
Posted: Mon Dec 12, 2005 6:18 pm Post subject: Re: Delphi specific code smells |
|
|
On Mon, 12 Dec 2005 15:21:31 -0000, Joanna Carter [TeamB]
<joanna (AT) not (DOT) for.spam> wrote:
| Quote: | Delphi, as a language, of its own, has no smells in terms of patterns.
OTOH,
|
i'd say, "virtual" keyword stinks as hell. in a true OO environment, every
method
is virtual, or more precisely it can be, if there is an override to it.
the compiler
should decide if indirect call is required or a static call do fine.
i do know that would not be practical in delphi (separate compilation of
units,
existence of runtime packages), but from OO point of view, virtual is a
pain.
|
|
| Back to top |
|
 |
Krisztian Pinter Guest
|
Posted: Mon Dec 12, 2005 6:44 pm Post subject: Re: Delphi specific code smells |
|
|
On Mon, 12 Dec 2005 15:21:31 -0000, Joanna Carter [TeamB]
<joanna (AT) not (DOT) for.spam> wrote:
| Quote: | Delphi, as a language, of its own, has no smells in terms of patterns.
|
plus what about automatic friendship inside a unit? i know, if don't like
don't use.
|
|
| Back to top |
|
 |
Joanna Carter [TeamB] Guest
|
Posted: Mon Dec 12, 2005 6:46 pm Post subject: Re: Delphi specific code smells |
|
|
"Krisztian Pinter" <pinterkr (AT) freemail (DOT) hu> a écrit dans le message de news:
[email]ops1onscpklfy2s0 (AT) catv-d5deb536 (DOT) catv.broadband.hu[/email]...
| Quote: | i'd say, "virtual" keyword stinks as hell. in a true OO environment, every
method
is virtual, or more precisely it can be, if there is an override to it.
the compiler
should decide if indirect call is required or a static call do fine.
i do know that would not be practical in delphi (separate compilation of
units,
existence of runtime packages), but from OO point of view, virtual is a
pain.
|
Well, C# also requires that virtual methods are explicitly declared. Can you
justify your claim that about a "true" OO environment ? What makes such an
environment that insists on static methods being explicitly declared ? I
certainly would not want the compiler to decide whether some idiot developer
could wreck my OO design by allowing them to override a method I had
intended to be static or sealed.
Joanna
--
Joanna Carter [TeamB]
Consultant Software Engineer
|
|
| Back to top |
|
 |
Wayne Niddery [TeamB] Guest
|
Posted: Mon Dec 12, 2005 6:49 pm Post subject: Re: Delphi specific code smells |
|
|
Joanna Carter [TeamB] wrote:
| Quote: |
Delphi, as a language, of its own, has no smells in terms of
patterns. OTOH, I have seen a great deal of Delphi code written by
developers that absolutely stinks
|
:)
--
Wayne Niddery - Logic Fundamentals, Inc. (www.logicfundamentals.com)
RADBooks: http://www.logicfundamentals.com/RADBooks.html
"Nature abhors the vacuum tube." - J.R. Pierce, Bell Labs engineer who
coined the term 'transistor'
|
|
| Back to top |
|
 |
Wayne Niddery [TeamB] Guest
|
Posted: Mon Dec 12, 2005 6:51 pm Post subject: Re: Delphi specific code smells |
|
|
Joanna Carter [TeamB] wrote:
| Quote: | Then you get the time where an
application was written with code in button click event handlers and
then the buttons were hidden on the form because all they were there
for was to provide somewhere to put the code !!???
|
Whole forms get used exactly the same way - never shown, some even with
controls such as TMemos to hold text instead of using a stringlist.
--
Wayne Niddery - Logic Fundamentals, Inc. (www.logicfundamentals.com)
RADBooks: http://www.logicfundamentals.com/RADBooks.html
"The moment the idea is admitted into society that property is not as
sacred as the laws of God and there is not a force of law and public
justice to protect it, anarchy and tyranny commence." - John Adams
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|