The tag has no wiki summary.

learn more… | top users | synonyms

2
votes
2answers
93 views

Preferred way of handling errors when loading an object from a file

If I want to load an object from a file, there are a number of things that can go wrong. Thus, one needs a way of handling errors when doing so. In some languages, like haskell, one can return a Maybe ...
0
votes
0answers
25 views

Data serialization architecture, injection on construction vs. on function call

I am creating a data serialization/deserialization mechanism for essentially a persistent storage object. Due to the variety of systems this mechanism could run on, there needs to be a a variable ...
1
vote
1answer
120 views

Learning to write DSLs utilities for unit tests and am worried about extensablity

I'm trying to simplify our unit tests with hand written DSL's. So far I have DSL's that walk developers through processing a service after setting up all preconditions and the construction of an ...
0
votes
2answers
233 views

using this in a constructor, why does it work?

I got two classes. busiObj(created from ancient flat files) key(provides means to tell busiObjs apart) key has a c'tor that takes a busiObj public key(busiObj foo) { bar = foo.someThing; ...
-6
votes
4answers
389 views

Why must a constructor's call to the superconstructor be the first call?

It is an error if you do anything in a constructor before calling the superconstructor. I remember that I had problems because of that. Yet, I do not see how this saves us from errors. It could save ...
3
votes
4answers
295 views

Separation of construction and initialization

I'm confused by this post by Mark Seeman. And his comment on IInitializable below: The problem with an Initialize method is the same as with Property Injection (A.K.A. Setter Injection): it ...
28
votes
3answers
2k views

Is a “start”, “run” or “execute” method a good practice?

I'm currently working on a code base that has many classes that implement a Start method. This seems like two-phase construction to me, which I had always considered a bad practice. I can't tell the ...
4
votes
5answers
416 views

How does the concept of a class change when passing data to the constructor instead of method parameters?

Let's say we're making a parser. One implementation could be: public sealed class Parser1 { public string Parse(string text) { ... } } Or we could pass the text to the ...
6
votes
3answers
993 views

Is relying on implicit argument conversion considered dangerous?

C++ has a feature (I cannot figure out the proper name of it), that automatically calls matching constructors of parameter types if the argument types are not the expected ones. A very basic example ...
2
votes
4answers
2k views

Should I use the factory design pattern for every class?

I've been writing a website in PHP. As the code becomes more complex, I keep finding problems that can be solved using the factory design pattern. For example: I've a got a class Page which has ...
6
votes
1answer
422 views

Dependency injection: what belongs in the constructor?

I'm evaluating my current PHP practices in an effort to write more testable code. Generally speaking, I'm fishing for opinions on what types of actions belong in the constructor. Should I limit things ...
41
votes
27answers
4k views

Tips for working fast [closed]

What are some tips for helping to design and construct applications faster?