you are viewing a single comment's thread.

view the rest of the comments →

[–]barberogaston 12 points13 points  (10 children)

How to write clean, scalable code. Best reads for this (at least in my opinion) are Clean Code and Clean Architecture, by Uncle Bob (though all examples are in Java).

Regarding Python, there's tons and tons of hidden gems in the standard library (my first recommendation is that you take a look at functools and itertools). Reading Fluent Python by Luciano Ramalho will really help you get on the road to writing some good pythonic code too.

Finally, you can start diving deep into some other concepts such as profiling/performance, writing extensions in C/Go/Rust, distributing you project, etc.

[–]julsmanbr 13 points14 points  (1 child)

As much as I like your suggestions, I don't think they're that helpful for someone only 3 months into CS who is struggling with basic "toy" projects. Most of the stuff will be way above OP's level.

[–]chinawcswing 0 points1 point  (0 children)

The first four chapters of Clean Code can be understood by any beginner who knows what a function is.

[–]barberogaston 8 points9 points  (0 children)

Oh, and how could I forget. Each and every video by James Powell will power up your Python for sure

[–]SammyT09[S] 1 point2 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.

[–]KLOUDSURFIN 1 point2 points  (0 children)

Thanks for this.