348 reputation
210
bio website
location United States
age
visits member for 3 years, 5 months
seen May 25 at 5:29

Jul
22
comment Are wikis really appropriate to store documents for software development?
The fact that documentation involves binaries isn't really a good reason to avoid storing it in your version control system. VCSs can easily deal with binary files. And if you store it in your project's VCS, you have the advantage of being able to branch your documentation when you branch your project.
Jul
21
comment Object-Oriented Programming: Why “Oriented”?
Excellent point (although I think you mean adjectives, not adverbs -- "programming" in this context is a noun).
Dec
2
comment Passing a dependency to a controller class
But don't DI frameworks generally define the dependencies statically? Would they allow me to create the IUserStorage at runtime?
Jun
13
comment Should strategy objects have state?
Thanks for the term "sequential coupling" -- I hadn't heard that before. I'm wondering though, doesn't this eventually lead to removing all state from objects that aren't simple data objects? It seems like any other objects would always depend on their state to some degree.
Jan
31
comment How do I inject test objects when the real objects are created dynamically?
That's been my general approach, but in this case there are several subclasses of Validator, and there's a lot of setup involved in the test. If I make a test subclass, then I have to also make a test subclass for every real subclass of Validator. So I'll end up duplicating a lot of my setup work. But maybe that's necessary in this case.
Jan
31
comment How do I inject test objects when the real objects are created dynamically?
I left it out, but there are other methods that provide access to the ErrorList object. So I can test using those.
Jan
29
comment Gradual approaches to dependency injection
Thanks. I'm considering this approach for some cases. But what do you do when MyObject's constructor requires parameters that are only available from inside your class? Or when you need to create more than one MyObject during the lifetime of your class? Do you have to inject a MyObjectFactory?
Jan
29
comment Gradual approaches to dependency injection
There are a lot of "new X" scattered throughout the code, as well as many uses of static classes and singletons. So when I try to test one class, I'm really testing a whole bunch of them. If I can isolate the dependencies and replace them with fake objects, I'll have more control over the testing.
Jan
26
comment Is a single config object a bad idea?
Well, no. But there are alternatives: combining multiple settings into objects, or using default values for some settings, with setter methods to override them. I agree that a single config object gives you a lot of convenience; that's why I've been using it all along. My purpose for asking this question was to think about whether it's worth the tradeoffs.
Jan
26
comment Is a single config object a bad idea?
@Anon: I guess the problem is that when I construct an object, I don't know which config settings all its dependencies use. If they were individual parameters, this would be more clear, and I could require them in the constructor. But since the config object is essentially a big hashmap, I can't see which settings are used by which classes.
Jan
26
comment Is a single config object a bad idea?
@AndrewKS: My config class is essentially a big pool of name-value pairs. Any class can use any of them. So when you construct an object X, it might construct an object Y that reads its own config settings. Right now, you can set up the config object with X's settings but not Y's. Obviously this is a problem, but it seems inevitable if everyone can read from the same config object.
Jan
26
comment Is a single config object a bad idea?
True. But if I continue using a single pool of settings (with a different pool for testing), then all my tests end up using the same settings. And since I may want to test the behavior with different settings, this isn't ideal.
Jan
26
comment Is a single config object a bad idea?
That solves the first problem, but not the second.