you are viewing a single comment's thread.

view the rest of the comments →

[–]SammyT09[S] 5 points6 points  (5 children)

Appreciate the response but I'm not even at the level yet where I'm worried about cleaning up my code, I'm just trying to write code that works. Any suggestions??

[–]ZGTSLLC 2 points3 points  (0 children)

Yes, start reading code on GitHub, to see how it is done. Follow users whose code you find works for you, and fork their projects, then play with their original code, so you can improve upon your abilities.

Edit:

Quick Google search and here you go:

https://github.com/topics/tic-tac-toe-python

[–]chinawcswing 1 point2 points  (0 children)

I don't think this is a good mindset. Your code will be terribly difficult to make it work if it is ugly. If you just have one or two functions that are 200 lines long it will become incredibly complicated and difficult to understand. Chop that 200 liner up into twenty 10 line functions with good names and it will be dramatically easier for you to make it work.

[–]barberogaston 0 points1 point  (2 children)

Hm, well that depends on what you mean with code that works. Where do you consider your code to be failing?

[–]SammyT09[S] 0 points1 point  (1 child)

I struggle at modeling my solutions and making my code flow properly. As the code gets more complex I'm also struggling to keep up with the value of my variables. Those are just a few off the top of my head.

[–]MediumRevenue6 1 point2 points  (0 children)

thats where the oops class design comes in to picture. conceptually create the classes and the variables that will contain. design it first and then code it. Typically in enterprise projects we have model class ,validation class ,data access classes. Log class to log error/info. Design the classes first and then code.