C++ Programming, 6th Ed (In Easy Steps) |
Author: Mike McGrath Getting started programming with C++ is probably more difficult than with any other language. This is not because C++ is a difficult language, but because of the range of other technologies that surround it that you have to master to get anywhere. So, presented with a slim 200 page book full of color pictures and boxouts, I was sceptical that it could cover the ground. The first chapter gets you started with the GNU (MinGW) compiler under Windows. Using MinGW under Windows is probably not the best choice these days as you would either use the Microsoft C++ compiler or the Windows Subsystem for Linux. After all the Microsoft C++ compiler is the one used to build Windows and most Windows applications. It is true however that GCC is something of a standard and apart from the trouble installing it and MinGW it is a good compiler but not the usual one for creating Windows apps. Next you are taken though a "hello world" example just to make sure you know how to create a program. I have to say that I was confused by the "Hot tip" on page 6 which says - "ISO" not an acronym but is derived from the Greek word "isos" meaning "equal" - as in "isometric". In this context ISO means International Standards Organization and so it is indeed an acronym. It also doesn't stand for Industry Standards Organization. Don't let this strange lapse put you off, however, the rest of the "Hot Tips" and other boxouts are more reasonable. By the end of Chapter 1 we have covered variables, arrays and constants and a lot of tiny details. This is a fast pace for the complete beginner. Chapter 2 moves on to consider operators, which is a very technical next subject for the beginner. It might be better to deal with flow of control in more detail first. At the end of this chapter you know about operators, precedence and casting. Chapter 3 introduces all of the C++ control statements - the if, switch, for and while. Functions, including overloading, are also introduced which again is a little odd. The last part of the chapter introduces recursion which is an unnecessary and potentially confusing challenge for a beginner. It should either be left for a later chapter or omitted completely.
Chapter 4 deals wtih C++ strings and is a fairly conventional treatment of how to do string manipulation. The same can be said of Chapter 5 which goes over the usual file handling procedures, but it also includes exception handling which is again slightly odd. You could argue that it is only when you deal with "external" resources like a file that the idea of an exception becomes important but I don't think I agree. Chapter 6 dares to explain the ideas of C++ pointers, which are essentially the same as pointers in C. References, which is a C++ concept and arguably safer and better than pointers, is introduced second. At long last we reach classes and objects in Chapter 7. This goes over the standard ideas of class, object, constructor and so on and even manages to introduce inheritance. Chapter 9 then goes on to look at polymorphism and other advanced ideas such as abstract data types. You more or less have the whole of the object-oriented method in about 30 pages. Chapter 9 deals with a topic that is often overlooked in C++ books - macros. A great deal of using C++ in the real world is about pre-processor macros which can make C++ look like another language if used aggressively. It is good to have an introduction to macros so that the beginner can start to try to understand the sorts of things that happen in real programs. Up to this point all of the examples have been console applications. Chapter 10 introduces a Windows application built using Visual Studio. The approach is to create a Universal Windows Platform UWP which is unfortunately now deprecated by Microsoft. In many cases a C++ programmer working under Windows would want to choose a different approach - raw Windows API, WPF, MFC, ATL or even Qt say. Even so it is quite good to have a rounding out chapter showing how a GUI fits in with C++ even if it isn't the one that Microsoft currently supports. This isn't an easy introduction to C++ but mainly because it is too short. You simply can't cram that much information into such a small book. However the size of the book makes it less intimidating and as long as you are prepared to work at it then it does contain a lot of what you need to know to get started. It would be better if the book took a more C++ approach to the language rather than treating it as if it was C. For example, rather than dealing with pointers, strings and files so early it would be better to introduces classes, objects and references and do the job in a C++ style. You can deal with pointers and other difficult stuff like recursion in a later chapter or a more advanced book. Even so this isn't a bad short introduction to C++ and it does cover macros and other real-world aspects of using the language. Its biggest problem is that it is just too short. However, if you are looking for a short introduction and you aren't a complete beginner you might find that it works for you. For recommendations For recommendations of C++ books see Top Choice C and C++ Books in our Programmer's Bookshelf section.
|
|||
Last Updated ( Wednesday, 01 November 2023 ) |