News for hackers. Stuff that matters.
Re:Goodbye, Clean Code (2020) by pelasaco on Tuesday November 16, 2021 @10:30AM (#29241609)
I'm shocked that from all discussion nobody noted the root of all evil:

"It was already late at night (I got carried away). I checked in my refactoring to master and went to bed, proud of how I untangled my colleague’s messy code."

No PR, no code review, no CI. Just a cowboy pushing to the master..

Re:Goodbye, Clean Code (2020) by tcbasche on Tuesday November 16, 2021 @11:19AM (#29242318)
> No PR, no code review, no CI. Just a cowboy pushing to the master..

Let's be clear that the dangers here are "no code review" and "no CI".

The others are fine in most circumstances, unless you work on some huge monolithic codebase.

Smaller cross-functional teams should be able to push to master to solve problems then and there without everyone's unanimous approval, and everyone should feel enough safety to be able to make changes to the codebase they share with their team.

The real "root of all evil" is why is someone working against the team from within the team?

Re:Goodbye, Clean Code (2020) by LandR on Tuesday November 16, 2021 @11:22AM (#29242360)
This is just how some places work, unfortunately.

We all push to main, no code reviews, no CI etc.

Hell, some people here patch things by downloading the live dll, decompile, update code, recompile and stick it back to live...

Re:Goodbye, Clean Code (2020) by benjiweber on Tuesday November 16, 2021 @12:00PM (#29242994)
You realise that everyone pushing changes to main several times a day is the definition of CI? and it's pretty much impossible to do with code review as a gate for pushing to main. Interesting how CI has become semantically diffused to mean literally the opposite of CI: tooling and processes that delay integration and make it easier to work in isolation.

https://wiki.c2.com/?ContinuousIntegration " The most granular unit of integration should be one step of one refactor. "

Re:Goodbye, Clean Code (2020) by 5e92cb50239222b on Tuesday November 16, 2021 @12:16PM (#29243239)
CI is more than that, at least in my understanding of the term. You have to have some sort of automated testing before doing the merge. We were doing the same shit (all pushing to the same branch) and it broke constantly before we introduced some tests and merges only after a successful test run on a separate CI server. Just pushing everything into the main branch without any checks is no CI, even if it technically can be called so.
Re:Goodbye, Clean Code (2020) by CaveTech on Tuesday November 16, 2021 @12:26PM (#29243402)
That's `automated CI` which is now or less interchanged with just `CI`, however at face value there is no requirement that all CI be automated, it is just usually better to do so.
Re:Goodbye, Clean Code (2020) by Jtsummers on Tuesday November 16, 2021 @01:06PM (#29244056)
For anything non-trivial (read: more than around 10-20k SLOC of C or equivalent; straightforward with minimal branching logic; non-critical) you cannot, in any practical sense, have CI without automation. Unless, of course, you want a garbage system. If you do the minimum things necessary to ensure the system is correct (in both verification and validation senses) and of decent quality, and you have no automation, you will not have CI because you will introduce delays between code change and deployment ranging from days (for smaller projects) to weeks or months (for significant projects). That delay means you do not have CI. And it also encourages batching many changes together so that you only have to have one test run (or a small number of test runs) which is also the opposite of CI.

Now, you could bypass all those tests and reviews and just deploy it anyways. And then you'll have a shitty codebase, but you'll have CI so that's good, right?

Re:Goodbye, Clean Code (2020) by CaveTech on Tuesday November 16, 2021 @01:14PM (#29244237)
I'm not advocating for this from an engineering perspective, just stating that it does meet the basis of `CI`, regardless of whether you believe it meets _your_ threshold of "good" CI.
Re:Goodbye, Clean Code (2020) by herval on Tuesday November 16, 2021 @12:14PM (#29243213)
...and getting told by a manager to revert code. The entire environment in the example doesn't sound very healthy
Re:Goodbye, Clean Code (2020) by drclau on Tuesday November 16, 2021 @01:12PM (#29244194)
And... "it was already _late at night_" (emphasis mine). I learned a long time ago that not all hours in a day are created equal.
Re:Goodbye, Clean Code (2020) by gchamonlive on Tuesday November 16, 2021 @10:33AM (#29241649)
And using clean code wrong. Clean code is not a panacea. If people use it as such and without the correct agile rites, they should do it at their own peril, but blaming it on clean code is at the very least naive (and somewhat dishonest)
Re:Goodbye, Clean Code (2020) by sombremesa on Tuesday November 16, 2021 @11:10AM (#29242200)
Personally, I disagree that DRY is the same as “clean”. Clean code is merely code that has been thoughtfully structured (regardless of repetition) and is relatively transparent as to its purpose.
Re:Goodbye, Clean Code (2020) by tcbasche on Tuesday November 16, 2021 @11:20AM (#29242336)
I've seen a few developers see multiple "duplicated" API formats for instance (for different API's) in the same codebase and think those are "duplicated" and then entangle two completely separate API's together. This is worse IMO
Re:Goodbye, Clean Code (2020) by bluGill on Tuesday November 16, 2021 @01:15PM (#29244266)
There is accidental duplication to beware of. That is when different things looks the same. Then there is real duplication.. Only the later is bad and should be eliminated. Telling the differences is hard
Re:Goodbye, Clean Code (2020) by cma on Tuesday November 16, 2021 @01:33PM (#29244560)
I'd rather look at a simple arithmaticl expression and know immediately what is going on, rather than have to make up a hard to remember name for every small expression that happens to get repeated one or more times in the name of DRY. The same applies to small bits of non-arithmatical code.
Re:Goodbye, Clean Code (2020) by dataviz1000 on Tuesday November 16, 2021 @10:49AM (#29241865)
This guy was working at Facebook at the time too.
Re:Goodbye, Clean Code (2020) by ARandomerDude on Tuesday November 16, 2021 @10:51AM (#29241909)
Seems fine then. Move fast and break things.
Re:Goodbye, Clean Code (2020) by rapsacnz on Tuesday November 16, 2021 @11:59AM (#29242969)
Huh, don't you mean Move fast and break society
Re:Goodbye, Clean Code (2020) by postalrat on Tuesday November 16, 2021 @12:17PM (#29243256)
It was reviewed the next day by his boss.

How is pushing to master not a form of CI?

Re:Goodbye, Clean Code (2020) by the_arun on Tuesday November 16, 2021 @12:24PM (#29243364)
> It was reviewed the next day by his boss.

Assuming Master is the "protected branch" and not kitchen sink, this sounds like - "we test only in production". Wouldn't or shouldn't reviews happen before merging to master?

Re:Goodbye, Clean Code (2020) by donatj on Tuesday November 16, 2021 @12:32PM (#29243485)
I was going to downvote you, but then you made me think - everyone pushing to a shared branch is the most continuous form of continuous integration I suppose.

I worked this way for years before we moved into full branched code review. I would never go back however.

That said, you should still have at least some review and automated testing before your code gets in everyone else's way.

Re:Goodbye, Clean Code (2020) by deeviant on Tuesday November 16, 2021 @12:23PM (#29243358)
Likely, it was their coworker who saw the changes, then reported the incident to the manager, rather than some sort of manager picking through every commit type process.