8

I was ranting about overusing classes on python, then I noticed I'm a person that creates new functions for 2-3 lines of codes for no reason..

Comments
  • 3
    If I have to type lines of code more than once I create a new function
  • 2
    Can also improve readability, even if you only use it once. Also makes it easier to test. There, two reasons!
  • 1
    @philcr Yep DRY huh ? 👍But when I divided a function into two small pieces it felt like I was just messing it and making it harder to read because you need to jump function to function on every single line which kinda sucks. @kerrermanisNL
  • 0
    @Marnsghol I don't know where I stop with the code reuse, tends to be a class level thing but I do have a library of helper functions and stuff that I use regularly
  • 1
    Yeah it depends on the situation. Don't overdo it, but if you feel you can describe a couple of lines with a function name it's probably okay. You'll have to figure out what works best for you/the people around you.
Add Comment