magic_lobster_party

joined 5 months ago
[–] magic_lobster_party@kbin.run 37 points 2 weeks ago (2 children)

It's generally considered a fact that Linux, along with many other open-source software projects, are more efficient than their propriety closed-source counterparts

This is not necessarily true. Linux had trouble with Nvidia Optimus, which is a GPU technology that seamlessly switches between power modes. Well, that is if it works properly, which it didn’t for Linux. I haven’t heard it in a while, so I assume it’s not a problem now anymore.

But it was a big problem where Linux laptops drained batteries much faster because they were using the GPUs at max capacity at all times.

What I’m saying is that the efficiency of Linux depends on access to hardware features, and that might depend on the vendors of the drivers.

Also, like it or not, if there’s one thing I envy about Mac is its power efficiency. They usually last really long on one charge.

[–] magic_lobster_party@kbin.run 5 points 2 weeks ago

His idea is that it’s faster to read that short string once you learn how to read it. But then you need to learn how to read it.

In my experience, every time I thought of something clever like this, I’ll almost always regret it a month later when I revisit the code.

[–] magic_lobster_party@kbin.run 23 points 2 weeks ago (2 children)

New code is O(n log n), but the time benefits only kicks in when n is above 1 trillion. Otherwise it’s much slower.

[–] magic_lobster_party@kbin.run 10 points 2 weeks ago (1 children)

I almost pulled my hair out when I read that section. One is super obvious without any prior experience with the code. The other is an obscure abomination only he can understand. He’s obviously super proud of his abomination and thinks it’s a prime example of “clean code”.

[–] magic_lobster_party@kbin.run 6 points 2 weeks ago (10 children)

Imo, if a method require the caller to do error handling, then that should be part of the return value. For example, use optional or either. Exceptions shouldn’t be part of any expected control flow (like file not found). Exceptions is an emergency panic button.

[–] magic_lobster_party@kbin.run 11 points 2 weeks ago (1 children)

Yeah, that’s an argument of semantics. I agree with you.

What I believe is that functions should do exactly what they advertise. If they do the things they’re supposed to do, but also do other things they’re not supposed to do, then they’re not minimal.

But I feel like Uncle Bob is leaning more towards that if a task requires 100 different operations, then that should be split into 100 different functions. One operation is one thing. Maybe not exactly, but that’s kind of vibes I get from his examples.

[–] magic_lobster_party@kbin.run 16 points 2 weeks ago (7 children)

why comments shouldn't explain how the code works

I categorize this as one of the better points of the book.

functions should do one thing

I kinda disagree with him on this point. I wouldn’t necessarily limit to one thing, but I think functions should preferably be minimal.

Throughout his examples he’s also using ideas like how functions should only be 3 lines long, preferably have no arguments, and also no return values.

This style of coding leads to programs that are nightmarish to work with. The relevant code you’re looking for might be 10 layers deep of function calls, but you don’t know where. You’re just jumping between functions that does barely nothing until you find the thing you’re looking for, and then you need to figure out how everything is connected together.

I prefer when things are flatter. This generally leads to more maintainable code as it’s immediately obvious what the code is doing and how everything is connected.

I think his book is the equivalent of a cleaning guide where all the steps are just to sweep all the mess under the carpet. It looks cleaner, but it’s not clean.

[–] magic_lobster_party@kbin.run 65 points 2 weeks ago (31 children)

I genuinely think his book is rubbish. I agree with some of his points. Most of the good points are common sense. For the most part I heavily disagree with the book.

Throughout the book he has examples of programs where he shows before and after he applies “clean code”, and in almost all examples it was better how it was before.

I can write a lot about why I don’t like his book. He doesn’t make many compelling arguments. It’s mostly based on what he feels is good. He often contradicts himself as well. If I remember correctly, he has a section about how side effects are bad. I agree with him on this part. Shortly after, he proudly shows an example of “clean” program - and it’s littered with awful side effects!

He also has this weird obsession of hiding the logic of the program. As a programmer, I want all relevant logic of a method to be neatly collected in one place - not scattered around deeply nested method calls.

I can go on and on. I hate this book with a passion.

[–] magic_lobster_party@kbin.run 17 points 2 weeks ago (12 children)

For example, in Swift, if you declare a function to throw an exception, then by God every call to that function, all the way up the stack, must be adorned with a do-try block, or a try!, or a try?

I agree with him on this point. Sounds similar to how it’s in Java, and I hate it. I always wrap my exceptions in a RuntimeExceptions because of this.

I disagree with him the rest of the post. The job of the programmer is to communicate the intent of the program. Both for others and for yourself. The language provides the tools to do so. If a value is intended to be nullable, then I would like to communicate this intent. I think it’s good when a language provides this tool.

Tests don’t communicate the intent of the code. Tests can’t perfectly validate all the possible edge cases of the system either.

[–] magic_lobster_party@kbin.run 4 points 2 weeks ago

He realized he couldn’t polish a turd.

[–] magic_lobster_party@kbin.run 54 points 2 weeks ago (1 children)

Better than sex

  • the most genius comedian of all time
[–] magic_lobster_party@kbin.run 4 points 2 weeks ago

Drag queens in the opening ceremony

view more: ‹ prev next ›