Thursday, April 04, 2013

ตัววัดในการเลือกข้อดีข้อเสียของโปรแกรมภาษา

ตัววัด
อ่านง่าย Readability
เขียนง่าย Writability
การทำงานตรวจสอบข้อผิดพลาด Reliability

Readability

"the most important criterium"
Factors:
Overall simplicity : พยายามทำอย่างไรก็ได้ให้ง่ายที่สุด
  • Too many teatures is bad
  • Multiplicity of features is bad e.g. increment an integer variable in c
  • Operator overloading makes confusion
Orthogonality : ความสามารถในการกำหนดรูปแบบที่ยืดหยุ่น หรือการทำ Oveloading ได้
  • Makes the language easy to learn and read
  • Meaning is context independent
  • e.g. pointer is able to point to any tpe of variable
  • Lack of orthogonality leads to exceptions to the rules of the languages
Factors:
Control statements
Poor readable control structure(e.g. using goto satement)
Data type and structures
Presence of adequate facilities for defining data types and ad structures in a language
e.g. Boolean type as indicator flag
Record(instead of Arrays)
Class(Abstract Data Type)
Systax considerations
  • Identifier forms(FORTRAN 77 allows six charaters at most)
  • Special words(Ada uses and if to terminate a selection control and end loop to terminate a loop construct->greater readability)

Writability
Simplicity and orthogonality : ง่ายสามารถทำ Overloading ได้
  • Misuse of some features static keyword in Java,c++
  • Unknown features usage causes bizarre results
  • Too much orthogonality may produce undetecte errors(any combination of primitive is legal) score = 14 /3 * 2;
Support for abstraction : รองรับการทำ Abstraction เช่นการซ่อนค่าต่าง ๆ โดยอ้างอิงรูปแบบของ Sub Program
  • Ability to define and use complicated structures or poerations regardless the details
  • e.g. using a sub program to implement a search,sort algorithm
Expressivity : การทำการเร็ว
  • e.g. count++ in C(Shorter and more convenient)
Type Checking
  • Earlier errors detection,less expensive repair
  • Compile-time Checking is preferred
Exception handling
  • The ability of a program to intercept run-time errors,take corrective measures,and then continue
  • e.g. Ada,C++ and Java
Aliasing
  • Having two or more distinct referencing methods,or names,for the same memory cell
  • e.g. Using reference in Java,pointer in C++
Language Evaluation Criteria:Others
Cost
- Categories
  • Programmer training(+simplicity+orthogonality+experience)
  • Software creation(cost of writing program -> reduced in good IDE)
  • Compilation(Fast)
  • Execution(Fast)
  • Compiler cost(For fee e.g. Java)
  • Poor reliability(e.g. Critical system like nuclear power plant or X-ray machine if fail -> high cost of demange)
  • Maintenance(corrections and modifications to add new capabilities)
Portability
  • The ease of migrating from one implementation to another
Generality
  • The applicability to a wide range of applications
Well-definedness
  • The completeness and precision of a language's official defining document

Language Categories
  1. Imperative
  • Central features are variables,expression,assignment statement and iterative form of repetetive