BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Delphi specific code smells
Goto page 1, 2, 3, 4, 5, 6, 7, 8, 9, 10  Next
 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi OO design
View previous topic :: View next topic  
Author Message
preston
Guest





PostPosted: Mon Dec 12, 2005 3:15 pm    Post subject: Delphi specific code smells Reply with quote



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





PostPosted: Mon Dec 12, 2005 3:21 pm    Post subject: Re: Delphi specific code smells Reply with quote



"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





PostPosted: Mon Dec 12, 2005 3:32 pm    Post subject: Re: Delphi specific code smells Reply with quote



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





PostPosted: Mon Dec 12, 2005 3:35 pm    Post subject: Re: Delphi specific code smells Reply with quote

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





PostPosted: Mon Dec 12, 2005 3:37 pm    Post subject: Re: Delphi specific code smells Reply with quote

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





PostPosted: Mon Dec 12, 2005 4:12 pm    Post subject: Re: Delphi specific code smells Reply with quote

"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 Sad( 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





PostPosted: Mon Dec 12, 2005 4:23 pm    Post subject: Re: Delphi specific code smells Reply with quote

"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 Sad( 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





PostPosted: Mon Dec 12, 2005 4:42 pm    Post subject: Re: Delphi specific code smells Reply with quote

"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





PostPosted: Mon Dec 12, 2005 5:02 pm    Post subject: Re: Delphi specific code smells Reply with quote

"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





PostPosted: Mon Dec 12, 2005 5:38 pm    Post subject: Re: Delphi specific code smells Reply with quote

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 Smile
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 Smile
now that's a way to shoot yourself in the foot ;)

Back to top
Krisztian Pinter
Guest





PostPosted: Mon Dec 12, 2005 6:18 pm    Post subject: Re: Delphi specific code smells Reply with quote

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





PostPosted: Mon Dec 12, 2005 6:44 pm    Post subject: Re: Delphi specific code smells Reply with quote

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





PostPosted: Mon Dec 12, 2005 6:46 pm    Post subject: Re: Delphi specific code smells Reply with quote

"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





PostPosted: Mon Dec 12, 2005 6:49 pm    Post subject: Re: Delphi specific code smells Reply with quote

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 Smile

:)

--
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





PostPosted: Mon Dec 12, 2005 6:51 pm    Post subject: Re: Delphi specific code smells Reply with quote

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
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi OO design All times are GMT
Goto page 1, 2, 3, 4, 5, 6, 7, 8, 9, 10  Next
Page 1 of 10

 
Jump to:  
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


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.