Stop Writing Clean Code

preview_player
Показать описание
Do you want FREE code review from an ex-FAANG engineer? Join my Discord!

It's about time we stop holding our code to unrealistic beauty standards.

#cleancode #codereview #faang #softwareengineer #coding #programming #programmer #coder #backenddeveloper #frontenddeveloper #fullstacksoftwareengineering #bugfix
Рекомендации по теме
Комментарии
Автор

One thing that the presentation skimmed over a bit is that I WOULD agree that by the time your feature is "done", you should consider taking some time to clean up your code. I'm specifically trying to emphasize here that not every stage of your development lifecycle needs to produce something picture perfect!

cloudzydev
Автор

Clean code is -> clear logic. Not really about needing a 'clean-up'

mehulahal
Автор

This video also tells you that there is not such thing as a simple feature. If you take anything and think about it enough it will start getting more complex and more difficult as time goes on. Some call it feature creep, I call it productive procrastination.

lbgstzockt
Автор

Clean code to me means that it is fairly modular and have clean interfaces.

That means that when new features eventually pop up you can add them along with some tests for them.
Eventually your code is just too messy to work with. So you delete the entire thing knowing that no-one else depends on the exact implementation. Knowing that you can re-make it from scratch cleaner now that you know requirements that wasn't known the first time around.

Dirty code has weird dependencies. Meaning after you have remade the entire thing someone from the next team over comes asking why their project just stopped working and you notice that they have used your code in ways you did not intend.

timonix
Автор

Here's how I avoid refactoring my code, I just split things off to a new function whenever I need to reuse that thing in another place. I'm not kidding, I rarely refactor my code, all because I don't spend time writing clean code, I instead focus on the code structure that I want. Right now, I actually decided to create a project using typescript, which I've never used before. I'm spending time writing my code in the structure, rather then writing code and thinking, oh, I can split this into a different function.

Actually, I don't usually care about clean code. People say to not write huge functions, but I've done that so many times, because I'm not going to use any of the sections in the function in a separate function. If it's something generic, I put that in it's own function, but usually I don't even bother putting things in seperate functions until I need to use it in a different function. For example, I have a project that has a large function for rendering a measure (it's a metronome app that has the ability to create metronomes for songs, and it shows the measure with the rhythm). The function to render it has many different parts to it, the first one is fixing the parameters, aka, grabbing values from the element when they aren't specified in the function call, then it sets up the measure with the notes, fixes the measure sizing, then finally renders the measure. I have all of that in the single function, because I don't ever use any of the parts outside that function.

ego-lay_atman-bay
Автор

Awesome! Hope you make more of these. It is nice to acutally see code and not just people talking about these things in abstract terms.

I totally agree with you, our intuition is bad. I think that many people spend to much time on crap which might make the code "cleaner" but in the end they end up solving the wrong problem. So because they spent this time on refactoring a bad solution they never get to the real stuff that would have actually made a difference.

jorgpiano
Автор

this video has changed how I code and has really helped now I been able to write sloppy code thats been faster which companies like Google would use less processing power and computers. So thank you.

heliospace
Автор

Keep in mind that creating a function just for setting or getting an variable is still making your computer push addresses to the stack - in order to return from that function - and this will increase the amount of instructions/clocks needed to simple set or get some value from some memory address (if the compiler doesn't help you).

I'd always prefer performance, as long as my code doesn't look minified.

emiclys
Автор

My simple logic is, If I am unable to give a proper simple name for a method/functions that tells what it does, then I am extracting... In a way this translates to single responsibility

prasadkm
Автор

Good demonstration! I wonder how you can prevent the other thing from happening, i.e. your code being so messy that you spend an exorbitant amount of time refactoring when you knew you could have done it earlier and it would have been less effort. Maybe some rule of thumb besides waiting until your code is unbearable to look at?

amuzak
Автор

As with everything in software engineering, it depends.

DavidBadilloMusic
Автор

You could Design the Code before writing it

souleater
Автор

Someone really likes ludwig. Good job on the video man

asdasfdfgewqgrgyjh
Автор

Title: "stop writing clean code". Proceeds writing clean code

kirillberezin
Автор

.. if it works.. don't fix it.
Cleaning Code != Fixing Code.

synju
Автор

Hybrid approach is always a way to go. i.e., code needs to be clean but also performant.

But to achieve that sometimes not writing clean is necessary sacrifice. But as far as the code performance difference are minimal go with clean precise code.


Too much abstraction for writing clean is extremely redundant.

Too much centralization of every single hardcoded value is extremely redundant, unneeded and increases dev time by ten fold.

sanjeevdandin
Автор

I think you have a different problem: Poor code structure and modularization from the get-go. The fact that you're having to "clean up" the code is the problem. But the worst problem of all is that you don't have unit tests that can ensure you didn't mess up when you're refactoring. "Cleaning code" aka, good ole' refactoring, is only really doable within strong test environments, lest you go completely mad

tfrascaroli
Автор

Step 1: write bad code. Step 2: Leave it cause it works and it'll break if i touch it

szymonniemczyk
Автор

i just write bad code first and then i clean it up

callyral
Автор

You're a beast bro!!! I love your content!!😊

enriquemorangarrido