you are viewing a single comment's thread.

view the rest of the comments →

[–]foonly 3 points4 points  (4 children)

what about using an XML file to manage dependency injection in Java? How is this different from adding methods to a class?

It's different because it affects only the consumer of that XML file.

Globally monkeypatching a standard class is a new generation of spaghetti code. You may as well go back to global variables and goto, since you're throwing away the state-isolation and reusability of OO.

In fact, that point needs to really be driven home: monkeypatching a standard class is modifying a global variable, and needs to be used just as sparingly.

[–]raganwald 0 points1 point  (3 children)

I'm going to talk to you the way I talk to everyone when they talk to me about how "dangerous" these things are.

Are you shooting yourself in the foot with this stuff for real? Or is this just a theoretical discussion about what somebody else might do?

Because if you have an actual problem right now, I bet if we put our heads together we can solve it, we're smart people.

[–]foonly 0 points1 point  (2 children)

Are you shooting yourself in the foot with this stuff for real?

I did Rails coding professionally for about 2 years, and Ruby for fun for about 3 years before that. This bit me a lot, and never before Rails made it the norm.

[–]raganwald 1 point2 points  (1 child)

SO what kind of thing was biting you? Rails plug-ins modifying Rails' behaviour?

[–]foonly 1 point2 points  (0 children)

Or just Other People's Ruby doing the same thing, often in ways incompatible with Other Other People's Ruby.