Course Introduction - Boston College Computer Science

Download Report

Transcript Course Introduction - Boston College Computer Science

Computer Science - I
Course Introduction
Computer Science Department
Boston College
Hao Jiang
What is our class about?
 In this class, you will learn
• Skills of solving problems using computers.
• Basic theories and concepts about computing and programming.
• programming a computer language – Java.
 After the class, you will
• be confident of writing programs to solve real world problems (like
math problems, image processing, visualization, graphics and
building games …)
• Be ready for more advanced computer science classes.
About computer science
 Computer science is to study principles and methodologies
of solving problems with computational methods and
computers.
• How to build “efficient software” that suits computers.
• How to represent, store, search, analyze and transform
“information” or “data”.
 Computing is everywhere!
•
•
•
•
•
Finding the root of a high order polynomial equation.
Finding the best driving path from one city to another.
Graphics and computer games.
Artificial intelligence, computer vision.
Decide about how to invest money for different stocks.
Applications of computer science
 A route planer
Your destination
Road
intersection
You are here
Applications of computer science
 Robotics: How to a find route in a maze?
exit
entrance
Applications of computer science
Image
Processing
Applications of computer science
 Computer graphics
The tree looks
quite complex.
But in fact it can
be generated
with very few lines
of code.
Sakura (Cherry Blossom)
by Priscilla Pham and Tom Wang
Applications of computer vision
 Computer games
Quake 2
Tetris
The basic problem solving method
 Different real-world problems need different solution
approaches. But in computer science, they usually follow
some common steps:
•
•
•
•
•
Problem abstraction and modeling.
Developing algorithms to solve the problem.
Software design.
Coding.
Testing.
Programming (coding)
 Coding is the process of building a software.
 The result is a package of computer programs that satisfy
the design requirement.
 Writing programs based on a given requirement is an
important part of this class. (you will expect to write many
programs in this class).
 Coding is not just about writing a program that gives the
right result. Good software is easy to use, maintain and
extend.
A sample problem
 Problem: Convert a positive integer number to its binary
representation.
 Examples: If the input is 9, the output will be 1001.
Observation:
the binary representation of n
= the binary representation of (n/2) + (n%2)
If n%2 == n, then its binary representation is n.
/**
* Convert a decimal number into its binary
* representation.
* @param n The input number.
*/
public static String convert(int n) {
int m = n % 2;
if (m == n) {
String s = new Integer(n).toString();
return s;
}
return convert(n/2) + m;
}
// ----------------------------------------------------------------------------// Dec2Bin.java
// ----------------------------------------------------------------------------/*
* ==============================================
* Copyright (c) 2008 Boston College. All rights reserved.
*
* This code is the copyright of Boston College and is protected
* under copyright laws of the United States. This source code may
* not be hosted on any other site without my express, prior, written
* permission.
* ==============================================
*/
import java.util.*;
/**
* ----------------------------------------------------------------------------* This program demonstrates how to convert a decimal number to
* its binary representation.
*
* @version 1.0
* @author Hao Jiang ([email protected])
* @author http://www.cs.bc.edu/~hjiang
* ----------------------------------------------------------------------------*/
public class Dec2Bin {
/**
* Sole entry point to the class and application.
* @param args Array of argument.
*/
public static void main(String[] args) {
int n = Integer.parseInt(args[0]);
System.Out.print(dec2bin(n));
}
}
doc
This is an example code for
computing binary representation
Program design
 There are two main methodologies of constructing
software
• Procedure oriented.
• Data (object) oriented.
 We will cover both of these two schemes in our class.
 Object oriented programming is a relative new scheme and
gaining more and more acceptance.
 We spend quite some time in this class to talk about class,
object and how to use them to design computer software.
Programming language
 We are going to use Java to illustrate programming and
solving problems.
 Java is a higher level language than C or C++ and
therefore easier to program.
 Java is designed to be “compiled once and executed
anywhere”.
 After learning Java, you should be able to learn other
programming languages much more quickly.
.
The rough schedule of our class
 Our class website is at:
www.cs.bc.edu/~hjiang/c101/syllabus.html
 Text book:
“Introduction to programming in Java” by Robert
Sedgewick and Kevin Wayne.
 The marking scheme in our class is:
Assignment and project 45%
Midterm 15%
Final Exam 40%
Assignment and projects
 Programming assignments:
A previous programming assignment.
 The last assignment is an open project, for which you can
do any programming project you are interested in.
• You will write a proposal.
• And finally show a demo in class.
• Projects can be done in groups.
About exams
 There is one in-class midterm exam and one final exam.
 The exams test your understanding of concepts and
problem solving skills learned during the class.
 The questions for the exam are not too different from the
assignments. So, if you come to class and do you
assignments, you have all the knowledge necessary for the
exams.
Other issues




Computer labs.
Programming environment (Command line and IDE).
Office hours.
Teaching assistant.
 More questions you have for me?
Homework
 Find out whether you can access the computer lab (the
unix lab). If you cannot, contact me or Phil.
 If you would like to install a Java SDK at home, download
the newest Java SE (Standard Edition) at
http://java.sun.com/javase/downloads/index.jsp
download “JDK 6 Update 4”
 Next class, we will learn to write the first program in Java.