Examples of bad code

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Examples of bad code

Oleksandr Zaitsev
Hello,

Do you know of some good examples of code that is unreadable because of the bad and inconsistent naming?
I want to show some motivating example in my thesis about the aspects of software naturalness through the generation of identifier names.

I'm sure that Pharo has many bad code inside, but this has to be something

1. From the real project written by experienced developers or a nice community (not some toy example or a code of bad developers)
2. With identifier names so bad that 2-3 chunks of code are enough to demonstrate how incomprehensible this code is.

I need it to prove the point that

1. Bad naming can really harm the readability
2. Bad naming is not just a result of carelessness and lack of experience. Bad names often appear in successful projects and are introduced by experienced developers as a result of software evolution (many people write and rewrite the same code many times introducing inconsistencies and failing to understand each other's intentions and different parts of the system).

Do you know some good examples of bad code from PolyMath, Seaside, Moose etc.?

Oleks
Reply | Threaded
Open this post in threaded view
|

Re: Examples of bad code

webwarrior
In old Pharo code (Morphic, etc.) there's a lot of wierd stuff.

My favourite is DockingBarMorph>>#predominantDockingBarsOfChastes:

Though it explains what "predominant" means in a long comment, it's
absolutely unclear what the heck "chaste" is.



--
Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html

Reply | Threaded
Open this post in threaded view
|

Re: Examples of bad code

Peter Uhnak
Not necessarily unreadable, but I always find the UIManager & co. very confusing. There's a very recent discussion on part of it hereĀ http://forum.world.st/Streams-and-FileDialog-in-Pharo-6-and-7-td5084352.html

And the combinations and variations of arguments is also a messĀ https://gist.github.com/peteruhnak/8ac6667b8eb11daee71517d0172b7355 ... question:title:, confirm:label:, edit:label: ... and the code is also a mess with respect to default values.

If you want unreadable code, then look at SpecInterpreter which is responsible for building all Spec ui... 139 lines of code and so far I've probably spent an hour per every five lines of code trying to comprehensively understand this...

Peter

On Mon, Nov 12, 2018 at 5:34 PM webwarrior <[hidden email]> wrote:
In old Pharo code (Morphic, etc.) there's a lot of wierd stuff.

My favourite is DockingBarMorph>>#predominantDockingBarsOfChastes:

Though it explains what "predominant" means in a long comment, it's
absolutely unclear what the heck "chaste" is.



--
Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html