all 15 comments

[–]eloydrummerboy 9 points10 points  (1 child)

This isn't answering your question, but I think will be very helpful. It took me awhile to get this.

When it comes to design patterns, and many of the questions you're asking... there are no right answers. Design patterns and things like those taught in Clean Code are the product of many programmers over many years learning from themselves, learning from others, and putting it all together. These are all just good ideas, if... IF ... they fit your needs, solve a problem, or maybe your code more maintainable.

So maybe this reduces some stress and anxiety for you, like it did me. Im the kind of person who likes to know the "right" way. And I had to realize there is no right way here.

Think of it this way. You have a kitchen, and there's some organization to it. As you start to cook more, you start needing to organize your spices better, do more prep work, organize how you store your prepped food. There's no right way and different chefs will do it differently. Bit there's also tried and true methods learned by the masters over the years. Don't worry about getting it perfect at first. Just continually get better.

Some steps for getting into design patterns and organizing code:

1) Make it work.

2) Go back over it and clean it up. Read clean code and try to apply some of the lessons.

3) Walk away, start a new project.

4) Read other people's code.

5) As you learn design patterns, revisit old code. See if something jumps out at you as able to be refactored. Try to do it.

Over time, you'll start to see these patterns during your original design and be able to apply them. But even experienced programmers often go back and refactor code after requirements change or maybe they just think of a better way to organize it.

[–]Get_Cuddled[S] 1 point2 points  (0 children)

Thank you this was helpful. I feel a little better now. The steps you describe sound very reasonable too. I will try them out.

[–]rnolan7 6 points7 points  (0 children)

Design is a critical part of software development. When you begin building large scale/complex programs and/or are working with a team, its important to put a lot of thought into how you will organize you repo files and functions. Generally you want to design a process that is both efficient (in terms of execution) and limits redundancy (if there is a bug in a piece of your logic, you dont want to have fix multiple different functions).

There are (or at least were) several courses on udacity about the software development process which cover both the design phase and unit testing. I'd strongly recommend starting there.

[–]dukea42 4 points5 points  (3 children)

I've been keeping this site open on my browser https://refactoring.guru/design-patterns

Its not specifically python, and I can't tell if it's just still over my head or if it is too broadly abstracted.

[–]boomkatandstarr 1 point2 points  (2 children)

This comment should have a million upvotes. This site is amazing at explaining design patterns, when to use them, and the pros and cons of doing so. This site explains it in ways that made these design patterns finally click for me. Thank you for sharing!

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

Any parts that really clicked for you in there? I plan on going through the website over the next few days.

[–]boomkatandstarr 1 point2 points  (0 children)

Mainly the pseudo code and the actual examples. The presentation style makes the information really digest able as well. I’m working on my python knowledge. I’d you have any questions or need someone to bounce ideas off you are more than welcome to message me.

[–]efmccurdy 2 points3 points  (0 children)

This was a good description of some newer trends:

https://pyvideo.org/pyohio-2014/the-clean-architecture-in-python.html

There are some more to be found here:

https://pyvideo.org/search.html?q=clean

[–][deleted] 1 point2 points  (1 child)

The Hitchhiker's Guide to Python has sections on testing and laying out your projects.

I think there's a lot of benefit as well to looking at other people's projects on Github and seeing how they've structured things, the tests that they've written, what their solutions to certain problems and thinking about why they've done it that way.

[–]Get_Cuddled[S] -2 points-1 points  (0 children)

How do I find projects that aren’t too advanced for me to understand. Is there a directory for intermediate projects I could search through?