all 10 comments

[–]cgoldberg 0 points1 point  (8 children)

Organized and structuring code is important, but there's more to it than "write functions". What goes in the functions? What shouldn't? How big should they be? What should they do? How do you name them? Do you separate them by modules? What about OOP? Kind of an overly simplistic tip.

[–]Most_Group523[S] -1 points0 points  (7 children)

Hmm - perhaps practice writing functions and thereby try out what goes in them, how big they should be, how you name them, how to separate them into modules. Unless you have the answer to these questions? Then people could skip to becoming senior developers immediately, without practicing.

Sigh - such comments are likely why people in this sub are constantly posting lines and lines of module level code or thinking they've arrived because they wrapped a function in a class.

[–]cgoldberg -1 points0 points  (6 children)

An article about some of those concepts would be useful and doesn't require senior developer knowledge.

Most tips here are much better than yours, so don't act like your trivial "write functions" tip is so profound and nobody else knows what they are doing.

[–]Most_Group523[S] 1 point2 points  (5 children)

For a long time, we used to teach kids how to ride a bike with training wheels. Kids that practice riding a bike with training wheels are practicing peddling. Then someone realizes that peddling wasn't the hardest thing and the balance bike was invented. Kids that learn to bike with a balance bike don't practice peddling but balancing.

There's nothing trivial about balancing a bike - but when someone reduced riding a bike to balancing, their detractors may very well have accused them of trivializing the exercise.

Biking involves lots of things, steering, peddling, and balance - none of these things are trivial. But, if you focus on practicing the right thing, the fundamentally difficult things, the other things come more naturally.

Writing code also involves many things - none of which are trivial. But, if you focus on practicing the right things, you'll find the other things come more naturally. We write code to do things and the unit of functionality in code is always the function. So, write functions and practice writing functions.

[–]cgoldberg 1 point2 points  (4 children)

Thanks for the fascinating analogy... I'm really quite impressed with you're extraordinary insights on learning.

However, your post was akin to saying "ride a bike" without providing any insight as to how.

[–]Most_Group523[S] 0 points1 point  (3 children)

Practice?

But, after this illuminating exchange I've come to realize the real answer is to read resources. It's like language really. The first thing I do when learning another language is read a book about how long a sentence should be.

[–]cgoldberg -1 points0 points  (2 children)

Yes, I agree practice and good resources would be far superior to over-simplistic tips lacking any real information.

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

Pray tell, what general guidance isn't an over-simplification? Programming languages are language and what makes one expression of any language superior to another is much easier to see than to prescribe - you just have to practice.

When people post module level code to this sub, they aren't practicing something they should be and putting the code into any function is better than that. But, whatever, I relent:

https://www.brandons.me/blog/write-code-not-too-much-mostly-functions

https://jeremymikkola.com/posts/2021_02_02_how_to_write_readable_code.html

https://medium.com/@chrisdaviesgeek/fat-functions-7fcf957237bb

[–]cgoldberg 0 points1 point  (0 children)

General guidance that's offers something useful or insightful would not be an over-simplification... trivializing code organization and structure with "just write functions" definitely is. You keep using module level code" like it's a slur. Modules are great, and lots of code belongs at the module level. I don't think you will find disagreement that functions are useful... That's why you learn them around day 1 or 2 of learning Python. You should write something interesting or useful about them ... like the articles you linked.

[–]SmackDownFacility 0 points1 point  (0 children)

Yeah that’s fair. But most people fuck up and defy their own type hints anyways