ice1341 programming languages spring 2005 lecture #3 lecture #3 in-young ko iko.at. icu.ac.kr...

17
ICE1341 ICE1341 Programming Languages Programming Languages Spring 2005 Spring 2005 Lecture #3 Lecture #3 In-Young Ko iko .AT. i cu . ac.kr Information and Communications University (ICU)

Upload: shanon-townsend

Post on 23-Dec-2015

217 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: ICE1341 Programming Languages Spring 2005 Lecture #3 Lecture #3 In-Young Ko iko.AT. icu.ac.kr iko.AT. icu.ac.kr Information and Communications University

ICE1341 ICE1341 Programming LanguagesProgramming Languages

Spring 2005Spring 2005

Lecture #3Lecture #3

In-Young Koiko .AT. icu.ac.kr

Information and Communications University (ICU)

Page 2: ICE1341 Programming Languages Spring 2005 Lecture #3 Lecture #3 In-Young Ko iko.AT. icu.ac.kr iko.AT. icu.ac.kr Information and Communications University

Spring 2005 2 ICE 1341 – Programming Languages © In-Young Ko, Information and Communications University

AnnouncementsAnnouncements

The lecturer has been changedThe lecturer has been changed There will be a There will be a photo sessionphoto session after after

today’s classtoday’s class Send the TA (torajim .AT. icu.ac.kr) an Send the TA (torajim .AT. icu.ac.kr) an

email aboutemail about Your name and student IDYour name and student ID Major (track)Major (track) List programming languagesList programming languages that you are that you are

familiar with (sort them based on your skill familiar with (sort them based on your skill level)level)

Page 3: ICE1341 Programming Languages Spring 2005 Lecture #3 Lecture #3 In-Young Ko iko.AT. icu.ac.kr iko.AT. icu.ac.kr Information and Communications University

Spring 2005 3 ICE 1341 – Programming Languages © In-Young Ko, Information and Communications University

Instructor InformationInstructor Information

Prof. Prof. In-Young KoIn-Young Ko Office: F607Office: F607 Official Office Hours:Official Office Hours:

Monday 3:00pm – 4:00pmMonday 3:00pm – 4:00pm Thursday 4:00pm – 5:00pm Thursday 4:00pm – 5:00pm

Unofficial Office Hours: Unofficial Office Hours: Any timeAny time Email: Email: ikoiko .AT. .AT. icu.ac.kricu.ac.kr Phone: 042-866-6163Phone: 042-866-6163

Page 4: ICE1341 Programming Languages Spring 2005 Lecture #3 Lecture #3 In-Young Ko iko.AT. icu.ac.kr iko.AT. icu.ac.kr Information and Communications University

Spring 2005 4 ICE 1341 – Programming Languages © In-Young Ko, Information and Communications University

Class InformationClass Information Code: Code: ICE 1341ICE 1341 Title: Title: Programming LanguagesProgramming Languages Prerequisites:Prerequisites:

Programming Fundamentals I (ICE 0121)Programming Fundamentals I (ICE 0121) Data Structures (ICE 1200)Data Structures (ICE 1200)

Class Hours: Class Hours: Mon 4:00PM-5:30 & Thu 2:30PM-4:00PMMon 4:00PM-5:30 & Thu 2:30PM-4:00PM Classroom: Classroom: L401L401 Class Homepage:Class Homepage: bigbear.icu.ac.kr/~iko/classes/ice1341/ bigbear.icu.ac.kr/~iko/classes/ice1341/

Lecture notesLecture notes will be available at the class homepage will be available at the class homepage User the CyberICU site for the Q&A and discussion boardsUser the CyberICU site for the Q&A and discussion boards

TA: TA: Woo-Hyuk JangWoo-Hyuk Jang (torajim .AT. icu.ac.kr) (torajim .AT. icu.ac.kr) TA Office Hours: TBATA Office Hours: TBA

Page 5: ICE1341 Programming Languages Spring 2005 Lecture #3 Lecture #3 In-Young Ko iko.AT. icu.ac.kr iko.AT. icu.ac.kr Information and Communications University

Spring 2005 5 ICE 1341 – Programming Languages © In-Young Ko, Information and Communications University

Textbook & Reference Textbook & Reference InformationInformation

Textbook Robert W. Sebesta, Concepts of Programming

Languages, 6th Edition, Addison Wesley, 2003 Reference

John C. Mitchell, Concepts in Programming Languages, Cambridge University Press, 2003

Brett McLaughlin, Java & XML, 2nd Edition, O’Reilly, 2001

Page 6: ICE1341 Programming Languages Spring 2005 Lecture #3 Lecture #3 In-Young Ko iko.AT. icu.ac.kr iko.AT. icu.ac.kr Information and Communications University

Spring 2005 6 ICE 1341 – Programming Languages © In-Young Ko, Information and Communications University

AssignmentsAssignments

Each homework is Each homework is due at the beginningdue at the beginningof classof class on the assigned due date on the assigned due date

Don’t make a cover pageDon’t make a cover page for a homework for a homework report, but don’t forget to write your name report, but don’t forget to write your name and student ID at the topand student ID at the top

Please Please do not collaboratedo not collaborate in doing in doing homework, no exceptionshomework, no exceptions

Page 7: ICE1341 Programming Languages Spring 2005 Lecture #3 Lecture #3 In-Young Ko iko.AT. icu.ac.kr iko.AT. icu.ac.kr Information and Communications University

Spring 2005 7 ICE 1341 – Programming Languages © In-Young Ko, Information and Communications University

Term ProjectsTerm Projects

Project TeamsProject Teams 4-5 people per a group4-5 people per a group Form your team by Thu March 10thForm your team by Thu March 10th

Project proposalProject proposal Midterm ProjectMidterm Project – Designing a structured – Designing a structured

programming languageprogramming language Final ProjectFinal Project – Implementing a cross – Implementing a cross

compilercompiler PresentationPresentation session for each project session for each project

Page 8: ICE1341 Programming Languages Spring 2005 Lecture #3 Lecture #3 In-Young Ko iko.AT. icu.ac.kr iko.AT. icu.ac.kr Information and Communications University

Spring 2005 8 ICE 1341 – Programming Languages © In-Young Ko, Information and Communications University

Grading PolicyGrading Policy

Exams Midterm (15%) Final (30%)

Projects 2 Term Projects (30%)

Homework (15%) 8 Homeworks Due by next week’s class

Others Attendance and Participation (10%)

Page 9: ICE1341 Programming Languages Spring 2005 Lecture #3 Lecture #3 In-Young Ko iko.AT. icu.ac.kr iko.AT. icu.ac.kr Information and Communications University

Spring 2005 9 ICE 1341 – Programming Languages © In-Young Ko, Information and Communications University

Course PolicyCourse Policy

Students who Students who fail to attend more than fail to attend more than 15%15% of the classes without proper notice of the classes without proper notice will get will get FF

Please Please don’t be latedon’t be late for class for class Please Please turn off your cell phonesturn off your cell phones when you when you

enter the classroomenter the classroom Please Please don’t disturb other studentsdon’t disturb other students by by

walking in and out during classwalking in and out during class

Page 10: ICE1341 Programming Languages Spring 2005 Lecture #3 Lecture #3 In-Young Ko iko.AT. icu.ac.kr iko.AT. icu.ac.kr Information and Communications University

Spring 2005 10

ICE 1341 – Programming Languages © In-Young Ko, Information and Communications University

What Is This Class For?What Is This Class For?

Learning another programming Learning another programming language?language?

Finding out the best programming Finding out the best programming language for all purposes?language for all purposes?

Learning the compiler theory?Learning the compiler theory?

Learning design concepts of Learning design concepts of programming languages?programming languages?

Practicing designing a Practicing designing a programming language?programming language?

Page 11: ICE1341 Programming Languages Spring 2005 Lecture #3 Lecture #3 In-Young Ko iko.AT. icu.ac.kr iko.AT. icu.ac.kr Information and Communications University

Spring 2005 11

ICE 1341 – Programming Languages © In-Young Ko, Information and Communications University

Language SurveyLanguage Survey BASICBASIC FortranFortran COBOLCOBOL P/L IP/L I LISPLISP C/C++C/C++ PascalPascal JavaJava Scripting Languages Scripting Languages

(Perl, JavaScript)(Perl, JavaScript) Assembly LanguagesAssembly Languages Markup Languages Markup Languages

(HTML, XML, RDF)(HTML, XML, RDF) ……

* Sebesta Figure 2.1

Page 12: ICE1341 Programming Languages Spring 2005 Lecture #3 Lecture #3 In-Young Ko iko.AT. icu.ac.kr iko.AT. icu.ac.kr Information and Communications University

Spring 2005 12

ICE 1341 – Programming Languages © In-Young Ko, Information and Communications University

Programming ParadigmsProgramming Paradigms

Sequential ProgrammingSequential Programming (Fortran, BASIC) (Fortran, BASIC) Structured ProgrammingStructured Programming (Pascal, C, Java) (Pascal, C, Java) Functional ProgrammingFunctional Programming (LISP) (LISP)

Logic ProgrammingLogic Programming (Prolog, LISP) (Prolog, LISP) Scripting & CoordinationScripting & Coordination (Perl, JavaScript) (Perl, JavaScript) Service-Oriented ProgrammingService-Oriented Programming (BPEL4WS, C#) (BPEL4WS, C#) Visual Programming Visual Programming (Visual BASIC)(Visual BASIC)

Object-oriented ProgrammingObject-oriented Programming (Java, C++, C#) (Java, C++, C#)

Page 13: ICE1341 Programming Languages Spring 2005 Lecture #3 Lecture #3 In-Young Ko iko.AT. icu.ac.kr iko.AT. icu.ac.kr Information and Communications University

Spring 2005 13

ICE 1341 – Programming Languages © In-Young Ko, Information and Communications University

Language Evaluation CriteriaLanguage Evaluation Criteria

ReadabilityReadability: How easy to read and : How easy to read and understand programs?understand programs? Machine orientationMachine orientation vs. vs. Human orientationHuman orientation In the context of the In the context of the problem domainproblem domain

WritabilityWritability: How easy to create programs : How easy to create programs for a problem domain?for a problem domain? In the context of the problem domainIn the context of the problem domain

ReliabilityReliability: How easy to prevent, detect : How easy to prevent, detect and handle errors?and handle errors?

Page 14: ICE1341 Programming Languages Spring 2005 Lecture #3 Lecture #3 In-Young Ko iko.AT. icu.ac.kr iko.AT. icu.ac.kr Information and Communications University

Spring 2005 14

ICE 1341 – Programming Languages © In-Young Ko, Information and Communications University

Language Evaluation Criteria – Language Evaluation Criteria – Readability FactorsReadability Factors

SimplicitySimplicity Number of basic componentsNumber of basic components Feature MultiplicityFeature Multiplicity

e.g., count = count + 1; count += 1; count++; ++counte.g., count = count + 1; count += 1; count++; ++count Operator OverloadingOperator Overloading

e.g., int a = b + 7; float x = y + 0.7; String s = hello + “world”e.g., int a = b + 7; float x = y + 0.7; String s = hello + “world” int[] p = new int[] { 1, 2 } + new int[] { 3, 4 }int[] p = new int[] { 1, 2 } + new int[] { 3, 4 }

OrthogonalityOrthogonality:: Fewer exceptions in combining primitive constructsFewer exceptions in combining primitive constructse.g., e.g., void[] x = new void[10]void[] x = new void[10]

Control StatementControl Statemente.g., while loop vs. goto statemente.g., while loop vs. goto statement

Data Types and StructuresData Types and Structurese.g., timeOut = 1 vs. timeOut = true; a record array vs. a set of arrayse.g., timeOut = 1 vs. timeOut = true; a record array vs. a set of arrays

Syntax ConsiderationsSyntax Considerations Identifier forms: e.g., length restriction, case sensitivityIdentifier forms: e.g., length restriction, case sensitivity Keyword selections: e.g., { } vs. Begin – EndKeyword selections: e.g., { } vs. Begin – End Meaning: e.g., static variables vs. static methods in JavaMeaning: e.g., static variables vs. static methods in Java

Page 15: ICE1341 Programming Languages Spring 2005 Lecture #3 Lecture #3 In-Young Ko iko.AT. icu.ac.kr iko.AT. icu.ac.kr Information and Communications University

Spring 2005 15

ICE 1341 – Programming Languages © In-Young Ko, Information and Communications University

Language Evaluation Criteria – Language Evaluation Criteria – Writability FactorsWritability Factors

Simplicity and OrthogonalitySimplicity and Orthogonality AbstractionAbstraction: ability to define and use : ability to define and use

complicated structures or operationscomplicated structures or operations e.g., subprograms, interfacese.g., subprograms, interfaces

ExpressivityExpressivity: convenience in specifying : convenience in specifying computationscomputations e.g.1, count++ vs. count = count + 1e.g.1, count++ vs. count = count + 1 e.g.2, if (a == 2 && b == 3) vs. e.g.2, if (a == 2 && b == 3) vs.

if (a == 2 and then b == 3)if (a == 2 and then b == 3) e.g.3, for vs. whilee.g.3, for vs. while

Page 16: ICE1341 Programming Languages Spring 2005 Lecture #3 Lecture #3 In-Young Ko iko.AT. icu.ac.kr iko.AT. icu.ac.kr Information and Communications University

Spring 2005 16

ICE 1341 – Programming Languages © In-Young Ko, Information and Communications University

Language Evaluation Criteria – Language Evaluation Criteria – Reliability FactorsReliability Factors

Type CheckingType Checking: testing for inconsistency in using data : testing for inconsistency in using data typestypes Compile-time checking is more desirableCompile-time checking is more desirable Explicit Explicit type castingtype casting improves correctness improves correctness

e.g., int a = 3 / 5 + 4 / 7e.g., int a = 3 / 5 + 4 / 7 int a = (int)((float)3 / 5 + (float)4 / 7)int a = (int)((float)3 / 5 + (float)4 / 7)

Exception HandlingException Handling: intercepting run-time errors and : intercepting run-time errors and performing recovery actionsperforming recovery actions Programs can continue its execution after the recovery actionPrograms can continue its execution after the recovery action

AliasingAliasing: having two or more referencing names for the : having two or more referencing names for the same memory blocksame memory block Aliasing makes programmers hard to debug programsAliasing makes programmers hard to debug programs e.g., pointers in Ce.g., pointers in C

Readability and WriterbilityReadability and Writerbility

Page 17: ICE1341 Programming Languages Spring 2005 Lecture #3 Lecture #3 In-Young Ko iko.AT. icu.ac.kr iko.AT. icu.ac.kr Information and Communications University

Spring 2005 17

ICE 1341 – Programming Languages © In-Young Ko, Information and Communications University

HW#1HW#1

Among the programming languages described Among the programming languages described in Chapter 2, please in Chapter 2, please choose 3 languageschoose 3 languages and and summarize the following information about the summarize the following information about the languages:languages: Historic background (1-2 lines)Historic background (1-2 lines) Programming domainsProgramming domains Programming paradigmsProgramming paradigms Special featuresSpecial features Pros and consPros and cons QuestionsQuestions