Slashdot Mirror


Scott Meyers on Programming C++

Bill Venners writes "Artima.com has published a four-part interview with Scott Meyers, author of Effective C++, More Effective C++, and Effective STL. In Multiple Inheritance and Interfaces, Scott describes how his view of multiple inheritance has changed with time, the C++ community's take on Java's interface, and a schism of focus between the C++ and other prominent development communities. In Designing Contracts and Interfaces, Scott discusses interface contracts, private data, and designing minimal and complete interfaces. In Meaningful Programming, Scott discusses the importance of saying what you mean and understanding what you say, the three fundamental relationships between classes, and the difference between virtual and non-virtual functions. In Const, RTTI, and Efficiency, Scott describes the utility of const, the appropriate time to use RTTI, a good attitude about efficiency, and Scott Meyers' current quest for general programming principles."

3 of 69 comments (clear)

  1. Java has no templates... by SilenceDK · · Score: 2, Insightful

    Meyers is apparently not the only one thinking that java needs templates: Preparing for Generics

  2. Re:Good articles by adamy · · Score: 2, Insightful

    One way that they are used is to define a short cut to a set of a constants. Put all you constants in an interface, and then any class that needs those constants can implmenbet the interface, and they car refere to the constants without using the entire class path.

    Also, many classes use them for related Symbolc constants to functions that are overly flexible. See the Calendar implementation for get/set (Yes, an ABC, not an interface, but the result is the same).

    I actually think of this as an indicator of Bad design. Use of symbolic constants, especially as a replacement for Enum, is a serious breach of OO design in most cases. Static immutable instances of classes that the enum represents are quite often a better way to go. This was a tip I got from the other Effective Book: Effective Java
    Found here at Amazon

    --
    Open Source Identity Management: FreeIPA.org
  3. Re:Good articles by Anonymous+Brave+Guy · · Score: 3, Insightful
    Does anyone know why interfaces have data members at all?

    They wouldn't normally have state, but there might be constants relating to the interface itself, typically passed used when determining what parameters to pass to functions in that interface. Given Java's lack of enumerated types, this is particularly important to avoid passing magic numbers or arbitrary boolean parameters everywhere.

    --
    If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.