python - Does OOP make sense for small scripts? -


I mostly write small scripts in Python, about 50 - 250 line codes. I usually do not use any object, just direct procedural programming.

I know OP basics and I have used the object in other programming languages ​​before, but for small scripts I do not know how the objects will improve them. But it may be that I have limited experience with OOP.

Am I not trying hard to use the objects, or did the OP not make much sense for small scripts?

The problem I believe best is most appropriate in the hands - it is procedural, OOP, Functional, ... not a size of the program is a criterion, though a big program (by little margin) can be more likely to take advantage of OOP's powers - a class, sub-clinging and overriding, special method overload, OOP Many examples of design patterns etc. Oi is also fully occur in a small script as well, just high somewhat unlikely that it will be a big one. In addition, I hate the global statement, so if a natural procedural approach is required, I will almost always switch to oo instead - even if the only benefit is instead of a worthy name rather than Barennam E will have the ability to use e which global will be required.

Normally, there is no need to "try hard" - just ask yourself "There is a chance here (one) to use many examples (etc)" and this will soon be the second nature That is, you will discover opportunities to remind yourself of opportunities without any doubt, and as a result your programming will improve.


Comments

Popular posts from this blog

windows - Heroku throws SQLITE3 Read only exception -

lex - Building a lexical Analyzer in Java -

python - rename keys in a dictionary -