slanted W3C logo

Day 01: Introduction

CSE1020E Introduction to Computer Science I

The course lays the conceptual foundation of object-oriented programming. It covers delegation and contracts, encapsulation and API programming, aggregation and the collections framework, inheritance and polymorphism, all from the client's perspective. It also covers language-specific topics like types, control structures, and exception handling. The coverage is done within the framework of the software development process and emphasizes software engineering throughout.

Announcement: CSE Town Hall Meeting

Meet the Professor's Event

York's Department of Computer Science and Engineering
invites all first year CSE students to a Town Hall Meeting

on Wednesday September 15 at 3:30 pm

in Lecture Hall A
Computer Science and Engineering Building

Light refreshments will be served

Announcement: ACM Programming Contest Team

There will be a series of programming contests at York in September and October. Everyone is welcome to participate in these contests. The students who will represent York at the regional ACM Programming contest on October 23, 2010 will be chosen from the students who attend these practice contests.

The first programming contest will take place in CSEB 1004 on Friday September 17 from 15:00 until 17:00.

York Team information:
https://wiki.cse.yorku.ca/project/ACM/

ACM International Collegiate Programming Contest
http://cm.baylor.edu/welcome.icpc

Your Guide

Dr. Burton Ma
Department of Computer Science and Engineering
Room 1012J


Office Hours:
1:30 – 4:30 pm on Monday, and during the labs, and by appointment.

Course web pages:
CSE1020 (the general course web page)
CSE1020E (Section E specific web page)

What I Do


Word Games

Word games seem to be very popular...

 

These kind of games seem simple but beneath the surface lies a great deal of computer science and engineering.

Word Games and Computing Science

What are some of the problems that you need to solve to create games like the ones we just saw?

Problem Relevent Topics in Computing
search dictionary for a word data structures, algorithms, algorithms analysis
find all words in a group of letters algorithms, algorithms analysis
interact with user human-computer interaction
write software software engineering, programming languages

What Will we be Doing in 1020?

In 1020 we will be studying and practicing computer programming. The language we will be using is Java, and we will be using a Linux operating system in the labs.

The approach that is taken in 1020 is a client-based one; this means that you will be assembling pre-built components to create a computer program. The designers of this course felt that it is important that you learn how to build a program from pre-existing components before learning how to create your own components.

Advice on Succeeding in 1020

Broadly speaking you need to master three things to succeed in this course:

Thing you Need to Master How To Master
basic Java and computing science attend lectures,
attend labs,
read textbook,
do the practice problems and eChecks,
look online at reputable sources,
use office hours,
practice writing code
programming tools
(editor, compiler, documentation)
attend labs,
practice writing code
lab environment attend labs,
spend extra time in the lab using Linux,
practice writing code in the lab

Advice on Succeeding in 1020

You probably need to budget 1–3 hours for each hour of lecture reading the book and practicing writing code.

1–3 hours of effortful study per lecture hour is probably a pretty good rule of thumb for most of your university classes.

Textbook

Text book: Java By Abstraction The text book was written specifically for teaching 1020. It contains programming exercises that you can get automated feedback on (the eChecks), and includes a CD ROM with most of the software used in the course.

We will cover approximately one chapter per week (more in some weeks, less in others). See the reading schedule.

Labs

Each lab session will be run by a teaching assistant (TA). Your TA is a graduate student in the Department.

The lab PCs run a Linux (CentOS) operating system. We expect that most students will not have previously used Linux. It is very important that you attend the labs to familiarize yourself with the lab computing environment because all of the tests (except the written exam) occur in the lab.

Find our more about the Prism Lab.

Assessment

Week 01

0%
Week 02 – Week 11
45 minute in lab test; half programming, half written (submitted electronically)
60%
Week 12
in lab programming test
15%
TBA
written exam
25%

In lab tests start at the beginning of the lab.

Each week we assign a programming problem called an eCheck that you submit electronically; you will see how this works in the first lab. The eChecks carry no weight on your grade, but...

If you submit the eCheck on time (before the next Monday) then we will try to provide feedback on your work by Tuesday so that you can correct any shortcomings before Wednesday's test.

First Java Example

A Hairy Problem

Estimate the number of hairs on an adult human head.

Solution Outline

Assuming that a human head is approximately spherical:

  1. Assign a value for the average diameter of an adult human head.
  2. Assign a value for the fraction of the head surface area covered by hair.
  3. Calculate the surface area covered by hair.
  4. Assign a value for the density of hair (number of hairs per square centimeter).
  5. Calculate the number of hairs.

Notice that the solution is sequential (Step 1, followed by Step 2, followed by ...).

Worked Solution

Step
Values
1 diameter 17 cm
2 fraction of head covered by hair 0.5
3 area covered by hair 0.5 × π × 17cm × 17cm ≅ 453.96 square cm
4 number of hairs per square cm 200 hairs per square cm
5 number of hairs on head 453.96 × 200 ≅ 90,792.03

Several Internet sources state that the average number of hairs on a human head is on the order of 100,000.

Java Solution

A Java source code file is just a plain text file.

public class HairsOnHead
{
   public static void main(String[] args)
   {
      // Step 1
      int diameter = 17;

      // Step 2
      double fractionCovered = 0.5;

      // Step 3
      double areaCovered = fractionCovered * Math.PI * diameter * diameter;

      // Step 4
      int density = 200;

      // Step 5
      double numberOfHairs = areaCovered * density;

      // Step 6: Print out the result
      System.out.print("The number of hairs on a human head is ");
      System.out.println(numberOfHairs);
   }
}

Summary

Java source code is plain text
Any text editor can be used to write Java source code; jEdit is the recommended editor in CSE 1020.

A Java main method is a sequence of Java statements
For now, you can safely think of each line of code in your main method as a step in a sequence: The first line of code is evaluated, followed by the second, followed by the third, and so on.

Java source code needs to be compiled
Java source code in and of itself does not produce a functioning program. We use a program called a Java compiler to translate the source code to computer instructions.

Compiled Java code can be run
A compiled Java program can be run. In CSE 1020, we run the program using the Java virtual machine.

Complete the checklist on the Day 01 handout.