Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
I've heard systems described as a "clean object model", but a precise definition does not seem to be around. It seems to refer to the classes being complete or consistent in some way.
I'm just wondering if it's referring to a specific trait or just another favorable term like 'elegant'.
Quantlib is described as "written in C++ with a clean object model".1
It's not really a technical term. A "clean" object model is a well-designed one, by whichever standard of good design. Usually it involved orthogonal classes with a clear separation of concerns and an intuitive mapping to real-world concepts, i.e. a lot of fuzziness that you'll need to judge for yourself.
Related
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
I often hear that C++ templates are Turing complete. What does it mean?
My previous search lead me to links [1] and [2] which are good but they do not answer what I am asking.
it's capable of expressing general recursion by simply using templates that refer to themselves and using template specialization for making decisions.
Is recursion and and making decision equivalent to Turing completeness?
Could someone please break down the requirements of Turing completeness in the programming aspect (not from the computer science aspect)?
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 5 years ago.
Improve this question
In this discussion, a poster (mikera) says
There's no dotted pair in Clojure.
A philosophical reason for this is that Clojure avoids the use of a
concrete "pair" data structure and instead emphasises abstract
"sequences" which can have may possible concrete implementations.
Can someone elaborate or point me to some literature on what this means? Is this a more elegant or mathematically pure approach?
Here is a link to a handy list of questions that Rich has answered about his design decisions https://gist.github.com/reborg/dc8b0c96c397a56668905e2767fd697f
While this list doesn't explicitly explain why there is no concrete "pair" data structure it might give you some insight into Rich's preference for practical, general design.
I remember there was a time when there was a discussion about introducing a "tuple" which would have been like a vector that only has two elements to avoid the needless memory allocation that occurs when using a two element vector.
Introducing these things has a complexity cost and so you can assume that the cost/benefit analysis did not warrant adding it to the code base.
Check out this discussion on Clojure's Jira project about adding tuples and you'll see how any idea gets put through its paces:
https://dev.clojure.org/jira/browse/CLJ-1517
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
Feels like a question that has been asked before but I'm not exactly sure how to properly word it in a google search. Say I have a MainWindow object and in that object I define several objects PanelA, PanelB, PanelC and PanelD. What's a good way of connecting these objects to each other without having constructors that look like this
PanelA(PanelB* b, PanelC* c, PanelD* d)
Would you suggest to just pass them all in through the main class like so
PanelA(MainWindow* mw)
{
b=mw->b; c=mw->c; d=mw->d;
}
Or is there better ways to structure my classes. What's this problem known as in general, so that I can google this stuff myself.
What's this problem known as in general, so that I can google this stuff myself.
The design defect is known as strong coupling of types and use of hardcoded relations.
The general approach to refactor such code is to introduce interfaces and design patterns to solve the actual dependencies by means of functionality.
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
In object oriented languages, it is fairly common to implement ASTs (Abstract Syntax Trees) using simple hierarchies (the Composite pattern), and to traverse them via visitors.
In functional programming languages, using variants/sum types, and then pattern matching, is the right approach.
C++ features both inheritance, and Boost.Variants. I have written several AST hierarchies using inheritance, but I'd like to get some feedback from people who would have used the variant approach. I'd like to know which one is the "best", in terms of performance (time and space), but also in terms of maintainability (easiness to create trees, and to traverse them).
I am especially interested in experience with implementation of hash-consing (keeping a single copy of each common subtree), possibly with Boost.Flyweight.
I am interested in battle field experience, not opinions. This question was original closed as "opinion-based". Which has never been the point...
Thanks!
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
Should a thread-safe mechanism be added when a class is developed and it is known that this class will be used in multi-threaded environment (not always however) or leave it to the user?
As a general rule, it's more flexible to leave it to the user. For example, consider a map-type container. Suppose the application needs to atomically move something from one map to another map. In this case, the user needs to lock both maps before the insert-erase sequence.
Having such a scenario be automatically taken care of somehow by your class would probably be inelegant, because it's naturally something that happens across objects, and because there may be many such scenarios, each slightly different.