collapseos icon indicating copy to clipboard operation
collapseos copied to clipboard

Ensure code readability

Open hsoft opened this issue 4 years ago • 2 comments

I took the habit of profusely commenting Collapse OS' code because "grokkability" is one of the project's top priority.

When I read the code of more traditional applications (for example, TinyBasic), I see that there are many comments, but they're much more terse than mine. I find that I have a really hard time understanding that code.

Of course, the code in those apps is generally more "clever" than mine (creative code reuse tactics), so it's hard to compare (they might be harder to understand only because they're more clever), but still, I'm under the impression that Collapse OS' code is much clearer than most other assembly code I read.

But my point of view isn't objective because that's my own code, of course I understand it better.

That's why I'm asking around. Newcomers to the code, how understandable is Collapse OS' code to you and do you think there are things we could to to improve readability further?

hsoft avatar Nov 19 '19 15:11 hsoft

I avoid looking too much at your awesome code to prevent some brutal copy of your nice features in my own system (schematic soon, working on it!), but just looking at one of your last commit ( https://github.com/hsoft/collapseos/commit/019d05f64c34dce9190b1aa3a624d614307bce3e ) it seems to me that your comments are really understandable and describe the operations very well.

Seriously, collapseos features an design are great. This looks like a mini unix with an extremely nice modular structure. I started with a HC11 but I'm starting to wonder if this chip has too few registers. the Z80 is really great and I will definitely build a collapseOS Z80 system when I'm done with HC11.

I just wonder if that is not an issue for self hosting :) Too many comments may use too many source code storage :)

f4grx avatar Nov 19 '19 16:11 f4grx

Z80 is really great

I wholeheartedly agree! With tendencies to write everything in higher level languages, or for multiple architectures (for example, targeting 8080 instead of z80, because, why target z80 when we can have both z80 and 8080?) make us forget that some architectures, such as the z80, make hand-written assembly much easier. I only have experience in AVR (which has even more registers) and Z80, but when I look at registers for other legacy 8-bit architecture, this lack of registers make me think that I'd have to do a lot more RAM management if I had to rewrite Collapse OS in it.

And this, with 9000 transistors...

hsoft avatar Nov 19 '19 16:11 hsoft