1 / 48

ภาษาคอมพิวเตอร์และการพัฒนาโปรแกรม Programming Languages and Program Development

ภาษาคอมพิวเตอร์และการพัฒนาโปรแกรม Programming Languages and Program Development. โปรแกรม ( Program). หมายถึงชุดคำสั่งที่เขียนด้วยภาษาโปรแกรมเพื่อบอกให้คอมพิวเตอร์ทำงานตามต้องการ. How People Make Programs.

Download Presentation

ภาษาคอมพิวเตอร์และการพัฒนาโปรแกรม Programming Languages and Program Development

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. ภาษาคอมพิวเตอร์และการพัฒนาโปรแกรมProgramming Languages and Program Development

  2. โปรแกรม (Program) หมายถึงชุดคำสั่งที่เขียนด้วยภาษาโปรแกรมเพื่อบอกให้คอมพิวเตอร์ทำงานตามต้องการ

  3. How People Make Programs Programming กระบวนการแก้ปัญหาโดยการเขียนชุดคำสั่งเป็นขั้นตอนบอกให้คอมพิวเตอร์ทำงานตามความต้องการของผู้ใช้

  4. Computer Programs and Programming Languages Next • Programming language—used to write instructions p. 664 Fig. 13-1

  5. How People Make Programs Programmingรวมถึง : • การกำหนดปัญหา • การออกแบบ ตรวจสอบ และทดสอบ algorithm • เขียนโปรแกรม • ตรวจสอบและแก้ไขโปรแกรม

  6. Interpreters and Compilers Interpreter: แต่ละคำสั่งจะถูกแปลทันที • Compiler: จะป้อนโปรแกรมเข้าไปทั้งหมดแล้วจึงแปลเป็นภาษาเครื่อง

  7. Programming Languages and Methodologies ระบบคอมพิวเตอร์ทุกเครื่องจะต้องมีภาษาธรรมชาติของตัวเองคือ machine language Machine language คือ ภาษาที่ใช้แทนด้วยเลขฐานสอง ทำให้มีการเขียน การอ่าน และการแก้ไขยุ่งยาก Assembly language เป็นภาษาสัญลักษณ์ที่ใช้แทนด้วยตัวอักษร และง่ายต่อการเข้าใจต่อการอ่านและการเขียน

  8. Levels of Languages Lower-level languages – เปรียบเสมือนกับเลข 0และเลข 1 ที่คอมพิวเตอร์เข้าใจ Higher-level languages – เปรียบ่สมือนกับภาษาที่มนุษย์ใช้ Divided into five generations

  9. Low-levellanguage Next คอมพิวเตอร์จะเข้าใจภาษาเครื่องตามชนิดของคอมพิวเตอร์ ภาษาเครื่องและภาษาแอสแซมบลีจัดเป็นภาษาระดับต่ำ p. 664

  10. Next High-level language เป็นภาษาคอมพิวเตอร์ที่สามารถนำไปใช้กับคอมพิวเตอร์ได้ทุกเครื่อง p. 664

  11. Five Generations of Languages Machine language Assembly languages High-level languages Very high-level languages Natural languages

  12. 1. Low-Level Languages Next • What is machine language? • โปรแกรมและตำแหน่งของหน่วยความจำจะเขียนในรูปของค่า 0s และ 1s • ปัญหาของภาษาเครื่อง • โปรแกรมเขียนยากและต้องแก้ไข • คอมพิวเตอร์แต่ละเครื่องจะมีภาษาเป็นของตัวเอง • CPU และหน่วยความจำหลักจะเชื่อมต่อผ่านบัส p. 665 Fig. 13-2

  13. 2. Low-Level Languages Next • What is assembly language? • คำสั่งจะถูกกำหนดเป็นรหัสในรูปของสัญลักษณ์โดยใช้ตัวย่อและรหัส • Source programเป็นรหัสข้อมูลที่ถูกเปลี่ยนเป็นภาษาเครื่อง p. 666 Fig. 13-3

  14. 2. Assembly Languages • ตัวอย่าง A ใช้แทนค่าบวก add, C ใช้แทนว่า compare, etc. • “Adding values (Price and ShippingCharge) stored in memory” 156C LD R5, Price 166D LD R6, ShippingCharge 5056 ADDI R0, R5 ,R6 306E ST R0, TotalCost C000 HLT

  15. 3. Procedural Languages Next การเขียนคำสั่งเหมือนกับการเขียนภาษาอังกฤษ โปรแกรมเมอร์เขียนชุดคำสั่งบอกให้คอมพิวเตอร์ทำงานตามต้องการจนสมบูรณ์ บางครั้งจัดอยู่ในภาษายุคที่ 3 third-generation language (3GL) ภาษาที่ใช้กว้างขวางคือ BASIC, COBOL, and C p. 666

  16. High-Level Languages Well known high-level programming languages include: • FORTRAN(Formula Translation): เป็นภาษาระดับสูงภาษาแรกที่นำมาใช้ในเชิงธุรกิจ • COBOL(Common Business Oriented Language): เป็นภาษาที่พัฒนาเพื่อใช้ในการแก้ปัญหาทางธุรกิจ

  17. High Level Languages • LISP (List Processing): เป็นภาษาที่พัฒนาในการประมวลผลข้อมูลที่ไม่ใช่ตัวเลขเป็นตัวอักขระ คำ หรือสัญลักษณ์อื่นๆ • BASIC (Beginners All-purpose Symbolic Instruction Code): เป็นภาษาที่พัฒนาขึ้นมาเพื่อให้ใช้ง่ายต่อการเรียนรู้สำหรับผู้เริ่มต้น

  18. High-Level Languages Pascal: เป็นภาษาที่ออกแบบเป็นภาษาโครงสร้าง C: เป็นการพัฒนาขึ้นมาเพื่อเป็นเครื่องมือสำหรับการโปรแกรมระบบปฏิบัติการเช่นUNIX

  19. Object-Oriented Programming Languages Next • What is C++? • เป็นภาษาที่พัฒนาต่อจากภาษาซี โดยการเพิ้มความสะดวกขึ้นมาสำหรับการทำงานแบบเชิงวัตถุ (object-oriented) • ใช้ในการพัฒนาฐานข้อมูลและการเขียนโปรแกรมเว็บ

  20. Object-Oriented Programming Languages Next • What is Java? • พัฒนาขึ้นมาโดยบริษัท Sun Microsystems • มีลักษระเหมือนกับภาษา C++ เป็นแบบ just-in-time (JIT) compilerโดยการเปลี่ยน source code ให้เป็น machine code

  21. Object-Oriented Programming Languages Visual programming environment (VPE) allows developers to drag and drop objects to build programs Programmer writes and implements program in segments Next • What is a visual programming language? Provides visual or graphical interface for creating source code Sometimes calledfifth-generation language Often used in RAD (rapid application development) environment p. 671

  22. Object-Oriented Programming Languages Step 1. The programmer designs the user interface. Step 2.The programmer assigns properties to each object on the form. Step 3.The programmer writes code to define the action of each command button. Step 4.The programmer tests the application. Next • What is Visual Studio .NET 2003? • Suite of visual programming languages and RAD tools • .NET is set of technologies that allows program to run on Internet • Visual Basic .NET 2003 is used to build complex object-based programs

  23. Object-Oriented Programming Languages Next • What is Delphi? • Powerful visual programming tool • Ideal for large-scale enterprise and Web applications p. 673 Fig. 13-12

  24. Object-Oriented Programming Languages Next • What is PowerBuilder? • Another powerful visual programming tool • Best suited for Web-based and large-scale object-oriented applications p. 674 Fig. 13-13

  25. Nonprocedural Languages and Program Development Tools Next • What is a fourth-generation language(4GL)? • Nonprocedural language that allows access to data in database • Popular 4GL is SQL, query language that allows users to manage data in relational DBMS p. 675 Fig. 13-15

  26. Nonprocedural Languages and Program Development Tools Next • What is Visual Basic for Applications (VBA)? • Macro programming language • Macro—series of statements used to automate tasks p. 676 Fig. 13-17

  27. Web Page Development Next • What is HTML (Hypertext Markup Language)? • Used to create Web pages p. 678 Fig. 13-18

  28. Web Page Development Next • What is a scripting language? • Typically easy to learn and use • JavaScript—adds dynamic content and interactive elements to Web page • VBScript (Visual Basic, Scripting Edition)—adds intelligence and interactivity to Web page • Perl (Practical Extraction and Report Language)—has powerful text processing capabilities

  29. Web Page Development Next • What is dynamic HTML (DHTML)? • Allows developers to include more graphical interest and interactivity in Web page p. 682 Fig. 13-21

  30. Web Page Development Click to view Web Link,click Chapter 13, Click Web Link from left navigation, then click XML below Chapter 13 Next • What are XHTML, XML, and WML? Includes features of HTML and XML XHTML(ExtensibleHTML)enables Web sites to be displayed more easily on microbrowsers XML(ExtensibleMarkupLanguage)allows developers to create customized tags Server sends entire record to client, enabling client to do much of processing without going back to server WML(WirelessMarkupLanguage)allows developers to design pages specifically for microbrowsers Useswireless application protocol (WAP), standard that specifies how wireless devices communicate with Web p. 682

  31. Web Page Development DreamweaverMX FrontPage2003 FlashMX Next • What is Web page authoring software? • Creates sophisticated Web pages without using HTML • Generates HTML p. 683

  32. The Program Development Cycle What is the program development cycle? Next • Steps programmers use to build computer programs • Programming team—Group of programmers working on program p. 686 Fig. 13-24

  33. The Programming Process Program– a set of detailed, step-by-step instructions that directs the computer to do what you want it to do Programming language – aset of rules that provides a way of telling the computer what operations to perform Five main steps • Defining the problem • Planning the solution • Coding the program • Testing the program • Documenting the program

  34. Defining the Problemการกำหนดปัญหา • การกำหนดคุณสมบัติตามที่กำหนด: • ข้อมูลเข้า • ผลลัพธ์ที่ต้องการ • การประมวลผลข้อมูลเข้าให้เป็นผลลัพธ์ • นักเขียนโปรแกรมจะรับข้อกำหนดรายละเอียดจากนักวิเคราะห์ระบบ • หรือนักเขียนโปรแกรมอาจพบกับลูกค้าโดยตรง

  35. 2. Planning & Design the Solution • Algorithm –เป็นการกำหนดรายละเอียดขั้นตอนของการแก้ปัญหา • เครื่องมือที่ช่วยในการวางแผนอัลกอริทึมมีหลายชนิด • Desk-check the solution • การกำหนดขั้นตอนจะกำหนดด้วยดินสอยและกระดาษ • Planning Tool: • Flowchart – เป็นการใช้ภาพแทนขั้นตอนของการทำงาน • Pseudocode– ลักษณะเหมือนภาษาอังกฤษ • Specifies algorithm with more precision than you can in English, but less than a programming language

  36. Planning & Design Solution Object-oriented design Structured design, sometimes called top-down design Programmer begins with general design and moves toward detailed design Next • What is involved in designing the solution? Two approaches Devise solution algorithm, step-by-step procedure to solve problem p. 688

  37. Step 2 — Design Solution Next • What is a hierarchy chart? • Shows program modules graphically • Also called structure chart p. 688 Fig. 13-26

  38. Step 2 — Design Solution Next • โครงสร้างการควบคุมแบบเรียงลำดับ ? • เป็นการแสดงการทำงานตามลำดับของกิจกรรม • Control structure depicts logical order of program instructions p. 690 Fig. 13-28

  39. Step 2 — Design Solution Next • โครงสร้างการควบคุมแบบเลือก มี 2 ชนิด ? • Case control structure • If-then-else control structure—yields one of two possibilities: true or false p. 690 Fig. 13-29

  40. Step 2 — Design Solution Next • What is a case control structure? • มีการเลือกทางเป็นไปได้มากกว่า 3 ทาง p. 690 Fig. 13-30

  41. Step 2 — Design Solution Do-While Control Structure Next • What is a repetition control structure? • Do-while control structure—ตรวจสอบเงื่อนไขจนกระทั่งเป็นจริงแล้วจึงออกจากการวนรอบ p. 691 Figs. 13-31–13-32

  42. Do-Until Control Structure • Do-until control structure—ทำงานจนกระทั่งเงื่อนไขเป็นจริงจึงออกจากการวนรอบ

  43. Step 2 — Design Solution Next • What is aprogram flowchart? • เป็นภาพสัญักษณ์แสดงขั้นตอนในการแก้ปัญหา p. 692 Fig. 13-33

  44. Step 2 — Design Solution Next • What is an example of a flowchart? p. 692 Fig. 13-34

  45. Step 2 — Design Solution Next • What is pseudocode? • เป็นคำสั่งเทียมที่มีการเขียนขั้นตอนเหมือนกับภาษาอังกฤษ p. 694 Fig. 13-36

  46. 3. Coding the Program • เป็นการเปลี่ยนอัลกอริทึมที่ได้จากการวางแผนให้อยู่ในรูปของภาษาคอมพิวเตอร์ • ภาษาคอมพิวเตอร์ทั้งหมดจะมี syntax rules • เหมือนกับ grammatical rules • คอมพิวเตอร์จะไม่รับโปรแกรมที่เขียนผิดพลาด • Programs can be keyed into the computer by using a text editor

  47. 4. Testing the Program • Two phases of testing the program • Translation • Converting the program you wrote into the binary instructions the CPU understands (object codes) • Debugging • Identifying and correcting logic errors in the program

  48. 5.Documenting the Program • Materials are generated at each part of the process • Common examples of documentation • Flowchart and/or pseudocode • Comments within the source code • Testing procedures • Layouts of input and output records • A narrative description of the program

More Related