Hacker News new | ask | show | jobs
by _gabe_ 1156 days ago
Does the `main()` function in GCC only do one thing? It compiles a program, that's one thing right? Alright, have fun writing an entire compiler in one function.

Besides, Bob Martin even mentions this in his book "Clean Code". Page 35:

> The problem with this statement is that it's hard to know what "one thing" is...

He finally concludes that a function is only doing one thing if:

> you can extract another function from it with a name that's not merely a restatement of its implementation.

Which is just dumb. Let's call our function `compileCProgram()`, well according to the second heuristic this is only doing one thing. Anyways, if even the guy who wrote the book about clean code admits that it hard to figure out what one thing is, I'm inclined to say you may be slightly disingenuous here.