[Python Tips] DRY Programming

in #programming6 years ago

This really isn't about Python directly, but it is an important topic every developer should know. DRY (Don't Repeat Yourself) is a popular programming concept of avoiding repeat code.

The main goal of DRY programming is to eliminating code multiple pieces of code that do the same thing and reducing them to a single function or class. This reduces errors, improves performance, reduces memory usage, and makes your code easier to understand.

The concept of DRY programming was first named in the book The Pragmatic Programmer by Andy Hunt and Dave Thomas although it is not a new concept.

This tip is really simple to understand and doesn't need much explanation. When writing your code, always keep an eye out for classes, methods, and functions that are duplicating logic elsewhere in your code.

My Python Tips Series

Sort:  

DRY, I knew I heard it somewhere and forgot... Remembered after reading "Don't Repeat Yourself" my teacher told me that once or twice.

Dividing codes into reusable functions and files, along with KISS is a good way to make better programs.

Hiiii @themarkymark, programming is always tough thing for me, yet I'm trying to be learn programming..
Can you suggest me to some easy tips and tricks to learn programming.
I will be always thankful of you @themarkymark
and please support me @devkapoor423 by your suggestions on my post with a upvote..
Thanks and Love..

It's a pleasure to have a service like that

Hello @themarkymark,

Great artical and it’s really informative. I upvoted it and following you now. Let’s be in touch and help each other here.-thnx

Yep! I always consciously try to do that. Functionalising has been a big part in helping the automation of our machine at work

I don't know more about programming but i can see that you done hardwork for this and your other post,your contents are always genuine and unique

God knows I should apply DRY to my writing style.

Everyone unfollow he's a spammer and a scammer @themarkymark is abusing the system so bad it's been going on for a while now there is even videos on YouTube people talking about how they have been affected by @themarkymark
@steemcleaners need to put a stop to this he's making money by spamming people with @badcontent it's not right at all please put a stop to this it's not good for @steemit @blockchain @steepshot @busy @dlive @dmaina @dtube @zappl