Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

What is clean code?

62 views
Skip to first unread message

Real Troll

unread,
Jan 20, 2019, 12:26:32 AM1/20/19
to

Chris M. Thomasson

unread,
Jan 20, 2019, 12:30:28 AM1/20/19
to
On 1/19/2019 9:30 PM, Real Troll wrote:
>
> <https://www.cs.helsinki.fi/u/luontola/tdd-2009/kalvot/02-Code-Quality.pdf>
>
>

Have you ever seen code so bad that you wanted to print it out, then
clean something up with the result?

Real Troll

unread,
Jan 20, 2019, 12:44:39 AM1/20/19
to
No but I have seen something happening like this when communication is a
serious problem:

<http://projectcartoon.com/cartoon/46980>


Vir Campestris

unread,
Jan 20, 2019, 4:56:31 PM1/20/19
to
On 20/01/2019 05:30, Real Troll wrote:
>
> <https://www.cs.helsinki.fi/u/luontola/tdd-2009/kalvot/02-Code-Quality.pdf>
>
>
"No lower-case L or upper-case o, ever. int elapsedTimeInDays;"

Oh look, a lower case L.

"camel case hard to read"

While I appreciate his efforts - and largely agree with them - he could
at least be self consistent.

Incidentally the bugs I've had over the years that have been hardest to
track down are those that are not amenable to testing. Things like race
conditions, uninitialised data, and wild pointers.

Andy

Josef Moellers

unread,
Jan 21, 2019, 3:24:18 AM1/21/19
to
On 20.01.19 22:56, Vir Campestris wrote:
> On 20/01/2019 05:30, Real Troll wrote:
>>
>> <https://www.cs.helsinki.fi/u/luontola/tdd-2009/kalvot/02-Code-Quality.pdf>
>>
>>
>>
> "No lower-case L or upper-case o, ever.      int elapsedTimeInDays;"
>
> Oh look, a lower case L.

Yes ... as an example this is very valid!

I read this as "elapsedTimeInDays is bad, daysSinceCreation or
daysSinceModification or fileAgeInDays would be better".
(S)He could have made this more clear, though.

But you're right with the CamelCase complaint.

Josef

Thiago Adams

unread,
Jan 21, 2019, 6:40:11 AM1/21/19
to
On Sunday, January 20, 2019 at 3:26:32 AM UTC-2, Real Troll wrote:
> <https://www.cs.helsinki.fi/u/luontola/tdd-2009/kalvot/02-Code-Quality.pdf>

My answer for "what is clean code?" is :

Code where bugs find difficulties to hide themselves.

Generally this is associated with fast recognition about
what the code does and how.

Scott Lurndal

unread,
Jan 21, 2019, 11:45:45 AM1/21/19
to
Josef Moellers <josef.m...@invalid.invalid> writes:
>On 20.01.19 22:56, Vir Campestris wrote:
>> On 20/01/2019 05:30, Real Troll wrote:
>>>
>>> <https://www.cs.helsinki.fi/u/luontola/tdd-2009/kalvot/02-Code-Quality.pdf>
>>>
>>>
>>>
>> "No lower-case L or upper-case o, ever.      int elapsedTimeInDays;"
>>
>> Oh look, a lower case L.
>
>Yes ... as an example this is very valid!
>
>I read this as "elapsedTimeInDays is bad, daysSinceCreation or
>daysSinceModification or fileAgeInDays would be better".
>(S)He could have made this more clear, though.

struct stat's st_atime, st_ctime, st_mtime seem clear enough to me...

Josef Moellers

unread,
Jan 22, 2019, 2:42:37 AM1/22/19
to
On 21.01.19 17:45, Scott Lurndal wrote:
> Josef Moellers <josef.m...@invalid.invalid> writes:
>> On 20.01.19 22:56, Vir Campestris wrote:
>>> On 20/01/2019 05:30, Real Troll wrote:
>>>>
>>>> <https://www.cs.helsinki.fi/u/luontola/tdd-2009/kalvot/02-Code-Quality.pdf>
>>>>
>>>>
>>>>
>>> "No lower-case L or upper-case o, ever.      int elapsedTimeInDays;"
>>>
>>> Oh look, a lower case L.
>>
>> Yes ... as an example this is very valid!
>>
>> I read this as "elapsedTimeInDays is bad, daysSinceCreation or
>> daysSinceModification or fileAgeInDays would be better".
>> (S)He could have made this more clear, though.
>
> struct stat's st_atime, st_ctime, st_mtime seem clear enough to me...
>
???

I was referring to page 5.
There the author has a bullet "No lower-case L or upper-case o, ever."
and to the right of this four closely spaced variable/field
declarations, the first of which has a lower-case l.

At first glance, I had taken this as a counter-example, as the
lower-case l really resembles the upper-case I.

But looking more closely at this page, it really looks like the author
wants to replace the "int d" by one of the four declarations to the
right of the arrow the first one of them declares the variable/field
with the lower-case l!

If the author ever reads this: pdf pages are virtually free, so are
PowePoint or Libre Office Presenter slides! Please don't try to cram as
much as possible onto a single page, it confuses more than it helps.

Josef
0 new messages