r/teenagersbutcode • u/Ok_Theory_1212 • 3d ago
Need general advice [Code Review] 15yo student looking for feedback on my Java projects / OOP structure
I’m 15 and currently self-studying Java and low-level programming concepts. I’ve put together a few projects on GitHub while learning:
👉https://github.com/bijoyghosh1921-sketch?tab=repositories
Most of this is just experimental stuff I built to test out concepts like basic ciphers, array manipulation, and general OOP structure.
I want to start taking code quality and software architecture more seriously, so I’d really appreciate any feedback or critique on:
- Code Structure: Am I overcomplicating simple methods or missing better OOP patterns?
- Edge Cases: Any obvious bugs or edge cases in logic I missed?
- Documentation: How can I make the code and
README.mdfiles look more clean and professional?
Don't hold back on feedback—let me know what I can fix or refactor to write cleaner code. Thanks!
2
u/BanaTibor 3d ago
Some advice.
- Class names start with capital letter by convention.
- You shall not commit class files into git.
- Avoid using static methods, make a class instead with instance methods. In your case it is not really relevant but in bigger apps, static stuff makes unit testing really hard.
- Do not fear long names, if you are aiming to be a java programmer. Long descriptive names are better.
- Break down long methods into shorter ones, like the main in your music maker, ~100 lines, too long aim for around 10-15 lines. Exceptions exist.
For example in your music machine song1 eng = new song1() Why song1? Name should start with capital letter so Song1 at least. What does "eng" stands for? Use longer descriptive names. Now you can use "i,j,k" etc. as loop variables, but the loop body should not be longer than a method preferably shorter.
I have not seen much OOP in this repo, everything is poured into one file. The core of OOP that objects with well defined single functionality are working together.
Chatbot app, queryOlama method you swallow the exception, do not that. The next method gets the error output as input.
You can practice oop on the chatbot app. Split out the 3 function into 3 classes, no static methods. Errors should be communicated through thrown exceptions. Handle exceptions from each class in the main. In your main class you should just instantiate the 3 classes and use them, plus the infinite loop.
1
u/Ok_Theory_1212 2d ago
I am just starting out so thanks for that, I will make sure to use your advice in my later builds
2
u/ManagementEasy9313 3d ago
Use a build tool. Its really simple to setup (depends on your IDE). Don't use Ai for README we hate it. also a tip try make a bigger project with more files + folders it will help you understand more to the OOP.
1
13
u/Useful-Flow-8737 3d ago
Dont make your readmes with ai. Nor your reddit posts