Professional Documents
Culture Documents
Instructor: Ayça Tüzmen Yıldırım
Teaching assistants: webpage
Section leaders: webpage
PSs: starts next week
Lab-quiz: on syllabus (no lab, when there is no quiz)
Textbook:(Available in the bookstore)
– E. S. Roberts, The Art & Science of Java, Addison-Wesley.
Course webpage:
– http://courses.ku.edu.tr/comp130/
(add to your bookmarks, you will refer to it frequently)
– https://ku.blackboard.com/
(add to your bookmarks, you will refer to it frequently)
BIO
• TED Ankara College
• ODTÜ –Undergrad Architecture
• Bilkent – Master of Architecture
• New Jersey Institute of Technology – Master of Science
• Arizona State University – Master of Computer Science
• Arizona State University – PhD in Design
• TA – Bilkent Üni
• RA – New Jersey Institute of Technology
• TA/RA - Arizona State University
• Associate Prof – University of Sydney
• Validation Engineer – Intel
• Kaya Educational Services - Founder
• Managing Consultant – IBM
Clients: Morgan Stanley, İşbank, Akbank, Aksigorta, Anadolu Sigorta, Vodafone,
Avea, TFF, Adalet Bakanlığı,
• Assoc Prof – Okan Uni, Bahçeşehir Uni, Istanbul Aydın Uni, Kemerburgaz Uni
• Lecturer – Koç Uni
How many of you have no prior experience in:
7
Why do engineers and scientists need to
learn programming?
• Developing new models, designs, technologies often
require developing programs
http://www.codingdojo.com/blog/7-most-in-demand-programming-
2018
Course Outline
1. Karel
9. ArrayList, HashMap, Collections: Ex: creating a phone book, searching in the phone
book
HelloGUI
Hello, world.
Hello, Eric.
11. Objects and classes, object oriented design
Name Eric
world
Learn By Doing
Java Programming Environment
If you ever get lost and feel helpless, please come and see
your SECTION LEADER or ME or your TAs. We
want all of you to succeed.
Quizzes and Grading
Keep in mind:
• There is no single algorithm/solution to perform a task
• The simplicity of an algorithm may mislead you: it may
not be simple to put it together on your own code.
• Making errors and trying to understand the source of
the problem is the best way to learn! (also in life :) )
Homework Assignments
Honor Code
1.Rule 1: You must NOT look at the code that are not your own.
2.Rule 2: You must NOT share your code with other students.
3.Rule 3: You must indicate on your submission any assistance you received.
(if that person is not a section leader, TA or lecturer of the course). The assistance you
receive must only consists of general advice including the discussion of ideas and
strategies. First and second rules always apply!
T
e
x
t
03/02/22
Meet Karel the Robot
Good morning
Karel Speaks Java
s
Karel’s World
3 + + + + + North
2 + + + + + West East
1 + + + + +
South
1 2 3 4 5
Programming Karel
KAREL
Karel the Robot was developed at Stanford University by
Richard Pattis over 30 years ago. Since then Karel has been
used to give a “gentle introduction” to programming and problem
solving.
Walls
3 + + + +
2 + + + +
1 + + + +
1 2 3 4
Beepers
3 + + + +
2 + + + +
1 + + + +
1 2 3 4
Knows Four Commands
move();
turnLeft();
putBeeper();
pickBeeper();
move();
move();
3 + + + +
2 + + + +
1 + + + +
1 2 3 4
move();
3 + + + +
2 + + + +
1 + + + +
1 2 3 4
turnLeft();
turnLeft();
3 + + + +
2 + + + +
1 + + + +
1 2 3 4
turnLeft();
3 + + + +
2 + + + +
1 + + + +
1 2 3 4
pickBeeper();
pickBeeper();
3 + + + +
2 + + + +
1 + + + +
1 2 3 4
pickBeeper();
3 + + + +
2 + + + +
1 + + + +
1 2 3 4
Bird’s Eye View
3 + + + +
2 + + + +
1 + + + +
1 2 3 4
3 + + + + +
West East
streets 2 + + + + +
beeper
1 + + + + +
1 2 3 4 5
Help video available on the web-page for demonstrating loading
and running of a Karel project.
Rules of Karel’s world
• Karel’s bag is large enough to carry infinite number of
beepers (unless otherwise specified). If there are no
beepers in the bag, Karel can not put a beeper.
• If Karel tries to do something illegal, such as moving
through a wall or picking up a nonexistent beeper, an error
condition occurs. At this point, Karel displays an error
message and does not execute any remaining commands.
• () appears in each of these commands is part of the
common syntax shared by Karel and Java.
Our First Challenge
• How would you program Karel to pick up the beeper and
transport it to the top of the ledge? Karel should drop the
beeper at the corner of 2nd Street and 4th Avenue and then
continue one more corner to the east, ending up on 5th Avenue.
3 + + + + +
2 + + + + +
1 + + + + +
1 2 3 4 5
Project Messenger: how to load Comp130-libs and the project
Our First Karel Program
/*
* File: Messenger.java
FirstKarelProgram.java
* ----------------------------
comments
Comments
* This program moves a beeper up to a ledge.
*/
import stanford.karel.*; including Karel
Import the library
Stanford Karel libraries
public class Messenger
FirstKarelProgram
extends extends
Karel { Karel { header
public void run() {
move(); body of the ‘run’
pickBeeper();
move(); method
turnLeft();
move();
turnLeft(); A Karelthe
The run method, which specifies program class
operations
turnLeft();
turnLeft();
move();
putBeeper(); commands
move();
}
}
Java and the Object-Oriented Paradigm
• Programming languages typically support a particular style of
use, which is called its programming paradigm.
• Traditional languages like FORTRAN, Pascal, and C use the
procedural paradigm, in which the programmer defines the
algorithmic operations and data structures independently.
• Modern languages like Java tend to favor the object-oriented
paradigm in which the programmer defines the algorithmic
and data structure of a program in a more integrated way.
• In Java, programs are written as collections of classes, which
serve as templates for individual objects.
• Each object is an instance of a particular class; a single
class can serve as a pattern for many different objects.
Messenger extends Karel =
nds
e
ext