About the book “MS Visual C ++ 2010 in the .NET Environment. Programmer's Library ”

    If you look at my reviews of books (*), then there may be a suspicion of bias, because the reviews are either positive or enthusiastic. This situation is explained quite simply: before undertaking to read a book, it is wise to carry out “reconnaissance in battle” and find out how reading this or that book is useful and relevant. If the reviews on the book are good, the author inspires confidence, and the topic is interesting, that is, there is every chance that you will not regret the lost time. If the reviews are purely negative and a mile away pulls the style of writing “For Dummies” in the worst sense of the word, then you should not waste time on such a book.

    Today, there will be an exception to this rule, associated primarily with the fact that this is not a review, but the results of the “reconnaissance in battle” mentioned above, but it was more than enough to give a very concrete impression of this creation.


    From time to time I look at the news that our domestic publishers indulge us with and the other day I saw that Peter published a book called "MS Visual C ++ 2010 in the .NET Environment" from the series "Programmer's Library" (**) about Visual C ++ from a certain Ziborov V.V. Since the very fact of the publication of a book in such a series means a lot, I was not too lazy to read the annotation, to scroll through the contents and a fragment of one of the chapters, and this is what I think about it.

    1. Title and abstract

    The title of the book, as well as its cover, is an important component of any book, since it is from them that the potential reader begins to get acquainted with it. At the same time, it is desirable that the title give at least a minimal idea of ​​what the reader expects inside, and the look at the cover does not dislocate the eyes. The title of this book alludes to the fact that it will focus on C ++ / CLI (this is also confirmed by the annotation), but what it does not say is that the book is a collection of recipes.

    Easy googling by the name of the author makes it clear that this is not the first creation of Comrade Ziborov; in addition to this book, he has two more: “ Visual Basic 2010 with examples ” and “ Visual C # with examples"And even a cursory reading of annotations makes it clear that these are three acrobat brothers packed in different guises. However, unlike the two previous books published by the BHV Petersburg publishing house, the comrades from the Peter publishing house decided not to scare away potential readers with all sorts of “examples”, but to name the book more streamlined, which is quite logical.

    Quote: “There are many different original authoring solutions to programming problems that the reader cannot find on the Internet.”

    The creator of the annotation is frankly zhot. I understand everything, each of us has a tendency to exaggerate, but to write about the fact that in the collection of tips there are "original author's solutions" is an overkill. Anyway, how in our age of the Internet can we talk about unique solutions that cannot be found on the Internet? After all, if they are so unique, then they will be trumpeted at all well-known forums on software development and they will cease to be unique in a week. Although, I must admit, the "unique" tips in the book are true, but more on that later.

    2. Content

    Next, after the title of the book and a short annotation, is a table of contents. Often, it is the table of contents, and not the annotation, that makes it clear to the reader what awaits him inside. The reader can get an idea of ​​what he will get as a result of what topics will be considered, how much is devoted to particular sections in order to more accurately determine what is being discussed and what is the depth of the material under consideration.

    Even if the book is built on the basis of examples, it is desirable that they be grouped in such a way as to simplify the perception of new material. So, for example, it is reasonable to give a minimum of new concepts at one time, considering topics from simple to more complex, considering in one chapter the most coherent concepts. This will allow the reader to "plunge" into the topic in question and "abstract" from unnecessary details, focusing on the most important thing.

    Now let's look at the contents:

    Chapter 1. The simplest programs with a screen form and controls.


    Example 6. Font style control using the CheckBox

    control Example 7. Bitwise exclusive OR operator

    Example 8. TabsTabControl and RadioButton switches

    . First, how to start acquaintance with a new programming language (and judging by the annotation, then this is one of the target audiences of the book) from the user interface, and not from a simple console application? I know that there is a category of readers who want to see a “finished application” with minimal effort, but what does this have to do with the C ++ / CLI language? Indeed, in this case, the reader gets acquainted not only with the new programming language, but also with the Win Forms library, which greatly complicates the perception of the material.

    Then, I do not understand the grouping of topics. Well, who then guesses to find an example with an “exclusive OR” in the chapter on “simple programs with a screen form”, and even between the examples with CheckBox and TabControl? And in general, since they took up bit operators, it is so reasonable to bring the matter to the end and consider them all.

    Chapter 2. Programming console applications ... 47

    Example 12. Input and output in a console application ... 47


    Example 14. Calling the MessageBox :: Show

    method in a console application. Date and time format ... 51 Example 15. Calling Visual Basic

    functions from a C ++ program ... 52 Example 16. A remarkable data structure is the Dictionary dictionary ... 53

    It’s hard for me to imagine how much heterogeneous information piles on a poor reader on just a dozen pages of a book (I specifically cited page numbers). What is the value of considering the date and time format in the example with MessageBox, and even in the chapter on console applications? And what is the use of calling Visual Basic functions from a C ++ program? Something seems to me that this is not the most common task and it will not help in any way to advance in learning the C ++ language. And the name of Example 16 generally resembles a phrase from the book “C # in 15 Minutes” that was poorly translated by an electronic translator.

    Know why John Skeet’s book “C # In Depth”read so easy? For one simple reason: John examines one concept at a time (his famous phrase “one step at a time,” which he uses a dozen times in his book). This allows the reader to "abstract" from unnecessary details at a given time and focus on the main thing: the study of a certain concept of the language. In programming, we do the same thing all the time to deal with the inherent complexity of software; after all, we are guaranteed to get a “mass" if we dump a dozen concepts not connected with each other in one essence.

    Chapter 12. Other tasks that can be solved using Windows Application

    Example 98. Managing the transparency of the form

    Example 99. GMT in a translucent form

    Example 102. Playing sounds of the operating system

    If in the chapters devoted to a certain topic there was leapfrog, then what about the chapter, which is specially devoted to everything at once. When the reproduction of sounds (by the way, is also a very dubious topic) is considered next to Greenwich Mean Time, and even in a translucent form, it causes at least a smile. Can it really be impossible to get GMT time in an opaque form or without a form?

    Between chapters 2 and 12, the author considers almost all the topics that Troelsen took about a thousand pages: starting from working with files, ending with ADO.NET technology and using AutoCAD functions and creating a PDF file. Apparently, interaction with AutoCAD is really a killer feature, since this is mentioned in the annotation, but for some reason it seems to me that this is not such a frequent task, but oh well, this is a matter of taste. Move on. More precisely, we return one chapter back to which we would like to devote a separate section.

    3. Chapter 11. Using LINQ technology .

    This chapter should be given a separate section for two reasons. Firstly, in C ++ / CLI there is no syntactic sugar for creating anonymous delegates (C ++ 0x lambdas do not count, this is a completely different matter), which makes using LINQ quite ... let's say, a “verbose” thing. And secondly, this chapter is in the public domain on the publisher’s website, so that we can get acquainted not only with the content, but also with the content.

    Since this book is still a collection of examples, then let's immediately look at the beginning of one of them:

    bool Предикат(String ^ S)
     // Если число букв равно шести, то возвращаем true:
     bool A = false;
     if (S->Length == 6) A = true;
     return A;
    String ^ Предикат2(String ^ S)
     // Переводим строку в верхний регистр:
     S = S->ToUpper();
     return S;

    * This source code was highlighted with Source Code Highlighter.

    So, the annotation says that this book is intended “for beginners, middle-level programmers, as well as for programmers who have experience developing in other languages ​​and want to quickly learn the new MS Visual C ++ / CLI language.” But here in a dozen lines of code is a whole bunch of “smells”:

    1. use of Russian names ;
    2. use of non-informative names of functions and variables ; never, never, never, no, you didn’t understand, never ever name functions and variables in this way ; it is bullshit that has no right to exist even in the examples! The funny thing is that the very first section of this book is called: What is a “good programming style”? , apparently the author deliberately quoted the last three words. What are the names Predicate and Predicate2, and how can the name of the variable A help the reader?
    3. change the value of the parameters ; I recall that changing the value of the parameters is considered a bad manners, since the code reader must clearly understand that the original object S in the Predicate2 method has not changed, since the link itself is passed by value.
    4. Invalid naming style It is customary to call parameters and local variables in .Net environment in the form of camelCase, names like S and A contradict this rule.
    5. Predicate2 is not a predicate ; For example, it always seemed to me that a predicate is such crap that returns true or false , and quick google confirms this opinion .

    I'm not talking about the fact that you can reduce the number of lines in a method from 3 to one:

    bool LengthEqualToSix(String^ s)
      return s->Length == 6;

    * This source code was highlighted with Source Code Highlighter.

    Next is the use of all these “predicates” using the static methods of the Enumerable class. But since there are no such things as extension methods and Method Group Conversion in the C ++ / CLI language, this does not look the best way:

    // Из массива имен получаем список имен, длина которых - шесть букв:
    auto Запрос = Enumerable::Where(Имена, gcnew
    // Сортируем полученный список в алфавитном порядке:
    Запрос = Enumerable::OrderBy(Запрос, gcnew

    * This source code was highlighted with Source Code Highlighter.

    There are other pearls, such as defining a field with the name: bool Smokes; in the Employee class , or creating a list of employees by an array of employees before using the methods of the Enumerable class (apparently the author does not know that the static methods of the Enumerable class are applicable to the array in the same way as in a sheet); and predicates of the following form:

    bool Предикат(Сотрудник S)
     // Если сотрудник не курит, то заносим его в список некурящих:
     bool A = false;
     if (S.КуритЛи == false) A = true;
     return A;
     // Можно было бы записать короче:
     // return !S.КуритЛи;
     // но более запутанно

    Месяц Предикат2(Месяц t)
     return t;

    * This source code was highlighted with Source Code Highlighter.

    Why the author did not like the alternative entry and why the variable of the Month type is called t and why only in this case the variable name is written in lower case, I do not know.


    I want to be understood correctly: I have no complaints about the author who wrote one book and replicated it using examples in different programming languages. And I would not have any questions for the publisher if the cover of this book were yellower and came out in the series “For Dummies”. But releasing SUCH in a popular and well-known series, next to the famous works of such recognized world experts as Spolsky, Boxing, Hunt, McConnell and many others, seems like a crime.

    Guys publishers, there are a lot of interesting books on programming on the .Net platform, including the C ++ / CLI language, which can take their rightful place in the programmer’s library, but this book is clearly not one of those (***).

    As for the potential reader, I simply don’t see it for this book: the examples in the book are of too low quality for even a beginner to use, and the style of narration and grouping of the material are such that they hardly linger in the head of an unprepared reader. The prepared reader will treat this book as a humorous book rather than as a programming book.

    Yes, I almost forgot not to rummage for a long time, here is the content , but here is a fragment of the chapter .


    (*) All my reviews, as well as some reviews and book announcements, can be found here .

    (**) I must say that in this series good books are published, such as, for example, Eckel’s Java Philosophy, Martin’s Clean Code, Gang Four Design Patterns and many others. I mean, this is not a series like “Learn everything in the world in 15 minutes in a dream”, this is a very serious series of books.

    (***) As a starting point when searching for books on programming on the .Net platform, you can start from the following list: Classical books on C # /. NET .

    Also popular now: