So I’ve been working through the Tic Tac Toe game for about 10hours and things are going alright. It won’t be too much more time to finish the project, but in my opinion the code itself is quite “hackish”. The Objects I’m creating aren’t working well with everything else. I guess it’s not OOP enough for my liking.
For example, I got a clickable object set up. I declare a few of these objects (like x or o or start) and they have ‘clicked’ functions. When an event fires that the canvas was clicked on, I iterate through all the clickables in an array and check if they themselves where clicked on. That works well until you want to do a specific action for a specific button. I use a 5 long if statement to check if the clicked item is what i need. I can’t put the click action into the Object since it’d be useless for objects that are slightly different.
Anyways, I’m looking for any book suggestions that might help me build a more fluid code structure for my projects. While I studied patterns and stuff at school, I feel like a book would help me wrap my head around the design aspect of code. Any suggestions (preferably js)?
Here’s my pen if you are interested.
edit: I actually found P1xt-guides that seems right up my alley. If anyone has any other suggestions, please still let me know.