Latest Comments

§ Tianxiao Jiang   said on :

Cross origin compile on coliru seems not working now, neither on en.cppreference.com nor here. It was working just a few days ago. I was trying to do the same thing with coliru, any idea ?

§ Scott said on :

k_pi and k_pi_inverse not defined

§ Rolandcharcker said on :

That is fascinating post and thank you for sharing. There are things here that I didn’t think some time recently. On account of cool such a position, to the point that is extremely elegantly composed. http://www.clazwork.com/proficient-accounting-essay-topics-writer

§ Paul Watt®   said on :

@Semi Essessi

Thanks for you input.

How do you deal with rotating a model and avoid matrix multiplication?

§ Semi Essessi   said on :

i have some strong opinions about this stuff having worked a lot out for myself from nothing… vectors, matrices and trig are overkill to start with, and introducing them so early obscures the simplicity of what is actually necessary imo…

as an obvious example, generic matrix multiplication is pretty useless (and classically confusing) compared to the change of basis/coordinate system that happens to be the same operation as multiplying square matrices.

§ Troy said on :

This is probably the most thorough explanation I’ve seen on this subject. I found the tables and tips for navigating hexadecimal to be really helpful.

§ Paul Watt®   said on :

Thanks for pointing that out.
Yes, the code you mention is a mistake, I will correct it.

I adapted my implementation from the version in the proposal paper I cite, N4115. Their implementation chooses to swap the parameters. This form didn’t feel intuitive to me.

I needed the pop_back function, so the latest file I have uploaded has some additional functionality:
- pop_back
- move_item (moves items between lists)
- split (splits a list at a specified pivot point)

§ foo said on :

Is there a mistake on line 195( of the downloadable file), if not could you explain the template parameters are reversed (the line is also shown in your “One Last Tip” example above on line 20) ? Thanks

§ Zeh said on :

Nice article.

Some minor issues folowed by fixes:

“prefer the format year/month/day.”
“prefer the format day/month/year.”

“Instead of doing one thing will,”
“Instead of doing one thing well,”

§ Paul Watt®   said on :

Thank for the compliment Larry.

Someone has to count, and I’m glad you took the time to correct me.

§ Larry Constantine said on :
4 stars

Damn clever presentation! Actually the terms coupling and cohesion predate the 1974 IBM Systems Journal article (Stevens, Myers, and Constantine). They were first used and described in a more obscure paper by me in the 1968 National Symposium on Modular Programming. But who’s counting.

Great job!

–Larry Constantine (pen name, Lior Samson, author of Flight Track)

§ Paul Watt®   said on :

One more note:
I basically create two sets of windows, one if code highlighting styles, and the other set with editing styles.
Normally the editing styled windows are hidden. Then when you press run this code, the editing windows appear, and the others are hidden.

It’s not an elegant solution because I need to duplicate the code twice. However, I am happy with how it looks.

The JS file contains the code to send to coliru to compile and receive a response.

§ fenbf   said on :

Thanks for the explanation! I’ll try to use your solution and let you know if it works on my site (based on blogger.com)

No, I haven’t tested any other alternatives, but coliru seems to be used quite often. So it seems it’s a good choice.

§ Paul Watt®   said on :

@Jamie, thanks for pointing that out.

@rightfold, I definitely agree. I think that public inheritance is overused mostly because it is misused. I also agree about templates.

One of the main points that I wanted to convey, is that devs may be trying too hard to reuse code by inheritance, when composition is all that is needed. Not even features like templates have to be employed to gain the benefits.

§ rightfold said on :
4 stars

Nice post, although I think in languages that have good alternatives to inheritance, those may be preferred to achieve substitutability. For example, in C++ you would often use templates and concepts instead of inheritance.

§ Jamie Thomson   said on :

Typo I think. 3rd paragraph:
“Tight coupling increases the probability that a component can be reused in more places, by limiting its capabilities to small well-defined tasks. For those of you keeping score at home, high cohesion is the realization of the S, Single Responsibility, in SOLID object-oriented design.”

That should begin “Tight *cohesion* increases the probability that a component can be reused in more places” should it not?

§ Paul Watt®   said on :

Thanks for the compliments.

This entry is based on a presentation I gave to colleagues at work for a “Lunch & Learn” session.

With my increased interest in unit-testing and generic-programming over the last 7 or so years I noticed that all of the classes and code that I reuse, as well as the C++ Standard Library are small concise objects.

I like metaphors, although I know they don’t immediately register for everyone. The Legos seemed like such a natural visual representation of an interface and how each of the different types of pieces interact.

Then add in the wisdom I have picked up from reading Meyers, Sutter, Andrescu, and Stroustrup…

Well, thanks again.

§ Paul Watt®   said on :

It wasn’t too difficult, but it did take me a few days to create a nice looking solution.

At first I started with a .js file I found from a GitHub project. However, it didn’t quite work the way I wanted it to.

I was aiming for the same behavior that is found on cppreference.com.

So I analyzed their HTML, modified the .js project from GitHub until I arrived at what I have now.

You can find the JS file that I created at this path:
http://codeofthedamned/rsc/js/coliru.js

With that I had to figure out how to integrate things with the CMS software that my site runs on, which I just created custom CSS tags for the compiled code windows.

If you would find it useful, I could write an entry on it, I have been considering that for a while.

One of the better entries that I have created that demonstrates the online compiler is the SFINAE article.

I haven’t looked into other online compilers because coliru has worked pretty well. Are you aware of any others?

§ fenbf said on :
5 stars

Is it easy to integrate this button on other sites? How to do it quickly? Have you considered other alternatives?

§ Ernie Cordell   said on :
5 stars

Love your analysis and your example: So many have tried this and have failed to elucidate. Grouping the pieces by characteristic does clarify the use of the pieces and the case for reuse (and abstinence).

Contact / Help. ©2017 by Paul Watt; Charon adapted from work by daroz. CMS / cheap web hosting / adsense.
Design & icons by N.Design Studio. Skin by Tender Feelings / Skin Faktory.