Welcome to COMP 1001 First Year Computer Science Lecturer: Fintan Costello.
-
date post
15-Jan-2016 -
Category
Documents
-
view
214 -
download
0
Transcript of Welcome to COMP 1001 First Year Computer Science Lecturer: Fintan Costello.
![Page 1: Welcome to COMP 1001 First Year Computer Science Lecturer: Fintan Costello.](https://reader036.fdocuments.us/reader036/viewer/2022062518/56649d785503460f94a5b675/html5/thumbnails/1.jpg)
Welcome to COMP 1001First Year Computer Science
Lecturer: Fintan Costello
![Page 2: Welcome to COMP 1001 First Year Computer Science Lecturer: Fintan Costello.](https://reader036.fdocuments.us/reader036/viewer/2022062518/56649d785503460f94a5b675/html5/thumbnails/2.jpg)
Where you are
COMP 1001:
Introduction to Programming (Tues@10/Thurs@12; Fintan)
Information Technology (Wed@12; Joe Carthy)
This class includes:
Science students Computer Science Denominated Entry students BA Computer Science students Actuarial & Financial students
![Page 3: Welcome to COMP 1001 First Year Computer Science Lecturer: Fintan Costello.](https://reader036.fdocuments.us/reader036/viewer/2022062518/56649d785503460f94a5b675/html5/thumbnails/3.jpg)
Resources for the programming course
Textbook: Introduction to JAVA Programming, Y. Daniel Liang. Prentice Hall, 4th ed. Campus bookstore.
We’ll be using this textbook a lot: you should get it. Make sure you get the 4th edition!
Web site: http://inismor.ucd.ie/~fintanc/cs1001Look here to find these slides, course rules and instructions, exam info, practicals, and so on.
Owen Fallon ([email protected]; extn 2917) is your student advisor: he’s there to help with any problems…
![Page 4: Welcome to COMP 1001 First Year Computer Science Lecturer: Fintan Costello.](https://reader036.fdocuments.us/reader036/viewer/2022062518/56649d785503460f94a5b675/html5/thumbnails/4.jpg)
What will you learn on this course?
How to make a computer do what you want:•Write programs to quickly solve complex problems
You will also develop a useful attitude towards computers•Not to be afraid when things go wrong, but to debug
•Write programs to process information in various ways
•Write programs to respond to different situations.
•To try things on your computer and learn from your mistakes
•To solve problems in a clear, unambiguous and precise way.
![Page 5: Welcome to COMP 1001 First Year Computer Science Lecturer: Fintan Costello.](https://reader036.fdocuments.us/reader036/viewer/2022062518/56649d785503460f94a5b675/html5/thumbnails/5.jpg)
Why would you want to learn this?
Everyone should be able to do some programming (it’s the 21st century version of being able to type)
Being able to program allows you to create useful tools in any area of study
Psychology:Computational theory of mind is dominant in psychology today
Languages: Programming is closely related to linguistics Using and programming automated translation aids is part of the work of a professional translator
![Page 6: Welcome to COMP 1001 First Year Computer Science Lecturer: Fintan Costello.](https://reader036.fdocuments.us/reader036/viewer/2022062518/56649d785503460f94a5b675/html5/thumbnails/6.jpg)
Why learn programming? More reasons
Physics: Computational simulation
Genetics: Computational analysis of gene structure
Large-scale experiments run by computer
Business: Runs on computer program infrastructure
genome projects run by computer
Programs to predict market performance, test implications of economic changes
There is no area where a knowledge of programming is not a noticable advantage
![Page 7: Welcome to COMP 1001 First Year Computer Science Lecturer: Fintan Costello.](https://reader036.fdocuments.us/reader036/viewer/2022062518/56649d785503460f94a5b675/html5/thumbnails/7.jpg)
Ireland needs programmers!
From Fourth Report of the Expert Group on Future Skills Needs presented to the Tánaiste and Minister for Enterprise, Trade and Employment and Minister for Education and Science, October 2003.
Year Demand for New Computer Graduates
Number of New Computer Graduates
Gap
2006 2,807 1,866 -9412007 3,094 1,583 -
1,5112008 3,417 1,563 -
1,8542009 3,777 1,535 -
2,242
![Page 8: Welcome to COMP 1001 First Year Computer Science Lecturer: Fintan Costello.](https://reader036.fdocuments.us/reader036/viewer/2022062518/56649d785503460f94a5b675/html5/thumbnails/8.jpg)
COMP 1001 intro to programming: what you do
Attend programming lectures twice weekly
Attend practicals once weekly (1 * 2 hours)
Textbook is required reading
Marks based on practical work, plus2 Exams (Christmas: MCQ exam,
Summer: Full written exam)
Attend architecture lectures once weekly
![Page 9: Welcome to COMP 1001 First Year Computer Science Lecturer: Fintan Costello.](https://reader036.fdocuments.us/reader036/viewer/2022062518/56649d785503460f94a5b675/html5/thumbnails/9.jpg)
COMP 1001: Grading details
Practical work must be done correctly and submitted (25%)
Christmas Programming & IT multiple choice exam (15%)
Summer Programming & IT full written exam (60%)
Practical work must be satisfactory to pass COMP 1001
![Page 10: Welcome to COMP 1001 First Year Computer Science Lecturer: Fintan Costello.](https://reader036.fdocuments.us/reader036/viewer/2022062518/56649d785503460f94a5b675/html5/thumbnails/10.jpg)
Programs and algorithms: some terms
A program is a series of instructions or commands to a computer
Running a program == carrying out the instructions
A well written program implements an algorithm which solves a problem
An algorithm is a precise description of how to solve a problem
![Page 11: Welcome to COMP 1001 First Year Computer Science Lecturer: Fintan Costello.](https://reader036.fdocuments.us/reader036/viewer/2022062518/56649d785503460f94a5b675/html5/thumbnails/11.jpg)
Algorithm for making tea
boil water;put teabag into cup;pour water into cup until full;wait 3 minutes;remove teabag;if (want milk){ put milk into cup; }if (want sugar){ put sugar into cup; }stir;
![Page 12: Welcome to COMP 1001 First Year Computer Science Lecturer: Fintan Costello.](https://reader036.fdocuments.us/reader036/viewer/2022062518/56649d785503460f94a5b675/html5/thumbnails/12.jpg)
Algorithms
An ALGORITHM is:
1. Unambiguous
2. Executable
3. Terminating
![Page 13: Welcome to COMP 1001 First Year Computer Science Lecturer: Fintan Costello.](https://reader036.fdocuments.us/reader036/viewer/2022062518/56649d785503460f94a5b675/html5/thumbnails/13.jpg)
Problem: open a door
Algorithm:
read sign on door;if (sign says "pull") { pull the door open;} else { push the door open;}
Will this work for all doors?
![Page 14: Welcome to COMP 1001 First Year Computer Science Lecturer: Fintan Costello.](https://reader036.fdocuments.us/reader036/viewer/2022062518/56649d785503460f94a5b675/html5/thumbnails/14.jpg)
Problem: Say hello to someone
Algorithm:
Ask the person’s name;Remember their name:
NAME their name; Say(“Hello “ + NAME);
![Page 15: Welcome to COMP 1001 First Year Computer Science Lecturer: Fintan Costello.](https://reader036.fdocuments.us/reader036/viewer/2022062518/56649d785503460f94a5b675/html5/thumbnails/15.jpg)
Programming languages
Natural languages: French, English, Swahili…
Programming languages: C, perl, Java...
Natural languages are forgiving: if you have wrong the grammar, pronounciation, or speling, people can still understanding you be.
Computers are not as smart as people: if you don’t have your program’s grammar and spelling exactly right, the computer will not understand and will give an error
![Page 16: Welcome to COMP 1001 First Year Computer Science Lecturer: Fintan Costello.](https://reader036.fdocuments.us/reader036/viewer/2022062518/56649d785503460f94a5b675/html5/thumbnails/16.jpg)
Your first java programWelcome.java (L, p. 15)
// Welcome.java: this application prints// a welcome message
public class Welcome{ public static void main(String[] args) { System.out.println("Welcome to Java"); }}
![Page 17: Welcome to COMP 1001 First Year Computer Science Lecturer: Fintan Costello.](https://reader036.fdocuments.us/reader036/viewer/2022062518/56649d785503460f94a5b675/html5/thumbnails/17.jpg)
Reseved words
// Welcome.java: this program prints// a welcome message
public class Welcome{ public static void main(String[] args) { System.out.println("Welcome to Java"); }}
The words in bold are reserved words: they mean something special in the java programming language.
Reserved words are case-sensitive: Public is wrong.
![Page 18: Welcome to COMP 1001 First Year Computer Science Lecturer: Fintan Costello.](https://reader036.fdocuments.us/reader036/viewer/2022062518/56649d785503460f94a5b675/html5/thumbnails/18.jpg)
What do these words mean?
// Welcome.java: this program prints// a welcome messagepublic class Welcome{ public static void main(String[] args) { System.out.println("Welcome to Java"); }}
class is a word that identifies something as a program in java
public is a modifier which identifies something as publicly accessible (other programs can “call” it, which means run it)
main identifies the main part of a program (the bit that does most of the work). We’ll explain static and void later.
![Page 19: Welcome to COMP 1001 First Year Computer Science Lecturer: Fintan Costello.](https://reader036.fdocuments.us/reader036/viewer/2022062518/56649d785503460f94a5b675/html5/thumbnails/19.jpg)
Blocks {......}
A block is a sequence of code between matching curly brackets
This block identifies everything that is in the public class Welcome
This block identifies everything that is in the main part of the class.
// Welcome.java: this program prints// a welcome messagepublic class Welcome{ public static void main(String[] args) { System.out.println("Welcome to Java"); }}
![Page 20: Welcome to COMP 1001 First Year Computer Science Lecturer: Fintan Costello.](https://reader036.fdocuments.us/reader036/viewer/2022062518/56649d785503460f94a5b675/html5/thumbnails/20.jpg)
Statements
A statement is an action.
A statement ends with a semi-colon ;
System.out.println("Welcome...");
println means ‘print this on a line of its own’ (you can also use print, which doesn’t start a new line).
System.out means that println is an action carried out by the output part of a set of Java programs which you can use to interact with your computer’s System.
We’ll learn more about this later when we talk about methods
![Page 21: Welcome to COMP 1001 First Year Computer Science Lecturer: Fintan Costello.](https://reader036.fdocuments.us/reader036/viewer/2022062518/56649d785503460f94a5b675/html5/thumbnails/21.jpg)
Comments in Java
Comments are simply notes for the programmer to remind themseleves and other programmers what a program is meant to do. Comments can contain any text you like
// this is a one line comment// and here is another
/* this comment can extend over several lines ....... */
Comments are not java commands. Always comment your programs! It helps you remember what’s going on.