งานนำเสนอกำลังจะดาวน์โหลด โปรดรอ

งานนำเสนอกำลังจะดาวน์โหลด โปรดรอ

Overview ธนวัฒน์ แซ่ เอียบ. Why Study PL? เขียนโปรแกรมตามแนวคิดที่ออกแบบไว้ชัดเจนขึ้น –Appreciation for valuable laguage features and encourages programmers.

งานนำเสนอที่คล้ายกัน


งานนำเสนอเรื่อง: "Overview ธนวัฒน์ แซ่ เอียบ. Why Study PL? เขียนโปรแกรมตามแนวคิดที่ออกแบบไว้ชัดเจนขึ้น –Appreciation for valuable laguage features and encourages programmers."— ใบสำเนางานนำเสนอ:

1 Overview ธนวัฒน์ แซ่ เอียบ

2 Why Study PL? เขียนโปรแกรมตามแนวคิดที่ออกแบบไว้ชัดเจนขึ้น –Appreciation for valuable laguage features and encourages programmers to use them เข้าใจลักษณะและโครงสร้างของภาษาจริงๆ – ข้อดีและข้อเสีย ไม่มีภาษาที่สมบูรณ์แบบดังนั้นการ เลือกใช้ให้เหมาะสมกับงานจะช่วยในการพัฒนา –Many features now available in programming langusges were not widely known ทำให้เรียนรู้ภาษาใหม่ได้ง่ายขึ้น – ภาษามีการพัฒนาอย่างต่อเนื่องไม่หยุดนิ่ง การเรียนรู้ เพื่อเข้าใจให้ทันการเปลี่ยนแปลงเป็นสิ่งจำเป็นอย่าง ยิ่ง –Once a through understanding of the fundamental concepts of languages is acquired, it becomes far easier to see how these concepts are incorporated into the design of the language being learned

3 Why Study PL? ความสามารถในการออกแบบภาษาใหม่ – ช่วยให้โปรแกรมเมอร์ที่มีประสบการณ์สามารถ ออกแบบภาษาขึ้นมาใหม่ ตามความต้องการ และ ช่วยให้ผู้ใช้งานสามารถตรวจสอบและประเมินค่า ผลงานได้

4 Language Influences hardware architecture – ภาษาในสมัยก่อนออกแบบตามแนวคิดของ von Neumann เรียกว่า imperative languages

5 Language Influences Fetch-execute cycle Executing an instruction is generally much faster than moving things between memory and CPU. So the speed of this movement limits the speed of the computer. This is the “von Neumann bottleneck”.

6 Language Influences Program methodology Process oriented – เมื่อปัญหามีความซับซ้อนมากขึ้น ในปี 1970 มี แนวคิดกรรมวิธีพัฒนาซอฟต์แวร์ขึ้นมาเรียกว่า top- down design และ step-wise refinement ภาษาในยุคมีข้อเสียในเรื่อง type checking และ control statement –Process-oriented  data-oriented ( ปลายยุค 70) ต้นยุค 80 data-oriented พัฒนาไปเป็น object- oriented –Data abstraction –Encapsulation –Inheritance and polymorphism

7 Levels of programming languages Machine language –Operations are very simple things like Move contents of mem location 08125 to register 7 Add contents of mem location 08125 to register 7 Shift the contents if register 3 left one bit Jump to program line 85 Skip the next instruction if register i is sero –Instructions are encoded as numbers. –No variables: operands are memory addresses or register numbers. –Programming requires deep understanding of the machine architecture

8 Levels of programming languages Machine language –Programs are not portable because instructions and their encoding are machine- specific –Programs are extremely hard to write, debug and read

9 Levels of programming languages Assembly language –Operations and operands have symbolic names. –Can use macros as shorthand for common sequences of code. –An assembler translates into machine code. –Still machine dependent. –Almost as hard to write as machine code

10 Levels of programming languages High-level language Examples: C, Lisp, Java, Fortran, … Have higher level constructs. Example: Languages usually supports type checking and other checks that help detect bugs. Programs are much easier to write, debug and read. Programs are now machine independent. Programs may still be “language-implementation dependent”. Before 1957, it was commnly delieved that any compiler would produce code so teribly inefficient as to be useless 1 sub 3 5 ;sub 3 from reg 5 2 skp 5 ;skip if reg 5 is 0 3 jmp 10 ;jump to line 10 4 10 if (x==3) else

11 Interpreters vs. Translators (compilers) Compiler – คอมไพเลอร์ทำ หน้าที่แปล (translation) โปรแกรมเป็น ภาษาเครื่อง ซึ่งทำ ให้การปฏิบัติงาน ของโปรแกรมเร็ว มาก เช่น คอมไพเลอร์ของ ภาษา C, COBOL

12 Interpreters vs. Translators (compilers) Pure Interpretation – โปรแกรมถูกตีความ (interpreted) แต่ละคำสั่งด้วย โปรแกรมที่เรียกว่า interpreter ซึ่งทำหน้าที่เป็น ซอฟต์แวร์จำลอง fetch-execute cycle สำหรับ ภาษาระดับสูง และประกอบด้วย virtual machine สำหรับภาษานั้น

13 Interpreters vs. Translators (compilers) Hybrid Implementation Systems – ระบบที่มีทั้ง compilers และ interpreters

14 Language Paradigms-1 Imperative languages –Program statements are commands. Ex.: “Add 17 to x.” –Key operations: Assignment. Looping. –Fits the von Neumann architecture closely. –Examples: Fortran, C, Pascal, Turing. Functional languages –Program statements describe the value of expressions, using(essentially) noun phrases. –Key operation: Expression evaluation, by applying a function. –Examples: Lisp, Scheme, ML

15 Language Paradigms-1 Logic-based languages –Program statements describe facts and rules. –Example: “Fact : Doug is Tom’s father. Rule : If x is y’s father and y is z’s father, then x is z’s grandfather.” –Programs don’t say how to find a solution. –Key operation: “Unification” (the how). –Example: Prolog.

16 Language Paradigms-1 Object-oriented languages –Program describes communication between objects. Example: “Fraction f1, simplify yourself.” –Key operation: Message passing, inheritance. –Can be imperative or functional. –Examples: Simula, C++, Java, CLOS.

17 Language Paradigms-2 Scientific Applications – เครื่องคอมพิวเตอร์เครื่องแรกในปี 1940 ประดิษฐ์ ขึ้นมาเพื่องานทางด้านวิทยาศาสตร์ โปรแกรมมี โครงสร้างข้อมูลแบบง่ายและมีการคำนวณตัวเลข ทางคณิตศาสตร์อย่างละเอียดเช่น FORTRAN ALGOL60 Business Applications – การนำคอมพิวเตอร์มาใช้ทางด้านธุรกิจเริ่มต้นในปี 1950 ภาษาระดับสูงที่ประสบความสำเร็จคือ COBOL Artificial Intelligence – ภาษาที่มีการคำนวณเชิงสัญลักษณ์มากกว่าเชิง ตัวเลข โครงสร้างข้อมูลสำหรับการคำนวณแบบนี้คือ linked lists เช่น ภาษา LISP Prolog

18 Language Paradigms-2 Systems Programming – ภาษาสำหรับสร้างระบบปฏิบัติการ ซึ่งจำเป็น ต้องการปฏิบัติงานที่มีประสิทธิภาพ เร็ว ทำงานได้ อย่างต่อเนื่อง และต้องทำงานในโหมด low-level เพื่อติดต่อกับอุปกรณ์ภายนอกได้ เช่น ภาษา C สร้างขึ้นเพื่อสร้างระบบปฏิบัติการ Unix และง่ายต่อ การ port ระหว่างเครื่องที่แตกต่างกัน Scripting Languages – ภาษานี้คือการนำรายการของคำสั่งมาวางเรียงต่อกัน เรียกว่า script เก็บในไฟล์ ภาษาแรกมีชื่อว่า sh (shell) จัดเก็บคำสั่งง่ายๆ สำหรับจัดการไฟล์ หรือ แบ่งไฟล์ออกจากกัน –Perl พัฒนามาจากภาษา sh และ awk รวมกัน ( โดย การเพิ่มส่วนต่างๆให้กับ sh ?) จนเป็นภาษาที่ สมบูรณ์ในการเขียนโปรแกรม

19 What Makes a Good Language General goals: –The language should be easy to learn. –Programs written in it should be easy to write and to read.

20 Language Evaluation Criteria Readability – สิ่งสำคัญในการตัดสินคือ เป็นภาษาที่สามารถอ่าน และเข้าใจได้ง่าย สมัยแรกการพัฒนาเน้นในเรื่อง ของการเขียน แต่หลังจากแนวคิด software lift cycle (1987) maintenance เป็นส่วนที่สำคัญที่สุด ของ cycle count = count + 1 count += 1 count++ ++count

21 Language Evaluation Criteria Writability – วัดความสามารถในการเขียนโปรแกรม Reliability – โปรแกรมมีเสถียรภาพ ถ้าสามารถปฏิบัติงานภายใต้ เงื่อนไขที่กำหนดได้ทั้งหมด int i = 1; float f = 9.5; i = f ; | f = i; Cost – ค่าใช้จ่ายในด้านต่างๆเช่น เวลาที่ใช้ในการเขียน ค่าใช้จ่ายในการฝึกอบรม เวลาที่ใช้ในการคอมไพล์ เวลาในการ execute

22 Language Evaluation Criteria Orthogonal – ลักษณะของคำสั่งที่ไม่ขึ้นอยู่กับบริบท (context) ของโปรแกรม – คำสั่งที่นำค่าตัวเลขขนาด 32 บิตในหน่วยความจำ หรือรีจีสเตอร์ไปบวกและแทนที่ค่าเดิมของรีจีสเตอร์ ปลายทาง เช่น – เครื่อง IBM mainframe ประกอบไปด้วยสองคำสั่ง A Reg1, memory_cell AR Reg1, Reg2 – เครื่อง VAX ประกอบด้วยหนึ่งคำสั่ง ADDL operand_1, operand_2

23 ที่มา Concepts of programming languages : Sebesta, Robert W. Joanis, Eric : University of Toronto


ดาวน์โหลด ppt Overview ธนวัฒน์ แซ่ เอียบ. Why Study PL? เขียนโปรแกรมตามแนวคิดที่ออกแบบไว้ชัดเจนขึ้น –Appreciation for valuable laguage features and encourages programmers.

งานนำเสนอที่คล้ายกัน


Ads by Google