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 subclasses HTMLPage
, XMLPage
, etc. Depending on some input I need to return an object of either one of these classes. I use the factory design pattern to do this.
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.
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 monster object that has a huge constructor and setters that conflict. The monster is one of the many preconditions of processing the service and they constructed by hand over and over as developers write unit tests for new services in our system. So it would be worth putting considerable effort into making constructing them easier. I’m tried of watching people copy and paste the “life support system” from unit test to unit test.
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 number of “drivers” that could be used to serialize or deserialize the data.
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 number of “drivers” that could be used to serialize or deserialize the data.
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 number of “drivers” that could be used to serialize or deserialize the data.
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 number of “drivers” that could be used to serialize or deserialize the data.
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 number of “drivers” that could be used to serialize or deserialize the data.
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
object that might contain the newly created object. In C++
, although it is in principle possible to create such a convenience class, it is usually not the most straight-forward way to do things. Below I list various ways errors could be handled when loading an object from a file in C++
.
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
object that might contain the newly created object. In C++
, although it is in principle possible to create such a convenience class, it is usually not the most straight-forward way to do things. Below I list various ways errors could be handled when loading an object from a file in C++
.