38,178 reputation
358143
bio website google.com
location Germany
age 46
visits member for 3 years, 10 months
seen 15 hours ago

Senior developer, mathematics and CS background. C# / C++ / VB.NET / VBA, but did also some Perl / Python / Javascript / Scheme and other languages in the past.


Oct
4
comment What is the name of the following (anti) pattern? What are its advantages and disadvantages?
@user949300: you believe it supports your comments since you are biased. Actually, Wikipedia says Bob Martin invented the term (as I wrote above), not "his definition of classes having single responsibilities is the one-and-only correct one".
Oct
3
awarded  Nice Answer
Oct
3
comment Do we need to test 32-bit software in 64-bit Windows?
@gbjbaanb: you surely meant, when you forgot to use "x86" as platform.
Oct
3
revised Do we need to test 32-bit software in 64-bit Windows?
deleted 25 characters in body
Oct
3
comment Is this a commonly encountered situation in C++? Is there a pattern to handle it?
IMHO you are overthinking this. Your second alternative seems to be fine. If you have many more textures/models, you should store them in an array or a hashmap, of course.
Oct
3
revised Do we need to test 32-bit software in 64-bit Windows?
added 206 characters in body
Oct
3
revised Do we need to test 32-bit software in 64-bit Windows?
added 206 characters in body
Oct
3
answered Do we need to test 32-bit software in 64-bit Windows?
Oct
3
comment Do we need to test 32-bit software in 64-bit Windows?
@Donotalo: you should inform yourself about the basic switch in your Visual Studio configuration manager (or each project's compilation settings) named "platform", with the options "x86", "x64" and "Any CPU". When you found that switch, F1 is probably your friend.
Oct
3
comment What is the name of the following (anti) pattern? What are its advantages and disadvantages?
@user949300: SRP was not "invented" by Bob Martin, and his definition is not the one-and-only correct one. Maybe he introduced this term first, but the principle itself is older than the term.
Oct
3
comment What is the name of the following (anti) pattern? What are its advantages and disadvantages?
@user949300: the SRP is not a "mathematical provable" concept. And software design decisions are not always "black-and-white". The original code is not so bad it could not be used in production code, of course, and there may be cases where the convenience outweighs the cyclic dependency, as the OP has noted by himself in his "update". So please read my answer as "consider if using a separate factory class does not serve you better". Note also the author changed his original question a bit after I gave my answer.
Oct
2
comment When writing object-oriented code, should I always be following a design pattern?
In your example, the Null object pattern is only added for academic purposes, it does not introduce "a good design" into this code.
Oct
2
comment Unit test private method in c++ using a friend class
Your problem is: you both talk about different levels of a "public API": the API of a complex component to the potential users, and the public API of the classes of the components, which should be exposed to other classs within the component, but not to the outside. C++ has no "internal" keyword, like C#, so there is no simple mechanics to describe these different forms of "public", but there are different forms of workarounds. One valid workaround is the use of private nested classes, and in that context, testing private methods could make sense.
Oct
1
revised Writing software without unit testing
deleted 18 characters in body
Oct
1
revised Writing software without unit testing
added 586 characters in body
Oct
1
answered Writing software without unit testing
Oct
1
comment Writing software without unit testing
For hardware-dependent tests, look at this posts, not a full duplicate, but maybe helpful: programmers.stackexchange.com/questions/66639/…
Oct
1
comment Writing software without unit testing
@Telastyn: you surely meant "how your examples are not unit testable", I guess?
Oct
1
comment Unit test private method in c++ using a friend class
@BЈовић: I think it is debatable if such a question is better suited for stackoverflow.com since it is specific for C++. For me, it seems to be an edge case.
Oct
1
comment Unit test private method in c++ using a friend class
-1, an answer like "You shouldn't be testing private methods." is IMHO not helpful. The topic when to test and when not to test private methods has been discussed on this site sufficiently. The OP has shown that he is aware of this discussion, and its clearly he is looking for solutions under the assumption that in his case testing private methods is the way to go.