CS 330 Programming Languages 12 / 09 / 2008 Instructor: Michael Eckmann.

Slides:



Advertisements
Similar presentations
CS 330 Programming Languages 12 / 02 / 2008 Instructor: Michael Eckmann.
Advertisements

OBJECT ORIENTED PROGRAMMING M Taimoor Khan
CS 330 Programming Languages 12 / 12 / 2006 Instructor: Michael Eckmann.
CS 206 Introduction to Computer Science II 09 / 14 / 2009 Instructor: Michael Eckmann.
CS 330 Programming Languages 10 / 14 / 2008 Instructor: Michael Eckmann.
CS 106 Introduction to Computer Science I 11 / 26 / 2007 Instructor: Michael Eckmann.
CS 102 Computers In Context (Multimedia)‏ 04 / 20 / 2009 Instructor: Michael Eckmann.
CS 106 Introduction to Computer Science I 11 / 09 / 2007 Instructor: Michael Eckmann.
CS 330 Programming Languages 10 / 16 / 2008 Instructor: Michael Eckmann.
CS 206 Introduction to Computer Science II 01 / 21 / 2009 Instructor: Michael Eckmann.
CS 106 Introduction to Computer Science I 04 / 02 / 2008 Instructor: Michael Eckmann.
CS 330 Programming Languages 10 / 11 / 2007 Instructor: Michael Eckmann.
CS 106 Introduction to Computer Science I 11 / 09 / 2007 Instructor: Michael Eckmann.
CS 501: Software Engineering Fall 2000 Lecture 16 System Architecture III Distributed Objects.
CS 106 Introduction to Computer Science I 04 / 16 / 2010 Instructor: Michael Eckmann.
CS 206 Introduction to Computer Science II 09 / 04 / 2008 Instructor: Michael Eckmann.
CS 206 Introduction to Computer Science II 09 / 17 / 2008 Instructor: Michael Eckmann.
CS 330 Programming Languages 09 / 18 / 2007 Instructor: Michael Eckmann.
CS 330 Programming Languages 11 / 20 / 2007 Instructor: Michael Eckmann.
CS 206 Introduction to Computer Science II 10 / 14 / 2009 Instructor: Michael Eckmann.
CS 106 Introduction to Computer Science I 03 / 28 / 2008 Instructor: Michael Eckmann.
CS 330 Programming Languages 10 / 10 / 2006 Instructor: Michael Eckmann.
CS 106 Introduction to Computer Science I 03 / 30 / 2007 Instructor: Michael Eckmann.
CS 106 Introduction to Computer Science I 03 / 03 / 2008 Instructor: Michael Eckmann.
CS 330 Programming Languages 09 / 30 / 2008 Instructor: Michael Eckmann.
CS 106 Introduction to Computer Science I 04 / 09 / 2008 Instructor: Michael Eckmann.
CS 330 Programming Languages 09 / 23 / 2008 Instructor: Michael Eckmann.
CS 106 Introduction to Computer Science I 03 / 19 / 2008 Instructor: Michael Eckmann.
CS 330 Programming Languages 09 / 16 / 2008 Instructor: Michael Eckmann.
CS 106 Introduction to Computer Science I 04 / 21 / 2010 Instructor: Michael Eckmann.
CS 206 Introduction to Computer Science II 01 / 23 / 2009 Instructor: Michael Eckmann.
CS 106 Introduction to Computer Science I 09 / 28 / 2007 Instructor: Michael Eckmann.
CS 206 Introduction to Computer Science II 09 / 19 / 2008 Instructor: Michael Eckmann.
CS 106 Introduction to Computer Science I 03 / 17 / 2008 Instructor: Michael Eckmann.
ISBN Chapter 12 Support for Object- Oriented Programming.
Programming Paradigms Imperative programming Functional programming Logic programming Event-driven programming Object-oriented programming A programming.
Programming Languages – Coding schemes used to write both systems and application software A programming language is an abstraction mechanism. It enables.
ISBN Chapter 16 Logic Programming Languages.
Logic Programming Languages
CS 106 Introduction to Computer Science I 04 / 13 / 2007 Friday the 13 th Instructor: Michael Eckmann.
CS 330 Programming Languages 09 / 04 / 2008 Instructor: Michael Eckmann.
CS 403 – Programming Languages Class 25 November 28, 2000.
CS 106 Introduction to Computer Science I 03 / 19 / 2007 Instructor: Michael Eckmann.
1-1 Introduction Logic programming languages, sometimes called declarative programming languages Express programs in a form of symbolic logic Use a logical.
CS 106 Introduction to Computer Science I 04 / 20 / 2007 Instructor: Michael Eckmann.
CS200 Algorithms and Data StructuresColorado State University Part 4. Advanced Java Topics Instructor: Sangmi Pallickara
CS 206 Introduction to Computer Science II 09 / 10 / 2009 Instructor: Michael Eckmann.
CS 330 Programming Languages 10 / 07 / 2008 Instructor: Michael Eckmann.
More on Hierarchies 1. When an object of a subclass is instantiated, is memory allocated for only the data members of the subclass or also for the members.
Chapter 12 Computer Programming. Chapter Contents Chapter 12: Computer Programming 2  Section A: Programming Basics  Section B: Procedural Programming.
CS 206 Introduction to Computer Science II 02 / 23 / 2009 Instructor: Michael Eckmann.
Chapter 12 Support for Object oriented Programming.
1 Prolog and Logic Languages Aaron Bloomfield CS 415 Fall 2005.
CS 330 Programming Languages 10 / 02 / 2007 Instructor: Michael Eckmann.
Ch. 13 Ch. 131 jcmt CSE 3302 Programming Languages CSE3302 Programming Languages (notes?) Dr. Carter Tiernan.
CS 206 Introduction to Computer Science II 09 / 11 / 2009 Instructor: Michael Eckmann.
CS 106 Introduction to Computer Science I 10 / 29 / 2007 Instructor: Michael Eckmann.
CS 106 Introduction to Computer Science I 04 / 18 / 2008 Instructor: Michael Eckmann.
CS 106 Introduction to Computer Science I 03 / 02 / 2007 Instructor: Michael Eckmann.
CS 106 Introduction to Computer Science I 03 / 22 / 2010 Instructor: Michael Eckmann.
CS 330 Programming Languages 09 / 25 / 2007 Instructor: Michael Eckmann.
CS 330 Programming Languages 09 / 30 / 2008 Instructor: Michael Eckmann.
CS 330 Programming Languages 12 / 06 / 2007 Instructor: Michael Eckmann.
Types of Programming Languages
Section 11.1 Class Variables and Methods
Computer Programming.
CSE 1030: Implementing GUI Mark Shtern.
Programming Languages 2nd edition Tucker and Noonan
Lecture 8 Programming Paradigm & Languages. Programming Languages The process of telling the computer what to do Also known as coding.
Chapter 2. Problem Solving and Software Engineering
Presentation transcript:

CS 330 Programming Languages 12 / 09 / 2008 Instructor: Michael Eckmann

Michael Eckmann - Skidmore College - CS Fall 2008 Today’s Topics Questions / comments? Prolog Closing remarks

Michael Eckmann - Skidmore College - CS Fall 2008 Prolog Prolog implementations use backward chaining Backward chaining –begin with goal and attempt to find sequence that leads to set of facts in database When goal has more than one subgoal, Prolog uses depth-first search Depth-first search – find a complete proof for the first subgoal before working on others backtrackingFor a goal with multiple subgoals, if fail to show truth of one of subgoals, Prolog uses backtracking Backtracking –reconsider previous subgoal to possibly find a solution

Michael Eckmann - Skidmore College - CS Fall 2008 Prolog append([], List, List). append([Head | List_1], List_2, [Head | List_3])‏ :- append (List_1, List_2, List_3). Reminder: –Append can append 2 lists together to result in the third (we saw this last time.) How do we call it this way?

Michael Eckmann - Skidmore College - CS Fall 2008 Prolog append([], List, List). append([Head | List_1], List_2, [Head | List_3])‏ :- append (List_1, List_2, List_3). Reminder: –Append can append 2 lists together to result in the third (we saw this last time.) How do we call it this way? First and second parameter are literally lists, the third parameter is a variable. e.g. append([a],[b],L). would succeed and L=[a,b] –However, append, when called can also verify if first list and second list would result in the third list if they were appended together. Call it with all parameters being lists. e.g. append([a],[b],[a,b]). would succeed.

Michael Eckmann - Skidmore College - CS Fall 2008 Prolog append([], List, List). append([Head | List_1], List_2, [Head | List_3])‏ :- append (List_1, List_2, List_3). –Append, can also be called with the third parameter instantiated and the first two as variables. This would instantiate the first and second parameter by decomposing the third parameter. Call it with all parameters being lists. e.g. append(F,S,[a,b,c]). would generate: –F = a –S = [b,c] –Let's see this in action by rearranging the subgoals in last class's sentence parsing program.

Michael Eckmann - Skidmore College - CS Fall 2008 Prolog The way the sentence parsing program is written now is more efficient if the database of words is large. Why?

Michael Eckmann - Skidmore College - CS Fall 2008 Prolog Let's look at a family program (family3.pro). Let's look at a program to solve towers of hanoi (hanoi.pro).

Michael Eckmann - Skidmore College - CS Fall 2008 Prolog Open a terminal and type gedit & and then enter (for coding)‏ Bprolog bp and enter cl(myprog.pro) %compile and load a prolog program consult(myprog.pro) % use if want to trace the code trace % put bp in trace mode, need to consult first notrace % take bp out of trace mode halt % exits help % prints help ; % use to get next result Examples of consult, trace and ; which we didn't use last time w/ speed.pro

Michael Eckmann - Skidmore College - CS Fall 2004 Other topics Object oriented programming –What makes a language object oriented? What are the characteristics of all OOPL's?

Michael Eckmann - Skidmore College - CS Fall 2004 Other topics Object oriented programming –What makes a language object oriented? What are the characteristics of all OOPL's? Abstract data types (classes)‏ Inheritance Dynamic binding of method calls to methods What are these features?

Michael Eckmann - Skidmore College - CS Fall 2004 Other topics Object oriented programming Paradigm Evolution 1. Procedural s-1970s (procedural abstraction)‏ 2. Data-Oriented - early 1980s (data abstraction)‏ 3. OOP - late 1980s (inheritance and dynamic binding)‏ Origins of Inheritance –Observations of the mid-late 1980s : Productivity increases can come from reuse Unfortunately, –ADTs are difficult to reuse--never quite right –All ADTs are independent and at the same level Inheritance solves both--reuse ADTs after minor changes and define classes in a hierarchy

Michael Eckmann - Skidmore College - CS Fall 2004 Other topics Exception Handling –Unusual event detectable by hardware or software that may require special processing –try/catch/finally in Java –try/catch/catch* in C++ Event Handling –Event driven programming Parts of program executed at unpredictable times e.g. GUI buttons, fields, etc.