HIRE ME!

Wednesday, September 10, 2014

The Heterogeneity of C++

c:\Users\cordelle\Documents\ProgrammingLanguages\C++\Alger_vs_Meyers.txt.html

This is a very general observation, and no wondrous coding revelation, but when I read what Scott Meyers had added to the beginning of The Third Edition of Effective C++, I noticed a certain parallel with the "staged" approach in Jeff Alger's C++ for Real Programmers (previously titled Secrets of the C++ Masters).


What that seemed to emphasise was the heterogeneity of C++, a characteristic of the language itself, perhaps an immaturity, but assuredly a certain "patchwork" quality in its construction, and one that endures through ISO/IEC 14882:1998, which was then amended by the C++03, ISO/IEC 14882:2003, standard, called C++0x until that standard was finalised as C++11 and what is/will be C++14.


Scott Meyers calls this variety of approaches to C++ "a federation of languages," as we see in the Third Edition's first item:


Item 1: View C++ as a federation of languages (Scott Meyers, "Effective C++, 3rd ed." ISBN-13: 978-0-321-33487-9)

The easiest way is to view C++ not as a single language but as a federation of related languages. Within a particular sublanguage, the rules tend to be simple, straightforward, and easy to remember. When you move from one sublanguage to another, however, the rules may change. To make sense of C++, you have to recognize its primary sub-languages. Fortunately, there are only four:


    • C. Way down deep, C++ is still based on C. Blocks, statements, the preprocessor, built-in data types, arrays, pointers, etc., all come from C. In many cases, C++ offers approaches to problems that are superior to their C counterparts (e.g., see Items 2 (alternatives to the preprocessor) and 13 (using objects to manage resources)), but when you find yourself working with the C part of C++, the rules for effective programming reflect C’s more limited scope: no templates, no exceptions, no overloading, etc.

    • Object-Oriented C++. This part of C++ is what C with Classes was all about: classes (including constructors and destructors), encapsulation, inheritance, polymorphism, virtual functions (dynamic binding), etc. This is the part of C++ to which the classic rules for object-oriented design most directly apply.

    • Template C++. This is the generic programming part of C++, the one that most programmers have the least experience with. Template considerations pervade C++, and it’s not uncommon for rules of good programming to include special template-only clauses (e.g., see Item 46 on facilitating type conversions in calls to template functions). In fact, templates are so powerful, they give rise to a completely new programming paradigm, template metaprogramming (TMP). Item 48 provides an overview of TMP, but unless you're a hard-core template junkie, you need not worry about it. The rules for TMP rarely interact with mainstream C++ programming.

    • The STL. The STL is a template library, of course. but its a very special template library. Its conventions regarding containers. iterators, algorithms, and function objects mesh beautifully, but templates and libraries can be built around other ideas. too. The STL has particular ways of doing things, and when you’re working with the STL, you need to be sure to follow its conventions.

Keep these four sublanguages in mind, and don’t be surprised when you encounter situations where effective programming requires that you change strategy when you switch from one sublanguage to another. For example, pass-by-value is generally more efficient than pass-by-reference for built-in (i.e., C-like) types. but when you move from the C part of C++ to Object-Oriented C++. the existence of user-defined constructors and destructors means that pass-by-reference- to-const is usually better. This is especially the case when working in Template C++, because there, you don’t even know the type of object you’re dealing with. When you cross into the STL, however, you know that iterators and function objects are modeled on pointers in C, so for iterators and function objects in the STL, the old C pass-by-value rule applies again. (For all the details on choosing among parameter-passing options, see Item 20.)


C++, then, isn’t a unified language with a single set of rules; it’s a federation of four sublanguages, each with its own conventions. Keep these sublanguages in mind, and you’ll find that C++ is a lot easier to understand.


Jeff Alger speaks of varying stages of familiarity or steps along the way to mastery. It is interesting to note that what he calls "The Zen of C++" is an awareness of features in the language, in the end "idioms" that solve problems in some different or unexpected way:

The Zen of C++ (Jeff Alger, "C++ for Real Programmers," ISBN 0-12-049942-8)


C++ is a language learned in stages. Only when the last stage is reached does it all finally start to make sense, to combine into a Zen that unifies the otherwise scattered tricks and syntax. I think of learning C++ as being like rising up in an elevator. Ding! Second floor. C++ is a more reasonable C, strongly typed as long as you don’t fool around too much and, hey, how about those nifty // comments? All those C programmers who didn’t want to go into management needed a career path, and Bjarne Stroustrup, bless his soul, dreamed up a doozy.


Ding! Third floor. C++ is a decent-but-not-great object-oriented programming language. It’s not Smalltalk, but hey, what do you expect from a language that runs so blindingly fast? C++ is the COBOL of the 1990s, politically correct and sure to get your project funded by top management. Heck, they might even double your budget if you mention C++ often enough in your proposal. That’s just as well, because no one really knows how to estimate and manage C++ projects, and as to tools, say, lot of weather we’re having, isn’t it? Ding!


Top floor, everybody out. Hey, where did everyone go? Sure is drafty up here. C++ is really yacc++, not so much a language as a way of creating your own languages. It is elegant not for its simplicity like jumbo shrimp, the terms C++ and simple grate on the ears when used in the same sentence but for its potential. Lurking behind every gnarly design problem is a clever idiom, a nice twist to the language that makes the problem melt away like the Wicked Witch of the West without her umbrella. That idiom solves the problem as elegantly as a real language like Smalltalk or Lisp would, but without causing smoke to rise from your CPU and the stock of companies that manufacture memory chips to rise on Wall Street. C++ isn’t a language -- it’s an experience, a mind-altering drug.


This is also reminiscent of what Scott Meyers says about James O. Coplien's Advanced C++ Programming Styles and Idioms (ISBN-13: 978-0201548556) being a psychedelic book because it's purple and expands your mind.


Maybe the range of approaches is just a patchwork in paisley.

Monday, June 16, 2014

L’été invincible d’Albert Camus | Si omnes ego non, réserve naturelle

The article at the link supplied below (correctly) cites the source of a frequently repeated quote to which I believe has been added excess baggage. I hope we can get rid of some of these false attributions because they essentially contribute to making the World-Wide Web a cesspool. 


L’été invincible d’Albert Camus | Si omnes ego non, réserve naturelle

Sunday, January 26, 2014

How To Hire An Awesome Developer on oDesk: Part I

I consult on oDesk, yet I've yet to hire anyone, but people continue to ask me about the process.  Lately I've suggested to people that if they don't know how to spec their req, they might want to hire someone who can.



It reminds me of the groups of people who always followed my father around at cocktail parties, hoping to get advice.  He always said that there was no such thing as a free drink for him:  Had I the experience, I think I might have prepared a document for him to carry so that he might pass it around events like this.  Since I have a more tech-savvy clientele, I should be able to get away with posting a link ;)



How To Hire An Awesome Developer on oDesk: Part I

Friday, September 13, 2013

Канистра Сообщает Чернильницу О "Победе"

Вы знаете, сказала Канистра, что в хорошей легковой машине всегда есть Часы. Машина идёт -- и они идут. Машина стоит, -- а они всё равно идут. Вот такие Часы были в одной "Победе."

"Победа" эта была чудесной машиной, очень быстроходной. И все хвалили её за это.

А Часы не хвалил никто.

Понятно, что Часы завидовали машине. Она решили показать, что могут идти быстрее. И ушли вперёд почти на целый час.

Но их не похвалили. Наоборот, выругали и отдали в починку.

Часы удивлялись: ведь они спешили так же добросовестно, как и машина. Почему же ими недовольны?

Впрочем, в мастерской им быстро всё разъяснили. И часы вернулись на своё место. Теперь они уже твёрдо знали, что не во всяком деле нужно спешить. По крайней мере Часам это совсем не нужно.

-- Вы, кажется, из кабинета? -- спросил у Чернильницы Веник.

-- Да, я там живу и работаю, -- подтвердила Чернильница.

-- Тогда вам должно быть известно, как в кабинете повесили Занавеску?

-- Нет, я не помню.

-- Не помните? Ну, тогда слушайте.

Friday, August 09, 2013

How did Ashton Kutcher prepare for his role as Steve Jobs in the new movie Jobs?


What were the actor's sources into accurately playing a good Steve Jobs? Was the biography a major influence? What video research was used the most to understand his mannerism and demeanor? What were the other sources and processes used to understand the CEO and co-founder of Apple?


How did Ashton Kutcher become Steve Jobs ?



View Question on Quora




Friday, June 14, 2013

Windows 7: USB Transfers Slow?


Reblogged from Windows 7 -- by Anura Guruge:




If you have noticed that doing any kind of data transfer across USB with Windows 7 is somewhat slow, YOU are not alone.


This is yet another USB related problem in Windows 7.


Yes, we already know that Windows 7 has problems with un-powered USB Hubs ... though I think some of these can be fixed by changing the Windows 7 Power Management option for that USB controller.



Read more… 394 more words





I was looking for something else entirely when I stumbled across this post on this blog and recalled the absolutely wretched performance I had on my Windows 7 Professional for a memory card that I have that uses a small unpowered USB Adapter. I subscribed to Anura Guruge's blog because if this is any indication of the tips I could get, I'm on board!


Saturday, April 13, 2013

Tracy Levesque: Custom Post Types for Right-Brained Folks


Reblogged from WordPress.tv:










Reminds me of "Writing on Both Sides of the Brain: Breakthrough Techniques for People Who Write" by Henriette Anne Klauser.


Tuesday, March 26, 2013

Tuesday, March 19, 2013

Is there any theory that was discovered or inspired during an examination, quiz or homework?

Answer by Michael Ishigaki:


There's a well-known account of George Dantzig, "the father of linear programming," during his time as a mathematics student at UC Berkeley. One day, Dantzig was running late to a class taught by the famous Jerzy Neyman. When he arrived, he saw three problems on the blackboard and scribbled them down as homework problems. After class, Dantzig began working on solving these three problems. He found two of the problems straightforward and easy, but one of the problems was particularly difficult. He struggled with that third problem until minutes before the homework assignment was due.

Six weeks later, on a Sunday morning, Dantzig was woken up by the noise of someone banging on the door of his house. He opened the door and was surprised to see his professor, Jerzy Neyman, at the door holding a handful of papers. His excited professor said, "I've written an introduction to one of your papers! Read it so I can send it out right away for publication!"


As it turns out, two of the three problems on the blackboard were not homework problems, but famous unsolved problems in mathematical statistics. Without knowing it, Dantzig solved two unsolved statistics problems for homework.


Later on, when Dantzig was having difficulty finding a topic for his thesis, Neyman told him to just put his solutions to those two problems into a binder and that Neyman would accept the solutions as Dantzig's thesis.


Sources: George Dantzig , Dantzig Obituary , The Unsolvable Math Problem



View Answer on Quora