Remix.run Logo
pveierland 5 months ago

Considering the extremes of prolific developers gives interesting contrast to dogmas such as "functions/files should never be above x lines", where `quickjs.c` is 50k lines and has functions that are hundreds of lines long:

https://github.com/bellard/quickjs/blob/master/quickjs.c

(Obviously different approaches suits different circumstances.)

lifthrasiir 5 months ago | parent | next [-]

The answer is simple: Bellard can recall all 50K lines of context, while most can't. I too happen to have a larger working memory and only later realized that my threshold for files and functions is way higher than most others. The dogma is only required when the file is to be read and written by multiple people.

saghul 5 months ago | parent | prev | next [-]

I work on that codebase (we forked it off to QuickJS-ng) and while daunting at first, it's somewhat easy to work with, with the right editor! Many of them choke on such a large file, alas.

While it being a very large file, it's sorted somewhat semantically, so it's easy to work on adding a new iterator method, for example, since they are all close to each other.

wiseowise 5 months ago | parent | prev | next [-]

Because people you’re working with are not Fabrice. It is easier to say “don’t do X at all” than explain when it is safe to break the rule.

Also, this would depend on language of choice. JVM, for example, might not inline function above certain threshold of bytecode instructions.

worewood 5 months ago | parent | prev | next [-]

Case in point: .NET's garbage collector which is a single 54k loc C++ file.

larschdk 5 months ago | parent | prev | next [-]

Rather one long function than does one thing well than multiple function that are strongly coupled and difficult to reason about. Programmers who apply dogmas can be harmful.

txdv 5 months ago | parent | prev | next [-]

I think this person creates these marvels entirely by himself. There is no need for collaboration rules.

klarko 5 months ago | parent | prev [-]

In the age of advanced IDEs/text editors with goto definition, find references/usage, fuzzy search, etc, what is even the point of multiple files?

I never navigate by files in my code bases, it's all based on search and "jump to" type navigation.