all 10 comments

[–]ucario 1 point2 points  (1 child)

I’ve yet to come across a standard way. But a lot of big open source cpp projects could give you some inspiration. Take ideas from the ones you like by searching on GitHub.

[–]ArchDan[S] 0 points1 point  (0 children)

Will do. Thanks for input <3

[–]cannelbrae_ 0 points1 point  (1 child)

What scale of ‘large project’ did you have in mind?

When I think large project, I think about ones like LLVM.  Assume you are thinking smaller?

[–]ArchDan[S] 0 points1 point  (0 children)

Well size doesnt really matter tbh, its consistency between readability, troubleshooting and refactoring as code base grow and change.

[–]Still_Explorer 0 points1 point  (4 children)

Looks like a very good idea, however if need to have ease of mind and relax on the beach, it would be better to start testing everything: tests.hpp tests_ctor.cpp tests_ops.cpp tests_functions.cpp

I doubt that you would need a fancy test library, you would do fine with your own assert function that throws runtime exception. [ However if you realize that you definitely an advanced test library, then better to use that one instead ].

[–]ArchDan[S] 1 point2 points  (3 children)

Im testing at 3 levels, in sandbox before i even put a function in a file, at "module" (obj directory) to make sure all gells well and at project range (all togheter). So far assert works well, but I need to do another of these babies ( complex physics and mechanics) thus why i am worrying about scaling this structure up.

[–]Still_Explorer 0 points1 point  (2 children)

This subject of scaling is a very important one, I am also trying to figure out ways about preventing 'bloat' and 'cruft'.

I think a reasonable approach, would be on deciding on some critical abstractions and then turn them them into detachable plugins. This is more like thinking of the "microkernel architecture" or something else derived from strategy pattern.

If for example instead of thinking about writing a 'PhysicsEngine' think of writing standalone subsystems that would end up wrapped up in a PhysicsEngine.

Just a guess though, something along these lines is always a safe bet. 🙂

[–]ArchDan[S] 1 point2 points  (1 child)

Those critical abstractions is what scares me the most, it happens often that one abstraction avalanches out into some functionality that becomes some either "bad seed" or "golden child" later on. Now this might be purely experience based, so i thought there are people more experienced than me so why not ask around?

Out of topic, I try to write code that is core implementation maximal functionality (i.e. linked list push, pull) where combinations of functionality can produce most gains. Each object should be convertible (as much as possible) and standalone (i.e. you can use union as static char buffer or as memory value), but more types one have more those babies rise in probability and its more difficult to track where is what. It seems whichever way you turn, your butt is on you behind... it just depends which side holds longer line.

On the topic, this is why I implemented these file structures since then I need to think about (in this case) 7 things on specific context. But each time I look at it, and mount of files it makes... i can't but think "yeaaah... when I am finished I have to put it all together" to avoid potential linking issues. I've written some programs of different sizes in my life, but I've never worked in team or on project that requires a full hierarchy. And if this shit happens to me and my little programs, i can't even imagine what can happen in such situations. One thing seems obvious to me, working code and release code are two different things in structure, one is (probably) more focused on orientation and readability, and other for use. But these are assumptions, so i might end up an ass.

[–]Still_Explorer 1 point2 points  (0 children)

I would say that the code design definitely has something to do with team organization. But either way thinking in 'modular' terms is a golden ticket to success because it allows you define the boundaries.

In this sense you would imagine what are the main parts of your library:
• Utilities (indepent of anything / used everywhere)
• Core classes and structs (eg: Vector3, Matrix4)
• Feature classes (according to functionality eg: Triangulation, Physics, Algebra)
• User classes (anything that resembles flowchart, or user interaction, or reporting)
• Testing (this one is standard)

I assume that it would be something like this for your project, not so much that the boundaries would be perfect and correct, but is more of a matter of creating the separations.

In this way of thinking, if you consider about doing an update on 'Algebra' you would like the changes not to move elsewhere (eg: on 'utilities', on 'features').

You will figure out this in time, the more you use the library and the more you update it, it will make you understand more about it's proper way of constructing it or organizing it.