FAQ CS1 Week 1

Muddiest Points from Lecture Material

  1. I don't understand all of the new vocabulary.

    You'll need to be more specific than that. Perhaps a little reading is in order? :-) We WILL hear these terms repeatedly as the quarter goes on!

  2. I don't understand what needs to be underlined and capitalized. Help!

    Hopefully this will become more clear with practice. In general these are a matter of convention. For example, it is a convention in URL to underline object names, but not class names. It is our convention to name classes starting with capital letters and to name variables and methods starting with small letters. Please read your text and look over the coding standards available at http://www.cs.rit.edu/~fyj/java-coding-standard.html.

  3. I don't understand what objects are. I don't understand why an object is an abstraction of something when an object is supposed to be tangible. Is it just a misnomer?

    Please go back and look over the notes, plus do some reading in your book. What was said was that "An object is an abstraction of a thing, either tangible or intangible." If I were to write a program that had some kitten objects whose identities are "Meow", "Scratch", and "Kitty". These objects would be abstractions of tangible things, i.e., kittens. But, clearly the kittens would not be in the computer, but rather an abstraction of the characteristics of kittens as well as the specific characteristics of these three kittens (properties, attributes, data members) represented by instance variables.

  4. I'm somewhat confused about variables and instance variables. What are the advantages/disadvantages of instance variables? Why not use only instance variables?

    First of all the term variable is used to describe a data value that can be changed. That is the most generic term.

    We discussed two kinds of variables: instance variables and class variables. The first type of variable is associated with each individual object (which is an instance of a class, hence the name). Each object has it's own set of these type of variables that it directly controls. These are the object's instance variables. For example, for each kitten object (mentioned above), we might have instance variables that detail that kitten's eye color, fur color, etc.

    There may, however, be other kinds of variables required that do not relate to the individual objects but rather to the class as a whole. For example, a variable that keeps track of the number of objects of the class that have been created. (In our kitten example, 3!) There is only ONE of these variables regardless of the number of instances (objects) of that class that exist. This type of variable is a class variable.

    Since they are used for two different kinds of things, we can not simply discard one or the other!

  5. How is a class and object better for programming in general than a function? (Also partially answers: What other kinds of programming are there besides OOP?)

    I think what you are really asking is why is Object-Oriented Programming (OOP) considered to better than imperative programming. OOP provides several advantages: modularity, information hiding, reusability and perhaps allows us to better model the world we are trying to represent. The are all terms that came up in lecture. Take a look again at the notes AND at your textbook!

    (There are many programming paradigms besides imperative and OOP. This is one of the things you will study if you take the Programming Language Concepts course later on.)

  6. Are instances of a class the same thing as an object?

    Yes! An object is an instance of a class.

  7. How do objects get integrated with a class?

    An object cannot exist without the blueprint provided by the class. We will soon see how we create an object given a particular class.

  8. What are methods, what can they do and where are they used? How do objects interact?

    Methods are the encoding of behavior that is appropriate to members of a class. For example, addGas was a behavior that was "appropriate" to members of our Car class.

    What they can do is dependent on how they are implemented. We haven't covered this yet!

    They will be used when an object in the program invokes a method on another object to cause a particular behavior to take place. For example, one object might need to know something about another object in order to do it's own work. To get that information, the object needing the information will invoke method on the object it needs the information from. The object whose method was invoked, will calculate, look up, etc. the required information and return it to the invoking object. This is how objects interact with each other!

    If this doesn't become clearer to you in the next few weeks, see me!

  9. How are methods specified to objects?

    Well, I'm not sure I understand this question! The methods that pertain to a particular object are specified in the blueprint provided by the class. A particular method is invoded on a particular object by


    What is the use of a constructor?

    We will be covering this thoroughly in a couple of weeks, but for now, a constructor is a method that is invoked when an object is created. It generally will specify the initial state of the object.

  10. I don't understand the basic concepts of writing a program.

    Several things are necessary to be able to write a program:

    You should gain an understanding of this process, which incidentally is called "The Software Life Cycle" (I'll explain the cycle part later on) as well as the structure, syntax and semantics of the Java programming language as the quarter progresses.

  11. I didn't understand what most of "Hello World" was when you showed it.

    The structure of the "HelloWorld" program is almost the simplest program one can write in Java. Besides being written with comments according to our Coding Standards (Lines beginning with /* or /** through those ending with */ are NOT interpreted by the java compiler; they are just there for you the reader of the program.), it included

  12. I don't understand the necessary documentation part.

    While you may be able to write a small program correctly, in industry a program you write will likely have a lifetime that is longer than yours at the company. As such, it is important that a program be commented in a helpful, readable manner. Besides, it is often difficult even for the programmer to know what's going on in his/her program months, years, or sometimes even days later without appropriate commenting.

    Many companies have set a standard for documentation that their employees must follow. This is part of the RIT culture for completing a programming assignment. The Computer Science Department at RIT also has such a standard. That was what was shown in class and what you started looking at in Lab 2. It is nice too that if you adhere to our standards, online documentation is readily generated using your code as input to the javadoc program.

  13. What is the difference between the comments that begin with /* and those that begin with /**?

    If you think about it, both /* and /** have the same /* beginning. The difference is that if the program is used as input to the javadoc program, /** comments will be scanned for javadoc tags and will be used in automatically generating the online documentation mentioned above.

  14. The only point that I am somewhat stumbling on is the inside and outside veiw of a class.

    This will become clearer as the course moves on, but in the context of what we have done so far, try thinking about this. Yesterday we used the println method of the System.out class. All we needed to know about the println method to use it was it's signature, i.e., the information it needed to do its job. In this case it needed the String (the words inside the double quotes) containing the text we wanted to show on the screen. That's the OUTSIDE view of the class.

    As users, we don't need to know HOW the System.out class actually makes that happen. If we did know, then we'd have the INSIDE view of the class.

  15. I could not understand the principle of information hiding or encapsulation. It was difficult for me to undertand how a part of the program is hidden. Is it hidden from the user? Is the program hidden or is its implementaion hidden? What exactly do we mean by "Hidden"?

    See the answer for the previous question. Yes, part of the program (classes written by other people) is hidden from the programmer. The way in which the class is IMPLEMENTED is hidden, not visible, to the programmer. The programmer only sees the DESCRIPTION (i.e., as in the javadoc) of the class and how it's used.

  16. I am having a bit of difficulty understanding the inheritance point and what is meant by superclass and subclass.

    What inheritance means for us is that if a class is a subclass of a class, it inherits all of the superclass's features UNLESS they are overridden. For example, if our Car class has an instance variable that is gasLevel and our BMW class is a subclass of Car, our BMW class will AUTOMATICALLY have an instance variable called gasLevel. Overall, this will mean that we need to do a lot less work in designing our subclasses, i.e., won't need to rewrite methods and define instance variables again that were created in the superclass. This is an example of reusability!

    Superclass and subclass are terms applied to the hierarchical structure of object-oriented programming. In our example above, Car is the superclass for BMW and BMW is a subclass of Car. A class may be both a superclass for one class and a subclass of another. For example, if we created a subclass of the BMW class called Z3, BMW would be a superclass of Z3 and a subclass of Car.

  17. Today you mentioned how class methods can't access any of the state information stored inside instances of the class. In the book it gives the example of a class method for a banking system that returns the average balance of all the accounts (instances). The only way I can think of for this to happen without accessing the state of the class is for the class method to invoke the instance method that will return the balance information. So, what were you really saying?

    Perhaps it would have been clearer if I'd said that class methods cannot DIRECTLY access instance variables. They may create objects and access their instance variables using the object's accessor methods.

    The following is not for you who are just starting out....Now for those of you who want to REALLY know more, Prof. Axel Schreiner adds:

    class X { static void method () { System.err.print(y.z); }
       static X y = new X();
       private int z;

    the class method does not need an accessor method to get at an object. The mental block to be overcome here is that code 'inside' the class has access to anything inside the class and also to the protected inherited stuff (and other things). static code cannot get at an instance state without explicitly mentioning the instance; member code can, because it implicitly prefixes 'this'."

  18. How do "public" and "private" access work?

    If a method, instance variable, or class variable is labeled "private", then it can only be accessed INSIDE the class. So, in our car example, we would likely label the gasLevel as a private instance variable. This means that only objects of type class can modify that variable directly, i.e., without having to use an accessor method! On the other hand, if it had been labelled "public", any type of object would be able to modify it directly, simply by referencing Jessica's BMW.gasLevel in their code rather than having to say Jessica's BMW.addGas(7).

  19. What happens if you replace the "public" access modifier with "private"? Is a password of some sort required then?

    No passwords are required because of this, but as was stated above, properties that are modified with "private" are generally only accessible IF an accessor method is available for that property. "Private" methods may only be used INTERNALLY by the objects other methods. Such methods are often called "helper" methods.

    So, what changes is "who" can access the method or variable. Your best bet is to TRY IT - either in the lab or on your home computer. This is the best way to find out how everything we study in this class works!

  20. I don't understand why you loaded all of the Java libraries in HelloWorld instead of just loading the input and output libraries.

    As was stated in class, the import statement was included in this example, not because it was needed at all (it wasn't!), but rather to show you WHERE and import statement would be placed if you needed one. Incidentally, all of Java libraries are NOT loaded with that statement, but the compiler does load all of the names at that time so it knows where the appropriate classes, objects, and methods are located.

  21. I was having a little difficulty remembering and understanding binary numbers.

    There are many tutorials on binary numbers available on the web. Just go to http://www.google.com/ and search for "binary numbers". Here are a few:

  22. I don't understand the difference between Java and C++!

    Well, this really is beyond the course. You will need to note the syntactical differences yourself as we go along. I believe they are semantically similar.

  23. How did one go about building the first high level language in the first place?

    Hmmm! I'm not THAT old. :-) I would suggest that you find a book on or search the web for a history of computing!

  24. You mentioned that assembly languages associated a series of 1's and 0's with ADD and MOVE in your example. What did the numbers mean?

    Well, you really have it backwards! The question should be what do "ADD" and "MOVE" mean to the computer?!!!! Typically assembly languages associate "English" computer commands with a series of numbers. So, a machine language for a particular machine may have a 3 bit op-code (operation code). Perhaps to add something, the machine language instruction op-code is 111. The assembler is a program written in (perhaps) machine language that translates our assembly language code "add" to the 111 that the computer understands.

Muddiest Points from Lab Material

  1. I don't understand/know some of the Unix commands to do particular things, such as read a .pdf file

    The best thing I can recommend is to go back to the lab with your Unix book and the Beginner's Guide and TRY lot's of things. One command that will be particularly useful is the "man" command which when used with the -k option will help you locate (and see) online documentation for Unix commands.

    The command to display a .pdf file is acroread. It executes the Unix version of the the Acrobat reader. So, if you have a file called "foo.pdf", you can display it's contents by typing

    acroread foo.pdf&
    in a command or terminal window. The "&" is not strictly needed, but what it buys you is the ability to continue to work in that window. It puts the acroread proceses into background mode.

  2. I do not fully understand wildcards in the Unix system.

    Again, your best bet is PRACTICE! The simplest wildcard characters to get under your hat are * which can stand for 0-any number of characters and ? which stands for any single character. Thus *1?3 will match 123 or 01A3 or 011B3 or 0121c3 or an infinite number of other names!

  3. Our reading material states: "You use the cd command to change your current directory. Specify the directory you want to change to as a command parameter.

    cd directory

    will make directory the current directory."

    I'm not sure if this statement wants me to change the name of the current directory to another one or to go to another directory.

    The cd command changes which directory you are currently working in. To change the NAME of the directory you would use the mv (move) command.

  4. I also would like to know how I can connect my computer to the school's Unix system and emacs.

    To do work for this course from "home" you will need to install both "java" and "emacs" on your home system. These are available from the CS1 course page (http://www.cs.rit.edu/~vcss231/). If you want to work directly on a Unix machine in the lab, you will need to have a program on your home machine that will let you run secure shell (ssh, ssh1). See http://www.cs.rit.edu/facilities/faq.html for details. You'll also need to remember the name of one or more machine in the CS departments labs.

    Often the secure shell program that you install will come with a secure FTP (file transfer program) as well. You'll need this too to move files back and forth between your home machine and the Unix system. For example, see http://www.cs.rit.edu/usr/local/pub/SSH. (NOTE: For RIT students only!)

    However, it is possible to do all of your work with JUST the secure shell program, but you will need to use the command line version of emacs or some other editor, like vi.

  5. Are there any other files I need to execute the programs from lab in my dorm?

    Yes, you will need to have installed both Java and the input/output simplifying class RitIo. These as well as Emacs are available from the "Download Center" located in the left from of the CS1 Home Page: http://www.cs.rit.edu/~vcss231/

  6. Is there a unix command to transfer a file from the CS Lab to my dorm?

    Yes. That's what you use the secureFTP portion of the secure shell program for. It's the solid rather than striped folder icon with the bubbles on it.

Nan C. Schaller
Rochester Institute of Technology
Computer Science Department
102 Lomb Memorial Dr.
Rochester, NY 14623-5608
telephone: +1.585.475.2139
fax: +1.585.475.7100
e-mail: ncs@cs.rit.edu September 15, 2004