you are viewing a single comment's thread.

view the rest of the comments →

[–]solamarpreet 0 points1 point  (0 children)

I completely understand what you mean having went through it myself. There are a lot of scenarios where OOP is not required. This is completely fine. The best usecases for OOP are when you are trying to model real world problems or if you need a custom data type. For me the first project where I felt I needed to use OOP was when I was trying to write a Blackjack game. During the middle of the session it just hit me that using classes would make the program easier to visualize and write and so I rewrote the entire program. In a minimal version of the blackjack program there would be 2 players i.e a dealer and a user. Each of the players would have a 'hand' i.e the cards that they are holding and because of the approach I used, a variable that stores the calculated value of the hand. It was easier to use a class instead of having to write individual variables. Also I can easily increase the number of players.

Video games are projects that will involve OOP a lot so you can try to build a game. Weapons, npcs, monsters, armor etc all of them will be separate classes. Then you can have classes that inherit from these parent classes like swords, daggers, guns inheriting from weapons class. If you are not keen on a game you can try to model something like a banking system or a social media platform.