Archived

This topic is now archived and is closed to further replies.

Russell

Interview with Bjarne Stroustrup

Recommended Posts

Guest Anonymous Poster
No, I actually think it is a rather terrible read. I once read an interview Martin Fowler by Bill Venners.(http://www.artima.com/intv/refactor3.html) and I was annoyed by his stupid and slow paced questions. Reading the interview with Bjarne, I can see he still uses the same dull interview style. Its almost as if he doesn''t understand what Bjarne is talking about, or he is trying to represent a reader with no knowledge. For example, he goes on and on about invariant related to classes. I mean, how many times should Bjarne reiterate himself before Bill stops repeating his questions?? Its not that the concepts are that hard to understand..

"Bill Venners: What do you mean by invariant? "

"Bill Venners: So the invariant justifies the existence of a class, because the class takes the responsibility for maintaining the invariant. "

"Bill Venners: The invariant is a relationship between different pieces of data in the class. "

"Bill Venners: It''s not necessary because there''s one and only representation. The justification is usually that if you make it a function, then you can change the representation. "

"Bill Venners: You said that the invariant helps you decide what goes into the interface. Could you elaborate on how? Let me attempt to restate what you said, and see if I understand it. The functions that are taking any responsibility for maintaining the invariant should be in the class. "

"Bill Venners: Anything that''s just using the data, but not defending the invariant, doesn''t need to be in the class. "

Share this post


Link to post
Share on other sites
Anonymous Poster, whoever you are...

I didn''t post it because of anything Bill Venners said. Are you some kind of interviewing critic? The content is what is important, and what Bjarne says is something a lot of C++ programmers should read. There is a lot of C-style C++ code out there, as well as unecessarily over-OOPtified code.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Yes, Bjarne has some interesting points, I agree. At 4 pages I just think there is too much redundant information, and that is due to the inverviewing questions not proceeding at a normal pace IMHO. So yes, I guess you could call it an interview critique. Not normally something I would bother about, but the exact same thing happened with his Martin Fowler interview, and it''s a shame as both are worth listening carefully to.

And lets face it, interesting as it is, it is not rocket science that old C programmers inherit bad programming habbits while other programmers overdo OO. Start using the C++ Standard library has also been preached for many years (by Scott Meyers for example). However, I found it interesting his idea about having a static library of functions working on a class (given that they do not alter the class) instead of having the functions as members of the class.

Share this post


Link to post
Share on other sites
Good stuff. I especially liked this quote:

quote:
You can program with a lot of free-standing classes. If I want a complex number, I write a complex number. It doesn''t have any virtual functions. It''s not meant for derivation. You should use inheritance only when a class hierarchy makes sense from the point of view of your application, from your requirements.


In my short time on these forums, I''ve seen lots of examples of bad inheritance hierarchies of unrelated classes.

--
Dave Mikesell Software & Consulting

Share this post


Link to post
Share on other sites
I rather liked the interview, even if Bill Venner made it drag out more than necessary...

I especially agree with this part:

quote:
Going to the big class hierarchy is again, you write more code than you need to, and you get too much connection between different parts.


I see this a lot, not even necessarily with inherited classes, but just in general with OO code. If you have a member function foo() inside a class that operates on data X, that function is tied to that class. If you then create another unrelated class which also needs a foo() function that operates on its data X, then people often duplicate code or use inheritance even though it''s not really appropriate.

quote:
I particularly dislike classes with a lot of get and set functions. That is often an indication that it shouldn''t have been a class in the first place. It''s just a data structure. And if it really is a data structure, make it a data structure.


If you expect the structure to be a victim of lots of change, then it justifies the extra functions but I like his point that at some point you have to commit to some design decisions.

Raj

Share this post


Link to post
Share on other sites
quote:
Original post by Anonymous Poster
And lets face it, interesting as it is, it is not rocket science that old C programmers inherit bad programming habbits while other programmers overdo OO. Start using the C++ Standard library has also been preached for many years (by Scott Meyers for example).
You''re right. It''s nothing new. But on forums and newsgroups you see people saying everything under the sun, and who are you supposed to believe? Maybe they''re great programmers, or maybe they''re 12 years old spouting off stuff they''ve heard from other misguided people. It''s good to hear it from the creator of the language.

Share this post


Link to post
Share on other sites
quote:
Original post by RajanSky
see this a lot, not even necessarily with inherited classes, but just in general with OO code.


and thats the failure both java and c# and possibly others are based on. they are just one huge oo hirarchy-tree.

i prefer languages with free functions and all free combinable.




If that''s not the help you''re after then you''re going to have to explain the problem better than what you have. - joanusdmentia

davepermen.net

Share this post


Link to post
Share on other sites