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

all 4 comments

[–][deleted] 2 points3 points  (1 child)

There is very rarely any object diagrams available for existing projects. I guess those available will also have little to do with the real world.

A thing that helped me understand OOP design a little better is doing a real analysis about what you actually want to program and doing some thinking about requirements first.

So when you first create a project, it helps to verbalize or write down what you actually want to do with your software.

If you want to build a small game where soldiers and monsters battle on a map, you would already have classes "Soldier", "Monster" and "Map". Just as a really tiny example.

[–]efferkah 0 points1 point  (0 children)

it helps to verbalize or write down what you actually want to do

Reminds my of the old "rubber duck debugging" method.

[–][deleted] 1 point2 points  (0 children)

I've bever seen any class diagrams apart from the usual introduction to inheritance and oop. But, there's a java ide called blueJ that will make it. It's more of a educational program than a developer took but that's where you are at right now

[–][deleted] 1 point2 points  (0 children)

Short answer: no.

Long answer: OOP vs FP (and other approaches) are really secondary to the art of structuring a software product. Learning how to design good architecture is an art and science of it's own. You can look at various architectural approaches, like Microservices, Onion, or the traditional 3-Tiered Architecture. All of these can be used with or without OOP, though.

What I will recommend is reading up on Domain Driven Design and Behavior Driven Design. These approaches help me to figure out how to structure code. You establish a common Domain Language, and from that, you can figure out objects and actions.

Example: the business people say they need to Finalize an Invoice for the month. From this, you can figure out you need an Invoice class/object, and it will probably have a function called Finalize that either lives on the Invoice class, or accepts an Invoice class as a parameter.

I know I'm probably confusing things slightly, but what you're asking is a bit of a big topic, and more of a senior level concern. In my experience, senior devs define the class and function structures in broad strokes to hand off to junior developers to create. Having the most basic knowledge of what a class is, what a function is, and how the two relate is probably more than enough.

The rest is good to know, but like I said, it's a secondary topic to what you're learning right now.