As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 11 years ago.
This isn't a difficult question. I simply want to know which of these two C++ code snippets you think is better (readability vs. length vs. boiler-platery):
Option #1
Entity* square = Entity::Builder().positionX(0.0).positionY(0.0).
controller(ctrl).representation(rep).build();
Option #2
Entity::Builder bld;
bld.positionX(0.0).positionY(0.0).controller(ctrl).representation(rep);
Entity* square = bld.build();
I personally prefer the first option, but that may be because I am the author of the code and already know what the code does (it may be confusing for someone who doesn't know the code). I like it better because it shows the focus on the Entity object rather than on the Entity::Builder object (and because it's shorter).
Option #3
Entity* square = Entity::Builder()
.positionX(0.0)
.positionY(0.0)
.controller(ctrl)
.representation(rep)
.build();
Related
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 9 years ago.
I've heard the term 'aspect oriented programming' tossed around for a long time... I'm still confused... However, it seems to me that the general definition of an aspect is that you can take an existing program, annotate it using an 'aspect' of some sort and have it produce an additional behavior or something completely different. It kinda smells like a macro to me. I'm wondering if there are any similarities/differences as well as any informative links on this matter.
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
I wonder why such a natural thing like static_if did not manage to get into C++11? Some people object that using inheritance or template specialization we could achieve demanded results BUT:
Why don't we have a simple static_if for simple situations when one doesn't want to bloat up the source code with all that?
I suppose the commitee was short of time to discuss this feature so they decide to delay it after C++11. Anyway proposal is here: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2012/n3329.pdf
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
I am switching java to c++ and there is some fundamental difference that I am missing. If you guys know any good sites that have class design tutorial, please let me know. Stuff such as memory deallocation, things to avoid, etc.. I have also been googling this stuff but I just want more information. Maybe you guys can help. Thanks
Try the class design tutorial found on the CProgramming website.
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
I've used Clojure for about 2 years now (having used scheme/lisp before that).
I'm getting to the point where I feel like I'm not learning more clojure "by osmosis" and am considering using a conscious effort to memorize the function names in Clojure.core
Question:
Has anyone else done this? If so, has it been a significant productivity boost?
I'm afraid that just having a function memorized is not enough to spot the need to use it when it is needed. It is better to learn in context - for example by solving the 4clojure problems and then looking at solutions by users with high scores. Once you have a function in context, then you can memorize it.
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
I've been using boost::geometry, but it's still a young project and has a few too many bugs at the moment. Doubtless these will be fixed one day but is there a better choice right now?
EDIT: the bugs that were troubling me are now fixed - back on boost::geometry.