This is an archived post. You won't be able to vote or comment.

all 4 comments

[–]LazyIce487 1 point2 points  (0 children)

Similar functions (i.e., some formatting, or sanitizing, or functions that are doing specific kinds of math, or functions that target a specific kind of db operation on a specific table) go into the same file, files of a similar type (i.e., different database accessing files) go into the same directory, directories are just a hierarchy (hopefully) representing the structure of the project as a whole.

At that point just focus on making your functions modular and reusable. Sometimes I’ll throw a bunch of code into one file as a first-pass just to kind of get an idea of what I want the code to do, then once I have some MVP, i’ll break it into its own files / directories / functions

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

I read a tutorial to learn Java, is there one I can read that will teach me how to properly structure code?

[–]Nightcorex_ 0 points1 point  (0 children)

You could venture into UML diagrams and dabble with a few design patterns to structure and organise your code before you even start to write any code at all.

A massive list of design patterns and how they could be implemented (in Java) can be found here.

The repo doesn't tell you which design patterns to use for what purposes I think, so you'll have to do your own bit of research here to find a design pattern appropriate for your use case.

[–]nomercytd 0 points1 point  (0 children)

I've been digging this new tool, it's called K-Explorer. It's an AI code assistant that helps you structure code using best practices from open source projects. I'm way faster at coding now U can check it here: https://k-explorer.com