How to learn good software / OO design?
Hi everyone,
Hope you're having a fantastic day. I just finished the book "C# the player's guide" and I've enjoyed it immensely. I'm also getting my MS in CS so I'm a little bit familiar with coding and doing projects. I've been self learning for a couple of years and have taken it seriously for the past 6 months. I'm doing Java projects In uni and use python for leetcode and scripting.
My main weakness/problem right now is that I don't know how to design software. Like when should something be a new class? when should I use a separate file? etc. I start with a vision of how the code should be but I keep facing walls and I need to mutate and rewrite and change the structure which is a huge waste of time and energy.
In short I don't know how to design object oriented software. Are there any books or resources you'd recommend?
I specifically like to do projects (start small and go bigger) and then see the "correct way" or one of the correct ways that a professional would make the same project so that I understand how to do correct OOD with exposure to good code.
Any advice is highly appreciated.
3 Replies
when should something be a new classWhen it's a new "thing". For example, a
Person
and a Car
are two different things, so they should be two different classes. A Person
class should not have CarMake
and CarYear
properties.
when should I use a separate file?One class per file To answer the question in a more generic way... you just figure it out over time, really, until it becomes a second nature Far as projects go, $projects
Collections of application ideas that anyone can solve in any programming language to improve coding skills:
https://github.com/dotnet/dotnet-console-games
https://github.com/karan/Projects
https://github.com/florinpop17/app-ideas
You can always post here or in #code-review if you want to hear people's opinions on your projects
And other people, including myself, will happily tell you what was done wrong and how to do it correctly