slashdot
[
Error: Irreparable invalid markup ('<stdio.h>') in entry. Owner must fix manually. Raw contents below.]
The main reason to introduce a student to more than one language is to begin without the more complex parts of languages like object oriented code, and even structured code. The nice thing about python is that you can start with procedural code, continue through structured code, and end up at object oriented code, introducing only a few concepts at a time.
With C, you have the problem of explaining the main() function or doing handwaving before you get around to explaining functions. With Java, you have the problem of classes even before you get to a main function. When even the most basic program requires structured or object oriented code, you have a problem teaching it to beginners. Take the following examples:
Java:
class myfirstjavaprog
{
public static void main ( String args[] )
{
System.out.println ( "Hello World!" ) ;
}
}
Student asks:
What is a class?, What is that funny looking bracket?, What is public?, What is static?, What is void for?, What is main?, What are the parenthesis for?, What is a String?, What is args?, How come there are funny square brackets?, What is system?, What does the dot do?, What is out?, What is println?, Why are there quotes there?, What does the semicolon do?, How come it's all indented like that?.
C:
#include <stdio.h>
main() {
printf ( "Hello, World!\n" ) ;
}
Student asks:
What is #include?, What are the greater than and less than signs doing there?, What is stdio.h?, What is main? What are the parenthesis for?, What is the funny bracket for?, What is printf?, Why is hello world in quotes?, What is the backslash-N doing at the end?, What is the semicolon for?
Python:
print "Hello World"
Student asks:
What is print?, Why is hello world in quotes?
Get the picture?
nosperts te: http://ask.slashdot.org/comments.pl?sid=179567&cid=14871930
(Lasīt komentārus)
Nopūsties: