Presentation is loading. Please wait.

Presentation is loading. Please wait.

Winter 2006CISC121 - Prof. McLeod1 Welcome to CISC121 Prof. (Alan) McLeod – Web site at: All.

Similar presentations


Presentation on theme: "Winter 2006CISC121 - Prof. McLeod1 Welcome to CISC121 Prof. (Alan) McLeod – Web site at: All."— Presentation transcript:

1 Winter 2006CISC121 - Prof. McLeod1 Welcome to CISC121 Prof. (Alan) McLeod – mcleod@cs.queensu.ca Web site at: http://www.cs.queensu.ca/home/cisc121 All lecture notes and examples will be posted.

2 Winter 2006CISC121 - Prof. McLeod2 WWWW Who: (got that already) Where: NIC232 (Here!) When: 9:30am Tuesday, 8:30am Thursday, and 10:30am Fridays. Purpose of course (Why!): –Provide a basis for upper-year computer courses built on first year and high school programming courses.

3 Winter 2006CISC121 - Prof. McLeod3 Labs TA’s: Chanchal Roy and Chris McAloney Section A: Tutorial 2:30, JEF102, Lab 3:30 to 5:30pm JEF157, Mondays Section B: Tutorial 8:30, JEF110, Lab 9:30 to 11:30am JEF157, Wednesdays Note – tutorial hour before lab! Labs start next week! There is a self-guided lab exercise posted.

4 Winter 2006CISC121 - Prof. McLeod4 Assignments Five or six of them, probably. Submit *.java files to WebCT. Grades and comments returned to WebCT. No group submission – one assignment per student. Collaboration – share ideas, not code!

5 Winter 2006CISC121 - Prof. McLeod5 Textbook “Big Java” by Cay Horstman, 2 nd edition. First edition used last year, but it does not have any coverage of Java 5.0.

6 Winter 2006CISC121 - Prof. McLeod6 Textbook, Cont. “Do I gotta buy the book?” “Should I buy the book?” NO MAYBE!

7 Winter 2006CISC121 - Prof. McLeod7 Two Possibilities Plan A: –You are pretty confident in your Java programming skills, and you figure you can get extra material from the internet, if needed. –Do really well on the assignments! –You don’t need to buy the book and you won’t pay too much attention to the course until around midterm time, when we get into the more “conceptual” material. Plan B: –Not so confident! –Buy the book, attend lectures, do the lab exercises and assignments yourself. Get help from your TA. Work! –Relax a bit after the midterm.

8 Winter 2006CISC121 - Prof. McLeod8 Course Content (What!) This is not a “Java Course”! But, we need a language to demonstrate and practice the concepts to be discussed. Java is the language of choice. –A modern, platform-independent, Object-Oriented language. –We could have used many other languages equally well: C#, C++, VB, Delphi, Pascal, Turing, etc.

9 Winter 2006CISC121 - Prof. McLeod9 Course Content, Cont. First, a review of the Java language, then: Practical TopicsTheory TopicsAlgorithm Topics Coding Style Analysis of Complexity Data Structures Documentation Numerical Storage & Computation Recursion Testing & Debugging Sorting Assertions & Invariants Searching

10 Winter 2006CISC121 - Prof. McLeod10 Course Content, Cont. These topics are not Language-Dependant! Practical TopicsTheory TopicsAlgorithm Topics Coding Style Analysis of Complexity Data Structures Documentation Numerical Storage & Computation Recursion Testing & Debugging Sorting Assertions & Invariants Searching

11 Winter 2006CISC121 - Prof. McLeod11 Course Content, Cont. There is no single optimum way to navigate these topics. From example programs in class: –See examples (I hope!) of good coding style. –See examples of testing & debugging (I’m sure!). –Measure time of execution to verify complexity analyses. –Test the effect of finite memory used to store numbers. –Code and demonstrate the data structures and algorithms discussed.

12 Winter 2006CISC121 - Prof. McLeod12 Course Content, Cont. Assignments will: –At first, be used to practice fundamental Java language concepts. –Later, to explore concepts introduced in lecture. –And then to apply some of the algorithms learned to practical situations.

13 Winter 2006CISC121 - Prof. McLeod13 Course Content, Cont. To add to the excitement!… –Lectures will be shared with many examples and class problems. –Your questions are very important!! They will really help to make the lectures more interesting! –Other kinds of class participation?…

14 Winter 2006CISC121 - Prof. McLeod14 How to Pass Evaluation: –25% Assignments (5% each?) –25% Midterm –50% Final Exam

15 Winter 2006CISC121 - Prof. McLeod15 How to Pass – Cont. Do all the assignments and all practice questions yourself. Do not look at solutions until you have tried them. Ask if you have questions: –Ask me – during lecture, by E-mail, after lectures or in the WebCT forum. –Ask TA’s in lab, by E-mail. Read lecture notes. Get the textbook if you need more help. Many other resources are listed on the web site.

16 Winter 2006CISC121 - Prof. McLeod16 Warning! Most of the contents of a first year programming course like APSC142 or CISC101 will be crammed into the first three weeks. If you do not have any programming background nor a strong aptitude for coding, you might have problems keeping up! If you need more time with basic Java, pick up a first year-level textbook and/or see if you can spend more time with the TA’s.

17 Winter 2006CISC121 - Prof. McLeod17 Today Demo’s of environments: –One time only use of JDK - just to show you what is going on “under the hood”. –BlueJ –eclipse Note that you can use whatever development tool you wish. We officially only support eclipse. For assignments hand in your *.java files only.

18 Winter 2006CISC121 - Prof. McLeod18 A Simple Java Program public class HelloProg { public static void main (String [] args) { System.out.println ("Hello there!"); } // end main method } // end HelloProg class The “ // ” denotes an in-line comment. Everything else on the line is ignored by the compiler.

19 Winter 2006CISC121 - Prof. McLeod19 A Simple Java Program – Cont. The compiler ignores any “white space” in your source code – returns, line feeds, tabs, extra spaces and comments. Here’s our little program without white space (imagine this all on one line): public class HelloProg{public static void main(String[] args){System.out.println("Hello there!");}} This does still run, but it is hard to read…

20 Winter 2006CISC121 - Prof. McLeod20 Running a Java Program What happens when a program is run? Remember that Java code is platform independent. Compilation of Java source code (HelloProg.java) is done by a compiler (javac.exe) that creates a “byte code” file (HelloProg.class) that is still platform independent. This byte code file cannot be viewed or edited and is very compact.

21 Winter 2006CISC121 - Prof. McLeod21 Running a Java Program – Cont. Each platform capable of running Java programs has its own “JVM” or Java Virtual Machine – also called a “byte code interpreter”. This program (java.exe on a Wintel machine) runs the byte code file to perform on a specific platform.

22 Winter 2006CISC121 - Prof. McLeod22 Running an Applet Helps to explain why Java programs run this way: An Applet is a small byte code file that is linked to a web page. Compact is important in order to minimize download times. The JVM is part of the browser, and browsers are platform specific, but the applet is not. In the case of an applet, the JVM built into the browser runs the applet.

23 Winter 2006CISC121 - Prof. McLeod23 A Simple Java Program – Cont. Back to our little program: public class HelloProg { public static void main (String [] args) { System.out.println ("Hello there!"); } // end main method } // end HelloProg class

24 Winter 2006CISC121 - Prof. McLeod24 A Simple Java Program – Cont. A Class is an “Object” in Java. All Objects in Java are Classes… A Class is a container – it holds attributes (data) and methods (code that does something). Our class is called “HelloProg”. Our class must be defined in a file called “HelloProg.java”. The code “ public class HelloProg ” is used to declare the class. The contents of the class are contained in a set of curly brackets: “ { } ”.

25 Winter 2006CISC121 - Prof. McLeod25 A Simple Java Program – Cont. Our little class does not contain any attributes (data) and only has one method called “ main ”. The main method is declared using the code: public static void main (String [] args) As before the code is contained within: “ { } ”.

26 Winter 2006CISC121 - Prof. McLeod26 The main Method For the JVM to run a program, it must know where to start. By design, the starting point is always the execution of the main method. The JVM expects the main method to be declared exactly as shown – the only thing you can change is the name of the String array, called “ args ” in this little program.

27 Winter 2006CISC121 - Prof. McLeod27 A Simple Java Program – Cont. Our main method contains only one line of code: System.out.println ("Hello there!"); It prints out “Hello there!” to the screen (or “console”). We’ll talk more about I/O (“Input/Output”) later. Note the “ ; ” at the end of the line of code. Since the Java compiler ignores white space, it must use these characters to determine when a line finishes.


Download ppt "Winter 2006CISC121 - Prof. McLeod1 Welcome to CISC121 Prof. (Alan) McLeod – Web site at: All."

Similar presentations


Ads by Google