Re: Visual C++ vs Visual C#

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



My basic idea is that the first program should not contain any language
features which will not be taught immediately. I have a big beef with java,
where beginning programmers must learn a 15-ish-line incantation that seems
to be magic (public class, public static and array [] on main,
System.out.println). I see the idea of learning C++ without learning C to
be fraught with the same perils. The hello world program in a class on C++
should be as simple as possible, which means this:

#include <stdio.h>

int main(void)
{
puts("Hello World!\n");
return 0;
}

Every single token in this program can be easily explained, there is nothing
that has to be learned by rote. Compare with a similar "pure C++" program:

#include <iostream>

using namespace std;

int main(void)
{
cout << "Hello world" << endl;
return 0;
}

We've added namespaces and shift operators for no gain, and even "cout"
doesn't mean nearly as much as puts (= put string). These extra things are
memorized instead of understood.

C would naturally progress toward:

#include <stdio.h>

int main(void)
{
char c;
for (c = 'A'; c <= 'Z'; c++) {
putchar(c);
}
}

and

#include <stdio.h>
#include <conio.h>

int main(void)
{
puts("Please press Q:\n");
char c = getch();
if (c == 'q' || c == 'Q') {
puts("Thank you.\n");
}
else {
puts("You didn't press Q.\n");
}
}

Now, introduce a user-defined function and mathematical operators. Then
scope, and using the same name in different scope. Then namespaces. All
with just a tiny handful of functions from ANSI and POSIX C, and no
pointers. Write a function to print a number in decimal, hexadecimal, and
binary using just putchar. Still no pointers. At this stage there's enough
understanding of program design to start bringing in pieces of the C++
standard library like cout which are easy to use but *really* complicated
underneath, and that complexity will show up in error messages.


.



Relevant Pages

  • Re: eshewing CLOS-style OOP in Common Lisp?
    ... > class LotteryWidget: ... In fact namespaces in C++ function about as packages in Lisp. ... static int get ...
    (comp.lang.lisp)
  • Re: C is too old? opinions?
    ... I am relativ new to the impressive and powerfull C language, but i thinks it is obsolete... ... Why has C not namespaces and a "area idea" where some methods and fields could be hidden from the outside? ... private int[] myStack; ... If i was a really good programmer (which i'm not... ...
    (comp.lang.c)
  • Re: C is too old? opinions?
    ... I am relativ new to the impressive and powerfull C language, ... Why has C not namespaces and a "area idea" where some methods and ... private int[] myStack; ... public int pop(); ...
    (comp.lang.c)
  • C is too old? opinions?
    ... I am relativ new to the impressive and powerfull C language, but i thinks it is obsolete... ... Why has C not namespaces and a "area idea" where some methods and fields could be hidden from the outside? ... private int[] myStack; ... public int pop(); ...
    (comp.lang.c)
  • Re: A taxonomy of types
    ... I am describing how to represent the representation (and, ... if the system follows static typing rules (such as in a compiler), ... so, the hardware sees pointers and pointer arithmetic, but the compiler ... "Besides the char types, up to three sizes of integer, declared short int, ...
    (comp.lang.misc)