[Skip Navigation] [Remove Frame] [CS320] [Text Version] cs320.FAQ.html Sat Dec 23 07:59:49 PST 2006
Opening the PDF files on this page may require you to download Adobe Reader or an equivalent viewer (GhostScript).

Contents


    CS320 Frequently Asked Questions

    These FAQ(Frequently Asked Questions) are at [ cs320.FAQ.html ] in the CS320 course materials.

    How can I use my PC at home

    (1) Use sneakernet and disk. (2) Use SSH and dial in as a terminal window. (3) You can download some free software for Windoze for some of the languages.

    It is at your own risk.

    Where is the Online stuff for this course

    Point any world wide web (WWW) browser or WebTV etc at [ http://cse.csusb.edu/dick/cs320/ ]

    Here are some other local sites about computer languages [ http://csci.csusb.edu/dick/samples/ ]

    How do I read the material for this class

    On your workstation:
     netscape http://www/dick/cs320/&

    In a terminal window try:

     	lynx http://www/dick/cs320/

    Is language A better than language B

    No.

    Is language B better than language A

    No!

    What is the best language

    This is like asking: Which is best: cats or dogs? You can debate this forever. Some people have strong likings for dogs and some for cats. You can write essays and papers on cats vs dogs. It all depends on what you mean by "best" and "cats" and "dogs".

    You can recognize someone who doesn't really understand programming languages because he or she thinks they know the perfect language for all tasks. They belive this because they don't know enough about the other languages.

    Each language has its own fans. Each language is better than most other languages for some tasks. Each language has good points and bad points. Theoretically all languages are capable of simulating a Turing machine and so can solve any solvable problem....so they are all equally powerful. A a programmer complains about the language. But a Computer Scientist knows how to compensate for a defects or take advantage of a special features instead.

    Why did Y choose language X

    For any language X, they used X last time

    OR

      if X=Ada then they were ordered to do it.

      If X=C then they are willing to sacrifice reliability to expressivity or they had UNIX or they need to run the programs on many different types of computers.

      If X=Assembler then they never expect to change chips and want to sacrifice maintainability for execution speed or they don't want anyone to understand or copy what they are doing.

      If X=FORTRAN then they write scientific programs with lots of mathematical formulae.

      If X=COBOL then they have millions of lines of previous code and/or their programs calculate monetary values (COBOL provides a data type for money). and/or they do lots of large scale file processing - sorts, reports, data vet, etc.

      If X=C++ or Java: Fashion, also see [ first.language] .


    How does C++ differ from C and Java

    C has two forms: K&R C (old and dead) and the standard ANSI C. C++ (1) fixes some dumb things in C, and (2) adds objects, classes, inheritance, encapsulation, polymorphism, and templates. Java throws out all the powerful, risky, and non-object-oriented concepts from C++ including templates.

    Are there any more FAQs

    Read The Famous CS FAQ! [ CS_FAQ.html ]

    What is void

    'void' and 'void *' in C and C++ are kludges. The philosophy of C is that all subprograms are mathematical functions like sin, cos, and sqrt. However C functions also do things(printf, scanf) and some them do not calculate any thing sensible(fclose). Here are three uses of void.

    (a) In C if you don't specify the type of a returned value it is assumed to be an int. An undefined and meaningless integer was left behind if no value is explicitly returned. The word void is used to document such a function. So void is not a type of data in this usage, but indicates the absence of data. Thus a C void function has no return values and can not be called in an expression. A subprogram that returns no value should be called a procedure.

    (b) In C++,

     	type f2();
    indicates that no arguments are allowed and
     	type f2(...);
    that no checking takes place at all. Note:
             type f3(arg1, arg2, ...);
    expects 2 or more arguments.

    In ANSI C, a function with no arguments has a prototype like this:

             type f1(void);
    The compiler will not permit you to give f 1 any arguments. However
             type f2();
    lets you put in any arguments you like....even if the result is rubbish.

    (c) In ANSI C void* also appears and means something quite different to plain void. Plain void indicates the absence of data. void* indicates the address of some data of unknown type. It is only used for formal arguments of functions. This functions can be written to use any type of data. An example is qsort in the standard C library. But a void* points at objects of unknown size, so pointer arithmetic is not defined on them. So void* arguments can not have subscripts and the * operator is undefined on them! Instead the size of the data is put in a different argument and, internally, the void* pointer is cast into a char* and all access to the objects is done using the explicit size and memory copy functions.

    [ void in c++.glossary ]

    What does Object Oriented mean

    This is a good essay question but there is no short answer -- see chapter 12 in Sebesta.

    Why do people use languages with bad properties

    The bad property arises because of some good property that is more important. For instance - APL is unreadable because it is writable. C is dangerous because it is powerful , obedient, and close to the machine. Prolog is slow because it tries to do more of the work for us.

    Why do we study many languages in one course

    If we were doing botany we would study many different plants to learn about all plants. Computer scientists study many special languages so that we can learn about the properties in common to all languages. By doing this, we become better at learning to use new and old languages, better at choosing a language, and better at designing new languages. Now all language standards are updated every 11 years. A new language is invented every month or so, somewhere in the world. It is therefore worth becoming good at learning languages.

    I have problems with pointers.

    This is normal. This is why some languages have none: FORTRAN, COBOL, Algol 60, Edison, Basic, Java etc. Other languages try to control them: Pascal, Ada, ... One problem is that there is no abstract semantics for pointers. You have to think in terms of the machinery instead.

    Here are some rules to live by: Pointers are either addresses or NULL. If a is an address then (in C and C++) *a is what is in that address. If a is not initialized *a can be any art of the machine. If a is NULL *a causes the program to crash. Always check whether an expression needs the address of something or the contents of something. A char is not a char* .

    Hints: (1)In C, put a 'p' in the name of all pointers. (2) Initialize all pointer variables(to NULL, new, malloc(...), or calloc(...). (3)always always always check that each pointer is not null before it is used in a while/if/case/.... (4) work slowly by hand through every piece of code using invented numbers instead of addresses.

    In C++ use references instead and embed inside classes with constructors and virtual destructors!

    What language is best for graphics and/or interactive programs

    Languages for amateurs like Visual BASIC, HyperTalk, and Java have graphics. LOGO, Smalltalk, and my own PICTALGOL(1967..1972, RIP) were designed for this.

    There are no standards yet. X windows, PHIGS and/or GKS may end up being standards. The underlying problem is the diversity of hardware. There are many kinds of display. Each needs completely different code to drive it. On a network it is not always possible to know the display that the user is using - this is why we have to supply a TERM value when we login from a different machine. See CS420(Graphics), the Curse's library,.... We have

    What does Orthogonality mean

    The word means "Like an array". The idea is that there are no special cases. Simple alternatives can be combined together freely to generate a wide range of possibilities. For example C provides the same operators for char, int, short, long, and unsigned data. See Algol 68.

    What does Virtual mean

    This is a good question for CS202! See my notes on C++ in [ c++.html ] and a quick summary in [ virtual in c++.glossary ]

    What does Static mean

    This is a complex question. See chapter 4 in Sebesta. Here are two links to more information [ lookup.php?search=static ]

    For information on static in C/C++/java see published documentation on these languages: [ static in c++.glossary ] [ java.html ]

    What does X mean in C++

    Start searching in here [ c++.glossary.html ]

    Do you have an example of how to X in C or C++

    Start searching in here [ http://csci.csusb.edu/dick/examples/ ]

    Can I take X into the final

    You can bring into the final your graded assigned work. You may not bring in a computer or a copy of the text book. All wireless devices need to be turned off and not used during the final.

    You must bring in enogh blank paper to give lang answers to at least 10 questions.

    What is the format of the final

    [ template.pdf ]

End