Monday, January 21, 2013
(The People) 45874 : 1 (Carmen Ortiz)
Monday, January 7, 2013
Dependency Injection is a Virtue
Having hard-coded class-names like in the example Time.now is effectively the same as communicating
via global variables. DHH's suggestion of stubbing out the Time class's now is selling us mutable
global variables as the solution to global variables. Or more precisely: passing an argument to a method
by modifying a global variable that the method reads out and restoring the state of the global variable afterward.
If that's "better", I don't really want to see "worse", and not wanting that sort of thing has nothing to do with being a Java drone limited by the language. And my experience with time-dependent systems tells me that you really want to pass the time into such a system generally, not just for unit testing.
Of course, having n-levels of AbstractFactoryFactory indirection could actually be argued
as being worse, as Tim convincingly does, but that's one implementation of DI that's hobbled by Java's limitations. For a DI solution
that's actually simple and elegant, check out Newspeak's module system (PDF): there is no global namespace, modules are parametrized and
all names dynamically resolved.
If you want synthetic time for a module, just instantiate that module with your own Time class.
Sunday, January 6, 2013
Objective-C is TIOBE Language of the Year Second Time in a Row
Although this surge in popularity is certainly largely due to the popularity of the iOS ecosystem (iPhone, iPad, AppStore), the fact that it continues despite Apple loosening its policies and alternatives popping up suggests that there may be more going on: maybe developers are discovering that Objective-C is a pretty fun and productive language, warts and all?
It'll be interesting to see wether Objective-C has now peaked, as Tiobe predicts, or wether it manages to expand back into other areas that could benefit from its qualities.
As last year, table and graphic reproduced here because Tiobe doesn't appear to keep an archive:
Position Jan 2013 | Position Jan 2012 | Delta in Position | Programming Language | Ratings Jan 2013 | Delta Jan 2012 | Status |
1 | 2 | 17.855% | +0.89% | A | ||
2 | 1 | 17.417% | -0.05% | A | ||
3 | 5 | 10.283% | +3.37% | A | ||
4 | 4 | 9.140% | +1.09% | A | ||
5 | 3 | 6.196% | -2.57% | A | ||
6 | 6 | 5.546% | -0.16% | A | ||
7 | 7 | 4.749% | +0.23% | A | ||
8 | 8 | 4.173% | +0.96% | A | ||
9 | 9 | 2.264% | -0.50% | A | ||
10 | 10 | 1.976% | -0.34% | A | ||
11 | 12 | 1.775% | +0.34% | A | ||
12 | 24 | 1.043% | +0.56% | A | ||
13 | 13 | 0.953% | -0.16% | A | ||
14 | 14 | 0.932% | +0.14% | A | ||
15 | 11 | 0.919% | -0.65% | A | ||
16 | 17 | 0.651% | +0.02% | B | ||
17 | 23 | 0.641% | +0.13% | B | ||
18 | 20 | 0.633% | +0.07% | B | ||
19 | 21 | 0.629% | +0.08% | B | ||
20 | 72 | 0.613% | +0.49% | B |
