Thread: ideas for my C++ book

  1. #1
    Normal vector Carlos's Avatar
    Join Date
    Sep 2001
    Location
    Budapest
    Posts
    463

    ideas for my C++ book

    Hi,

    I'm nearly ready with the plans for my C++ book. I tried a somehow different approach of this great programming language in my book, and the publishers seem to like it.
    I'd appreciate if you would give me some ideas regarding which parts of C++ have you found the most difficult.

    So, if you have further ideas, you are welcome, and I'll mention your name in my book.

    Here are the parts I'm already discussing in my book:
    1.) Introduction: myths and reality about programming and programmers; Programming - art or industry?

    2.) C++ and the OO concept; why is C++ considered as an OOP?
    This chapter is about data hiding, inheritance and polymorphism in C++

    3.) Variables and constants
    Declaration to naming. Hungarian notation. Scope and lifetime. Global and local vars, the static keyword. Type casting and problems invoked by casting.

    4.) Pointers
    A detailed description on pointers. The reference. A special pointer: "this".

    5.) Operations, operators
    Arithmetical, relational, logical and bitwise operators.
    Operator overloading.
    Operator evaluation order.

    6.) Functions
    Declaration and definition.
    Program arguments. Pointers as arguments.
    References as arguments.
    Function'S return value.
    Recursivity. How to avoid stack overflow.
    Function overloading.
    Template functions.

    7.) Classes, unions, structs
    Differences and similarities.
    Special typecasts : dynamic_cast, static_cast
    Template classes

    8.) Inheritance
    A detailed description of inheritance.

    9.) Source code styling. C++ programming guidelines.
    The role of header and source files.
    Indenting the code.
    Comments.
    Function description.
    ...

    10.) STL - the C++ standard template library
    Introducing STL. A problem: inter-process communication and STL

    11.) Error handling and logging. Exception handling.
    Bug hunt under MS Visual C++
    Debugging, conditional breakpoints, the call-stack, the assembly-view
    Remote debugging
    Tracing and it's importance
    The try-throw-catch mechanism
    Be prepared - there's no bug - free software!
    Error logging - a sample class
    ---------------------------------------------
    Thanks in advance!

    Have a nice code!
    Last edited by Carlos; 09-19-2003 at 06:02 AM.

  2. #2
    Registered User
    Join Date
    Sep 2003
    Posts
    23
    Maybe what is ANSI C++, what is not and what it is good for.

    And something about functions: inline, virtual, pure virtual and const functions, mainly the last ones.

    Comparing float variables (for example 0.1 * 10 may be different from 1.0, because of binary representation of 0.1, which is periodic).

    Memory management. For example what should overloaded operator + return? Reference, or value? When are local variables on the stack destroyed?
    And delete[]. What about overloading new and delete? And constuctions like
    Someclass *t = new(1) Someclass(5);

    Namespaces.

    Templates with exceptions.

  3. #3
    Normal vector Carlos's Avatar
    Join Date
    Sep 2001
    Location
    Budapest
    Posts
    463
    Originally posted by aerian
    Maybe what is ANSI C++, what is not and what it is good for.

    And something about functions: inline, virtual, pure virtual and const functions, mainly the last ones.

    Comparing float variables (for example 0.1 * 10 may be different from 1.0, because of binary representation of 0.1, which is periodic).

    Memory management. For example what should overloaded operator + return? Reference, or value? When are local variables on the stack destroyed?
    And delete[]. What about overloading new and delete? And constuctions like
    Someclass *t = new(1) Someclass(5);

    Namespaces.

    Templates with exceptions.
    Great, thank you!

  4. #4
    Registered User Dante Shamest's Avatar
    Join Date
    Apr 2003
    Posts
    970
    You might also like to add a section on Graphical User Interface (GUI) programming. 99% of C++ books neglect that.

    They should at least mention that the standard library doesn't have any GUI classes/functions, but that you have to rely on native APIs or toolkits. It'd be cool if you devote a brief section on them.

  5. #5
    Normal vector Carlos's Avatar
    Join Date
    Sep 2001
    Location
    Budapest
    Posts
    463
    Originally posted by Dante Shamest
    You might also like to add a section on Graphical User Interface (GUI) programming. 99% of C++ books neglect that.

    They should at least mention that the standard library doesn't have any GUI classes/functions, but that you have to rely on native APIs or toolkits. It'd be cool if you devote a brief section on them.
    I guess there would be problems with the portability, that's why no graphics are included in the ANSI C++.

  6. #6
    pronounced 'fib' FillYourBrain's Avatar
    Join Date
    Aug 2002
    Posts
    2,297
    I don't see anything in there about basic program flow constructs like loops and conditionals. Is this not supposed to be a ground-up C++ book?
    "You are stupid! You are stupid! Oh, and don't forget, you are STUPID!" - Dexter

  7. #7
    Normal vector Carlos's Avatar
    Join Date
    Sep 2001
    Location
    Budapest
    Posts
    463
    Originally posted by FillYourBrain
    Is this not supposed to be a ground-up C++ book?
    The main intention was to explain the most interesting / obscure things in C++, but maybe you're right.

    Besides, the publisher requested about 300 pages, so I'll probably include this basic flow constructs, too.

  8. #8
    Senior Member joshdick's Avatar
    Join Date
    Nov 2002
    Location
    Phildelphia, PA
    Posts
    1,146
    This may sound obvious, maybe not, but whatever you do, make sure that all of the code you write conforms to the standard. If you don't, people won't respect you or buy your book.
    FAQ

    "The computer programmer is a creator of universes for which he alone is responsible. Universes of virtually unlimited complexity can be created in the form of computer programs." -- Joseph Weizenbaum.

    "If you cannot grok the overall structure of a program while taking a shower, you are not ready to code it." -- Richard Pattis.

  9. #9
    Registered User
    Join Date
    Mar 2002
    Posts
    1,595
    Arrays and their relationship to pointers.

    the keyword friend and it's uses.

    The difference between literal strings, C style null terminated char arrays (and the different ways to declare/initialize them), and STL strings.

    istream methods/operators and what (can) happen(s) when you use a variety of them in the same program.

    Conversions from one type to another via casting, conversion operators, strstream/stringstream classes, etc.

    File management.

    Modular programming.

    Controlling the printer from DOS, console, GUI.

  10. #10
    Hardware Engineer
    Join Date
    Sep 2001
    Posts
    1,398
    The main intention was to explain the most interesting / obscure things in C++, but maybe you're right.
    From your outline, I couldn't tell what the purpose/goal of the book is.

    Make it clear to the potential buyer/reader (and to yourself) what the purpose of the book is, what topics are covered, and who the target reader is (and what the reader needs to know before reading your book).

    300 pages are NOT enough space to cover the basics and all this other "obscure" stuff.

    There are two types of books that I like:

    1- Tutorial books. I like books that are designed and structured for self-learning with explanations, examples, questions & exercises (with answers and solutions).

    2- Reference books. Reference books should cover their specific topic completely. A good index is mandatory, and examples are helpful.

  11. #11
    Registered User
    Join Date
    Jan 2003
    Posts
    78
    Hi Carlos!

    Will your book be distributed in the United States?

    -Rog

  12. #12
    Normal vector Carlos's Avatar
    Join Date
    Sep 2001
    Location
    Budapest
    Posts
    463
    Originally posted by joshdick
    This may sound obvious, maybe not, but whatever you do, make sure that all of the code you write conforms to the standard. If you don't, people won't respect you or buy your book.
    Of course, I thought of that. Everything is ANSI C++.
    However, some sources in the Error handling chapter will be MS Visual C++ specific.

    Originally posted by DougDbug
    From your outline, I couldn't tell what the purpose/goal of the book is.

    Make it clear to the potential buyer/reader (and to yourself) what the purpose of the book is, what topics are covered, and who the target reader is (and what the reader needs to know before reading your book).
    My primary goal is to discuss some interesting parts of C++, and a whole chapter is dedicated to Error and exception handling.
    The book should help a newbie to easily understand e.g. pointers and inheritance, but I'm trying to dig deeper -especially through examples - into problems which are met day by day by professional programmers - e.g. pointer validation, using pseudo-registers, etc.
    I think there are enough classical books on the market, which are from one of those two categories mentioned by you: tutorials and reference books. Well, mine will be different, call it "Working with C++"

    Originally posted by Rog
    Will your book be distributed in the United States?
    I don't think so, it will be published in Hungary, but who knows?

    Further ideas are still welcome!
    Thank you very much, guys!

  13. #13
    Carnivore ('-'v) Hunter2's Avatar
    Join Date
    May 2002
    Posts
    2,879
    Has anyone mentioned function pointers?
    Calling conventions?
    A programmer-jargon reference?
    A section on career planning?
    Just Google It. √

    (\ /)
    ( . .)
    c(")(") This is bunny. Copy and paste bunny into your signature to help him gain world domination.

  14. #14
    Registered User
    Join Date
    Aug 2003
    Posts
    1,218
    Well I only have one suggestion and that is, never use code examples that uses things you havent covered yet, I have personal experience on this (Learn yourself C++ in 3 weeks) and I got all confused and went like, "hey am i supposed to understand everything here or what??" and you will probably confuse the reader more than help him/her, and if you really need to use things you havent covered yet you should make it completely clear for the reader that he/she doesnt need to understand everything.

  15. #15
    Grammar Police HybridM's Avatar
    Join Date
    Jan 2003
    Posts
    355
    Hi Carlos,

    First of all good luck on your book!

    I think a lot of newbies really struggle when they try to understand multiple file projects. I can't say for sure, so far I've only read one book, but judging by the amount of people that are confused, I would guess many books don't cover multiple files.

    You should cover headers, what to use them for and what not to use them for, why not to include .cpp, maybe explain a bit of the behind the scenes work involved in linking etc.
    Thor's self help tip:
    Maybe a neighbor is tossing leaf clippings on your lawn, looking at your woman, or harboring desires regarding your longboat. You enslave his children, set his house on fire. He shall not bother you again.

    OS: Windows XP
    Compiler: MSVC

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. How to make a chain-structure
    By MalickT in forum C Programming
    Replies: 12
    Last Post: 03-27-2008, 05:51 AM
  2. Looking for a c++ book, didn't were to post this...
    By Rune Hunter in forum C++ Programming
    Replies: 6
    Last Post: 09-24-2004, 06:32 PM
  3. Replies: 5
    Last Post: 09-19-2004, 06:52 AM
  4. Must read book!
    By RealityFusion in forum A Brief History of Cprogramming.com
    Replies: 7
    Last Post: 07-15-2004, 09:05 PM
  5. Should i get a new reference book?
    By Raison in forum Windows Programming
    Replies: 2
    Last Post: 06-15-2004, 10:43 PM