[a / b / c / d / e / f / g / gif / h / hr / k / m / o / p / r / s / t / u / v / vg / vm / vmg / vr / vrpg / vst / w / wg] [i / ic] [r9k / s4s / vip] [cm / hm / lgbt / y] [3 / aco / adv / an / bant / biz / cgl / ck / co / diy / fa / fit / gd / hc / his / int / jp / lit / mlp / mu / n / news / out / po / pol / pw / qst / sci / soc / sp / tg / toy / trv / tv / vp / vt / wsg / wsr / x / xs] [Settings] [Search] [Mobile] [Home]
Board
Settings Mobile Home
/g/ - Technology


Thread archived.
You cannot reply anymore.


[Advertise on 4chan]


This post is NOT about design patterns, not about any programming language in specific, hell, probably not even about programming, but about project structures. I was scouting the Plan 9's source code and i saw how the codebase was structured and it was glorious. Everything very organized, very easy to read and well integrated. At some point i came across this mkfile from acme.
</$objtype/mkfile
BIN=/$objtype/bin

TARG=acme

OFILES=\
acme.$O\
addr.$O\
buff.$O\
cols.$O\
disk.$O\
ecmd.$O\
edit.$O\
elog.$O\
exec.$O\
file.$O\
fsys.$O\
logf.$O\
look.$O\
regx.$O\
rows.$O\
scrl.$O\
text.$O\
time.$O\
util.$O\
wind.$O\
xfid.$O\

HFILES=dat.h\
edit.h\
fns.h\

</sys/src/cmd/mkone

$O.out: /$objtype/lib/libframe.a /$objtype/lib/libdraw.a /$objtype/lib/libthread.a

edit.$O ecmd.$O elog.$O: edit.h

syms:V:
$CC -a acme.c > syms
for(i in ????.c) $CC -aa $i >> syms

And this mkfile has lots of references to the operating system itself and more specifically the /sys/src/cmd/mkone made me wonder if we are doing our codebases wrong. It's going to be weird, but we have to split our projects into different repositories? Instead of thinking on different software, shouldn't we be writing, lets say "our OS", based on some other OS containing our stuff, so we can reuse parts we already done before? And what about other things, like "/usr/share" for non-code resources and documentation we already worked on? Are we using computers wrong?
>>
>>106781203
>but we have to split our projects into different repositories? Instead of thinking on different software, shouldn't we be writing, lets say "our OS", based on some other OS containing our stuff
I'd say this is something to think about when you are getting to around 10 different custom binaries that work together. the application structure would pretty much be the same but for packaging it would have to switch to some sort of launcher to curl the necessary shared libraries
>>
>>106781319
The problem here is "reuse". How do you reuse code that was written for a different project? You split the package into a different repo and mark it as a dependency? Or you make one giant repo containing all the libraries you need already on the repo? What about versioning of these packages?
>>
>>106781203
>plan 9's source code
>how the codebase was structured
>glorious
>>
File: 1756461126505780.jpg (152 KB, 1600x900)
152 KB
152 KB JPG
>>106781203
>http://9p.io/sources/plan9/sys/src/libc/fmt/fprint.c
Yeah dude. Glorious dude. Just putting some small functions in a separate file will make your code more "structured" and navigable.
>>
>>106781524
https://git.musl-libc.org/cgit/musl/tree/src/malloc/realloc.c

That's literally how a libc is usually organized. You have to remember that C is not a front-end lang for a complete software but to the object code, and then you take an linker and use that object code to build a software. You can implement an interface (the header) in many file as you want, even with just one function per file.
>>
File: 1759322745946314.jpg (205 KB, 850x1277)
205 KB
205 KB JPG
>>106781203
>It's going to be weird, but we have to split our projects into different repositories? Instead of thinking on different software, shouldn't we be writing, lets say "our OS", based on some other OS containing our stuff, so we can reuse parts we already done before? And what about other things, like "/usr/share" for non-code resources and documentation we already worked on?
I did essentially this (mirroring the requisite FHS directory structure) and found it was useful for adding custom profiling and string pools across projects, but there wasn't much reuse/sharing besides that
>>
>>106781634
That is how retards organice code. Nobody mandates that, even if you have can have multiple objects files and myriad of code units there's no point of doing it, you are just segregating your code and making it harder to maintain. My allocator is like a single 10k - 12k lines file plus a header file, and the code is all in one place.
>>
>>106781874
retard alert
>>
File: videoframe_34737.png (147 KB, 320x240)
147 KB
147 KB PNG
I think the real deal here is *install* those packages. Make your $HOME mirror the /usr, have a $HOME/{lib,include} and in the $HOME/src you have multiple repos instead of just one. Every package becomes a library that you install locally on $HOME/lib and $HOME/include. For non-code resources, you put them on $HOME/share.
>>
>>106781203
Didn't read but
>Are we using computers wrong?
Yeah. And project/os architecture is faggot.



[Advertise on 4chan]

Delete Post: [File Only] Style:
[Disable Mobile View / Use Desktop Site]

[Enable Mobile View / Use Mobile Site]

All trademarks and copyrights on this page are owned by their respective parties. Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.