3 ms·
In Python there simply doesn't seem to be a DI/IoC container available. So you end up half-assedly writing your own, or just using spaghetti code. I'm tempted t
by lmm 13y ago
In Python there simply doesn't seem to be a DI/IoC container available. So you end up half-assedly writing your own, or just using spaghetti code. I'm tempted to suggest that Python doesn't have these frameworks because it doesn't bother to support writing large programs. Likewise with testing, there's the unittest module but it's not really integrated with a build system or anything else. Java does in fact have some standard library functions for logging, but no-one wastes their time learning them - if all your real projects are going to use log4j, why not just use log4j all the time?
There are certainly unnecessary parts - there's a hell of a lot of bloat in spring - but just doing without frameworks entirely is not the answer.
- BugBrother 13y agoI am no Python expert, but there must be modules (easyinstall etc) for inversion of control etc in Python too, as there should be in all scripting languages. (Is it really in the std lib of Java?! Ah, maybe I'm not that surprised...) (I am from a Perl environment which have a bit emphasis on tools/libraries and language extensions, because it is easy to do with automatical tests on most every platform/Perl version.)
- lmm 13y agoIt's not in the standard library for java, no, but Spring is very popular and "standard" in the same way as e.g. Rails in ruby.
- BugBrother 13y agoOk, I get what you're saying. Well, it is quite natural that the tools for large code bases are more common in Java. Not only because Java is traditionally used on conceptually larger projects... :-) Anyway, as a Perl guy I can tell you that DI is commonly used in Perl, if nothing so because of the testing culture.
- icebraining 13y agoIn Python there simply doesn't seem to be a DI/IoC container available. Sure there are. There's even a version of Spring for Python. It's just that nobody uses them. You're free to guess why.
- watwut 13y agoBecause they are useful only after the project grows big. People who use them on small projects do it out of habit. Which only confirms what parent comment wrote.
- marcosdumay 13y ago> In Python there simply doesn't seem to be a DI/IoC container available. Well, last time I needed something similar on Python, I just loaded the settings from the database, included the wanted code at runtime, and inserted the desired symbols at the local context. Took a bit more than a day to write, and was very appliction specific, but saved a lot of trouble with those crazy constructors that appear on Java.
- dragonwriter 13y ago> In Python there simply doesn't seem to be a DI/IoC container available. So you end up half-assedly writing your own, or just using spaghetti code. There are plenty available, just not one dominant one. > I'm tempted to suggest that Python doesn't have these frameworks because it doesn't bother to support writing large programs. That probably approximate the truth, in that the brittle "large program" architectural style that IoC/DI approaches seek to mitigate the harms of is probably less popular for large systems where Python is used (or at least the Python parts) which favor smaller programs interacting through standardized communication protocols for constructing large systems. > Likewise with testing, there's the unittest module but it's not really integrated with a build system or anything else. Since there is no "build" with python, the fact that its unittest module is not integrated with a build system isn't surprising. There are plenty of tools that support integrating unittest (or other python testing frameworks) in workflows, including utilities that do testing on every file save (similar to autotest in Ruby). Obviously, in the absence of a build step, they aren't integrated into a build system, but the workflows are often better because of the absence of a build step.