33
Null0x90
49d

I've just done my first mini project by myself without doing any tutorial, only documentation and following the best pratices.

Yay for me! Now let's go with the next one!

Comments
  • 3
    Link/github/anyth?
  • 2
  • 2
    @Null0x90 This is as far from pythonic as code can be.
  • 0
    Have you thought about adding dependency injection?
  • 2
    Seriously though, if a python class has two functions one of which is init, it shouldn't be a class.
  • 0
    @Lor-inc yep, He has made modules for single class and on top of that all code is in init file of the module.
  • 2
    Simple tips for modularizing apps?
    1) start with a single file.
    2) When your code starting to lose readability.
    i) Figure out parts that you are reusing several times and make a function and use it.
    ii) Use classes to organise code in terms of real world entity like user, doctor, report etc. Use oops properties to reduce duplication (Inheritance is your friend)
    iii) when you figure out classes for the project, divide similar classes in a module ex: animals module may contain class regarding animal in separate file.
    You can repeat division of code anytime but don't over divide code because it may decrease readability.
    I generally start with a single file and divide project in modules whenever I find it takes longer time to navigate code.
  • 1
    Congratulations on popping your cherry and getting off of the tutorial-heroin.

    At least you're not addicted to stackoverflow-crack like some of the people on here.
  • 0
    Oh look who's all grown up and everything!

    /well done!
  • 0
    @Lor-inc

    "Have you thought about adding dependency injection?"

    How do I set that?

    "Seriously though, if a python class has two functions one of which is init, it shouldn't be a class."

    Why that?
  • 2
    @Null0x90 Dependency injection was sarcasm, sorry about that.
    If a class has only one function besides init, it should just be a function. Classes imply state of some sort, you don't have state.
    In any case, congrats!
Add Comment