Talk:C++ Programming/Programming Languages/C++/Code/Statements

Missleading examples
Although the concept on the page and the approach seems pretty good, I stongly believe that the examples are bad choices. The worst problem, from my PoV, is that these examples are forcing phrases and statements that are, strictly speaking, false. The cout object is treated as if it were a keyword denoting an instruction (something like a goto, or even old BASIC's PRINT), while it's not. Despite its basic usage provides equivalent functionality to the one of PRINT, it's a very different thing. If the aim of the book were to teach the reader how to perform console output on C++, it wouldn't be an issue, but since the actual aim is to teach actual C++ to the user, this needs some fixing. The worst problem on these examples is that, the way they are presented, give the reader many wrong ideas (it will vary from reader to reader, but in general): Please note that I'm not asking such questions (I have some C/C++ experience), but I'm considering what a newcomer to C++ could think/understand from this page.
 * 1) Basic operations (such as console output) are performed with "weird" words (such as cout)?
 * 2) Those "weird" words use weird syntax? (What does the "<<" mean?)
 * 3) Until the section about blocks, only "cout" statements are used: does that mean that only "cout" statements are allowed out of code blocks?

As a solution, I'd rather suggest to use far more variety of statements, probably doing the same thing, hence showing the reader that there are many ways to achieve something in C++. For the first part of the page, I suggest using the old C's printf (which is still available in C++), then a cout.write; and finally a cout <<, so the reader will see several different statements and even figure out that this obscure "<<" is no more than a short-hand or syntax-sugar for the cout.write version.

Lack of focus
The page wanders too much into irrelevant talk and misses important information. For example, what does this mean?: ''The programmer either enters the statement directly to the computer (by typing it while running a special program), or creates a text file with the command in it, you can use any text editor for that. You could create a file called "hi.txt", put the above command in it, and give the file to the computer.'' Or to be more precise, what the hell means to give the "hi.txt" file to the computer?? Despite the fact that this phrase is, technically, a non-sense, the concept of what to do with the code once it's written is off-topic in this page: there is already a section in the book talking about compilers (I guess it should be expanded to mention interpreters, but that's not to be discused here). In the meanwhile, there are many questions that a page titled C++ Programming/Code/Statements should answer and this page does not: - What's an statement? A formal definition at the beginning of the page would be really helpfull. - What kind of statements are there? The page only mentions control flow statements: what about assignment, declaration or call statements? The page only says ''There are many different kinds of statements, depending on which programming language is being used. For example, there could be a beep statement that causes the computer to output a beep on its speaker, or a window statement that causes a new window to pop up.'' That will indoubfully cause a reader to believe that a line "beep;" would cause the computer to beep, or that "window << "This is my window";" would pop-up a window titled "This is my window". - Once again, more variety of examples should be provided.

Conclusion
I really think this page needs a lot of work. I'd be doing it myself if I had the time for it, but I currently don't have it. If I manage to squeeze some time for it, I'll take charge of the changes. Anyway, it'd be good if the author could post some reply, clarifying the intent of the page when it was written, so it can be kept. I guess it aimed to be not too technicall, but from that to including so many missleading information is too large a difference. If I come to edit (actually, remake it), I'll try to keep it as informal and friendly as I can, but not at the expense of good, useful content.

You had time to type this entire exposition up, but you don't have time to tweak the article itself? 72.219.14.103 03:27, 25 November 2007 (UTC)