SlideShare a Scribd company logo
1 of 22
Language Evaluation Criteria
1. Readability – easily understood?
2. Writability – easy to write?
3. Simplicity, orthogonality
4. High expressive power, flexibility
5. Reliability
6. Safety
7. Cost (influenced by above)
– Creation
– Execution
– Maintenance
Cost of Software
• Total cost - due to many language factors:
– Training programmers (time)
– Developing software and environment (ease of use, time)
– Compiling programs (time, space)
– Executing programs (time, space)
– Language implementation system (interpreter, compiler)
– Reliability (failures per time unit)
– Maintenance (time to fix bugs, keep current with new
hardware/software)
– Extensibility/need for modification (ease, time)
Costs over the Software Lifecycle
(Generic model)
1. Requirements
2. Specifications
3. Design
4. Module coding
5. Module testing
6. Module Integration
7. Maintenance
8. Retirement
Relative Cost of 25
Each Phase of Software Development
• Maintenance constitutes 67% of total cost From: Software
Engineering
Specification
(analysis)
5%
Requirements
2%
Desine
6%
Module
coding
5%
Module
Testing
7%
Integration
8%
Maintenance
67%
Cost to Fix a Fault vs. Development Phase
Readability
• Code easy/fast - to read and understand
• Language factors that affect readability
1. Overall language simplicity
2. Orthogonality
3. Control statements built-in
4. Data types & structures built-in
5. Syntax considerations – closeness to natural
language and/or mathematics
Writability – Ease of Writing Programs
• Ease/speed - to create programs solving
problems in a specific problem domain
• Language factors that affect writability
1. Simplicity and orthogonality
2. Support for abstraction
3. Expressive power
4. Development/Computer Aided Software
Engineering (CASE) environments
• Cryptic vs. wordy syntax
Simplicity Improves Read/Writability
• A large language takes more time to learn
– Programmers might learn only a subset
• Feature multiplicity (having more than one way to perform
a particular operation) is often confusing
– For example, in C++ or Java you can decrement a variable in four
different ways: x = x – 1; x -= 1; x--; --x
• Operator overloading (a single operator symbol has more
than one meaning) can lead to confusion
• Some languages (e.g. assembly languages), can be "too
simple" – too low level. 2, 3, 4, 5 or more statements
needed to have the effect of 1 statement in a high-level
language
Orthogonality
• In geometry, orthogonal means "involving right
angles"
• In general use, it means being independent, non-
redundant, non-overlapping, or not related
• In computer languages, it means a construct can
be used without consideration as to how its use
will affect something else
• A programming language is considered
orthogonal if its features can be used without
thinking about how their use will affect other
features, e.g. objects and arrays
Orthogonality Improves Read/Writability
• Having fewer constructs and having few exceptions increases
readability and writability
• Orthogonal languages are easier to learn
• Examples:
– Pointers should be able to point to any type of variable or data
structure
• Exceptions (e.g. in C) are due to a lack of orthogonality
– ADD op1 op2 􀃆 op1 vs.:
– ADDR Reg1 Reg2 􀃆 Reg1 and
– ADDRM Reg1 MemA 􀃆 Reg1
– A different ADD operation depending on operand location in memory!
• However, if a language is too orthogonal, an inexperienced
programmer might assume they can do something that makes no
sense,
– e.g. add two pointers together
Structured Control Improves Read/Writability
• goto statements were replaced by structured
programming in the 1970s
• Can be read from top to bottom
– Most languages now contain sufficient control
statements making goto’s unnecessary
• The following are equivalent
if (x < y) x++; if (x < y) goto L1;
else y++; y++;
goto L2;
L1: x++;
L2:
Concise Data Structures/Types
Improve Read/Writability
• Adequate data types and data structures also
aid readability
• A language with Boolean types is easier to
read than one without
– indicatorFlag = 0
is more difficult to read than
– indicatorFlag = false
Syntax and Read/Write-ability
• Syntax - the way linguistic elements (e.g. words) are
put together to form phrases or clauses/sentences
• Identifier forms
– If too short, reduces readability
• Special word use
– Ada has end if and end loop, while Java uses } for
both
– In Fortran 95, Do and End can also be variable names
• Form and meaning
– In C, static changes meaning depending on position
Abstraction
• The ability to define and then use complex structures
or operations
– Allows details to be ignored
– Allows code to be re-used instead of repeated
– Example: A binary tree in Fortran 77 required arrays, while
in OO languages, nodes with pointers may be used
1. Abstract data types
– implementation details are separated from the interface,
allowing them to be changed without re-writing all code
2. Objects
3. Subprograms
Abstraction Increases Expressivity
• Expressive language - has powerful built-in primitives
for high-level abstractions
• For example, in Lisp
– Pointer manipulation is implicit – avoid mistakes
– Mapcar – apply a function to every element of a list (and
return the corresponding results in a list)
• No need to write the iteration yourself – you would need to write
a different function for each different type of data
• Infinite precision integers and rational numbers
– No need to develop functions yourself
– Completely avoid round-off errors at will
• E.g. 2/3 + 1/3 = 1, not .999999
Reliability
• A reliable program performs to its
specifications under all conditions
• Factors that affect reliability
1. Type checking
2. Exception handling
3. Aliasing
4. Readability and writability
5. Environmental factors – real-time or safety-
critical application?
Type Checking and Exception Handling
Improve Reliability
• Type checking
– Testing for type errors in a given program
• For example, if a function is expecting an integer
receives a float instead
• Exception handling
– Used in Ada, C++, Lisp and Java, but not in C and
Fortran
• E.g. the try and catch blocks of C++ can catch runtime
errors, fix the problem, and then continue the program
without an “abnormal end”
Aliasing Reduces Readability
and Reliability
• Aliasing
– Referencing the same memory cell with more than
one name
• E.g., in C, both x and y can be used to refer to the same
memory cell
int x = 5;
int *y = &x;
– Leads to errors
• Reliability increases with better read/writability
– If a program is difficult to read or write, its easier to
make mistakes and more difficult to find them
Language Design Trade-offs
• Reliability and cost – costs more to ensure
greater reliability
– Example – type checking
• In C, the index ranges of arrays are not checked
• So executes fast, but it not so reliable
• On the other hand, Java checks all references to array
elements
• Java executes slower, but is more reliable
Lecture Questions
• What are 5 criteria used to evaluate
languages?
1.
2.
3.
4.
5.
Lecture Questions (cont.)
• How do think each of these affect software
cost?
– Readability
– Writability
– Reliability
– Expressive Power
Form and Meaning of Code
• Syntax of a language defines the legal
statements that can be written – how it looks
• Semantics of a language defines how the
statements are executed – the results that are
produced when the program runs

More Related Content

Similar to 1.2 Evaluation of PLs.ppt

Programming Languages Categories / Programming Paradigm By: Prof. Lili Saghafi
Programming Languages Categories / Programming Paradigm By: Prof. Lili Saghafi Programming Languages Categories / Programming Paradigm By: Prof. Lili Saghafi
Programming Languages Categories / Programming Paradigm By: Prof. Lili Saghafi Professor Lili Saghafi
 
Ch1 language design issue
Ch1 language design issueCh1 language design issue
Ch1 language design issueJigisha Pandya
 
Reading Notes : the practice of programming
Reading Notes : the practice of programmingReading Notes : the practice of programming
Reading Notes : the practice of programmingJuggernaut Liu
 
PL Lecture 01 - preliminaries
PL Lecture 01 - preliminariesPL Lecture 01 - preliminaries
PL Lecture 01 - preliminariesSchwannden Kuo
 
Desired language characteristics – Data typing .pptx
Desired language characteristics – Data typing .pptxDesired language characteristics – Data typing .pptx
Desired language characteristics – Data typing .pptx4132lenin6497ram
 
Unit 1_Evaluation Criteria_session 3.pptx
Unit 1_Evaluation Criteria_session 3.pptxUnit 1_Evaluation Criteria_session 3.pptx
Unit 1_Evaluation Criteria_session 3.pptxAsst.prof M.Gokilavani
 
0-IntroductionToDSA.ppt
0-IntroductionToDSA.ppt0-IntroductionToDSA.ppt
0-IntroductionToDSA.pptTrnHuy921814
 
Unit 1_Evaluation Criteria_session 2.pptx
Unit 1_Evaluation Criteria_session 2.pptxUnit 1_Evaluation Criteria_session 2.pptx
Unit 1_Evaluation Criteria_session 2.pptxAsst.prof M.Gokilavani
 
APP_All Five Unit PPT_NOTES.pptx
APP_All Five Unit PPT_NOTES.pptxAPP_All Five Unit PPT_NOTES.pptx
APP_All Five Unit PPT_NOTES.pptxHaniyaMumtaj1
 
Pl9ch1
Pl9ch1Pl9ch1
Pl9ch1Ved Ed
 
Programming language design and implemenation
Programming language design and implemenationProgramming language design and implemenation
Programming language design and implemenationAshwini Awatare
 
Software_engineering.pptx
Software_engineering.pptxSoftware_engineering.pptx
Software_engineering.pptxjohn6938
 
Computer programing 111 lecture 3
Computer programing 111 lecture 3Computer programing 111 lecture 3
Computer programing 111 lecture 3ITNet
 

Similar to 1.2 Evaluation of PLs.ppt (20)

Programming Languages Categories / Programming Paradigm By: Prof. Lili Saghafi
Programming Languages Categories / Programming Paradigm By: Prof. Lili Saghafi Programming Languages Categories / Programming Paradigm By: Prof. Lili Saghafi
Programming Languages Categories / Programming Paradigm By: Prof. Lili Saghafi
 
Ch1 language design issue
Ch1 language design issueCh1 language design issue
Ch1 language design issue
 
Reading Notes : the practice of programming
Reading Notes : the practice of programmingReading Notes : the practice of programming
Reading Notes : the practice of programming
 
PL Lecture 01 - preliminaries
PL Lecture 01 - preliminariesPL Lecture 01 - preliminaries
PL Lecture 01 - preliminaries
 
Unit 2.pptx
Unit 2.pptxUnit 2.pptx
Unit 2.pptx
 
Unit 2.pptx
Unit 2.pptxUnit 2.pptx
Unit 2.pptx
 
Desired language characteristics – Data typing .pptx
Desired language characteristics – Data typing .pptxDesired language characteristics – Data typing .pptx
Desired language characteristics – Data typing .pptx
 
What you should know before starting to learn programming?
What you should know before starting to learn programming?What you should know before starting to learn programming?
What you should know before starting to learn programming?
 
Unit 1_Evaluation Criteria_session 3.pptx
Unit 1_Evaluation Criteria_session 3.pptxUnit 1_Evaluation Criteria_session 3.pptx
Unit 1_Evaluation Criteria_session 3.pptx
 
0-IntroductionToDSA.ppt
0-IntroductionToDSA.ppt0-IntroductionToDSA.ppt
0-IntroductionToDSA.ppt
 
Unit 1_Evaluation Criteria_session 2.pptx
Unit 1_Evaluation Criteria_session 2.pptxUnit 1_Evaluation Criteria_session 2.pptx
Unit 1_Evaluation Criteria_session 2.pptx
 
APP_All Five Unit PPT_NOTES.pptx
APP_All Five Unit PPT_NOTES.pptxAPP_All Five Unit PPT_NOTES.pptx
APP_All Five Unit PPT_NOTES.pptx
 
C++ publish copy
C++ publish   copyC++ publish   copy
C++ publish copy
 
Pl9ch1
Pl9ch1Pl9ch1
Pl9ch1
 
Unit 1
Unit 1Unit 1
Unit 1
 
Programming language design and implemenation
Programming language design and implemenationProgramming language design and implemenation
Programming language design and implemenation
 
Metamorphic Domain-Specific Languages
Metamorphic Domain-Specific LanguagesMetamorphic Domain-Specific Languages
Metamorphic Domain-Specific Languages
 
Software_engineering.pptx
Software_engineering.pptxSoftware_engineering.pptx
Software_engineering.pptx
 
Cp 111 lecture 3
Cp 111 lecture 3Cp 111 lecture 3
Cp 111 lecture 3
 
Computer programing 111 lecture 3
Computer programing 111 lecture 3Computer programing 111 lecture 3
Computer programing 111 lecture 3
 

Recently uploaded

08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfhans926745
 
Evaluating the top large language models.pdf
Evaluating the top large language models.pdfEvaluating the top large language models.pdf
Evaluating the top large language models.pdfChristopherTHyatt
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?Antenna Manufacturer Coco
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 

Recently uploaded (20)

08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
Evaluating the top large language models.pdf
Evaluating the top large language models.pdfEvaluating the top large language models.pdf
Evaluating the top large language models.pdf
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 

1.2 Evaluation of PLs.ppt

  • 1. Language Evaluation Criteria 1. Readability – easily understood? 2. Writability – easy to write? 3. Simplicity, orthogonality 4. High expressive power, flexibility 5. Reliability 6. Safety 7. Cost (influenced by above) – Creation – Execution – Maintenance
  • 2. Cost of Software • Total cost - due to many language factors: – Training programmers (time) – Developing software and environment (ease of use, time) – Compiling programs (time, space) – Executing programs (time, space) – Language implementation system (interpreter, compiler) – Reliability (failures per time unit) – Maintenance (time to fix bugs, keep current with new hardware/software) – Extensibility/need for modification (ease, time)
  • 3. Costs over the Software Lifecycle (Generic model) 1. Requirements 2. Specifications 3. Design 4. Module coding 5. Module testing 6. Module Integration 7. Maintenance 8. Retirement
  • 4. Relative Cost of 25 Each Phase of Software Development • Maintenance constitutes 67% of total cost From: Software Engineering Specification (analysis) 5% Requirements 2% Desine 6% Module coding 5% Module Testing 7% Integration 8% Maintenance 67%
  • 5. Cost to Fix a Fault vs. Development Phase
  • 6. Readability • Code easy/fast - to read and understand • Language factors that affect readability 1. Overall language simplicity 2. Orthogonality 3. Control statements built-in 4. Data types & structures built-in 5. Syntax considerations – closeness to natural language and/or mathematics
  • 7. Writability – Ease of Writing Programs • Ease/speed - to create programs solving problems in a specific problem domain • Language factors that affect writability 1. Simplicity and orthogonality 2. Support for abstraction 3. Expressive power 4. Development/Computer Aided Software Engineering (CASE) environments • Cryptic vs. wordy syntax
  • 8. Simplicity Improves Read/Writability • A large language takes more time to learn – Programmers might learn only a subset • Feature multiplicity (having more than one way to perform a particular operation) is often confusing – For example, in C++ or Java you can decrement a variable in four different ways: x = x – 1; x -= 1; x--; --x • Operator overloading (a single operator symbol has more than one meaning) can lead to confusion • Some languages (e.g. assembly languages), can be "too simple" – too low level. 2, 3, 4, 5 or more statements needed to have the effect of 1 statement in a high-level language
  • 9. Orthogonality • In geometry, orthogonal means "involving right angles" • In general use, it means being independent, non- redundant, non-overlapping, or not related • In computer languages, it means a construct can be used without consideration as to how its use will affect something else • A programming language is considered orthogonal if its features can be used without thinking about how their use will affect other features, e.g. objects and arrays
  • 10. Orthogonality Improves Read/Writability • Having fewer constructs and having few exceptions increases readability and writability • Orthogonal languages are easier to learn • Examples: – Pointers should be able to point to any type of variable or data structure • Exceptions (e.g. in C) are due to a lack of orthogonality – ADD op1 op2 􀃆 op1 vs.: – ADDR Reg1 Reg2 􀃆 Reg1 and – ADDRM Reg1 MemA 􀃆 Reg1 – A different ADD operation depending on operand location in memory! • However, if a language is too orthogonal, an inexperienced programmer might assume they can do something that makes no sense, – e.g. add two pointers together
  • 11. Structured Control Improves Read/Writability • goto statements were replaced by structured programming in the 1970s • Can be read from top to bottom – Most languages now contain sufficient control statements making goto’s unnecessary • The following are equivalent if (x < y) x++; if (x < y) goto L1; else y++; y++; goto L2; L1: x++; L2:
  • 12. Concise Data Structures/Types Improve Read/Writability • Adequate data types and data structures also aid readability • A language with Boolean types is easier to read than one without – indicatorFlag = 0 is more difficult to read than – indicatorFlag = false
  • 13. Syntax and Read/Write-ability • Syntax - the way linguistic elements (e.g. words) are put together to form phrases or clauses/sentences • Identifier forms – If too short, reduces readability • Special word use – Ada has end if and end loop, while Java uses } for both – In Fortran 95, Do and End can also be variable names • Form and meaning – In C, static changes meaning depending on position
  • 14. Abstraction • The ability to define and then use complex structures or operations – Allows details to be ignored – Allows code to be re-used instead of repeated – Example: A binary tree in Fortran 77 required arrays, while in OO languages, nodes with pointers may be used 1. Abstract data types – implementation details are separated from the interface, allowing them to be changed without re-writing all code 2. Objects 3. Subprograms
  • 15. Abstraction Increases Expressivity • Expressive language - has powerful built-in primitives for high-level abstractions • For example, in Lisp – Pointer manipulation is implicit – avoid mistakes – Mapcar – apply a function to every element of a list (and return the corresponding results in a list) • No need to write the iteration yourself – you would need to write a different function for each different type of data • Infinite precision integers and rational numbers – No need to develop functions yourself – Completely avoid round-off errors at will • E.g. 2/3 + 1/3 = 1, not .999999
  • 16. Reliability • A reliable program performs to its specifications under all conditions • Factors that affect reliability 1. Type checking 2. Exception handling 3. Aliasing 4. Readability and writability 5. Environmental factors – real-time or safety- critical application?
  • 17. Type Checking and Exception Handling Improve Reliability • Type checking – Testing for type errors in a given program • For example, if a function is expecting an integer receives a float instead • Exception handling – Used in Ada, C++, Lisp and Java, but not in C and Fortran • E.g. the try and catch blocks of C++ can catch runtime errors, fix the problem, and then continue the program without an “abnormal end”
  • 18. Aliasing Reduces Readability and Reliability • Aliasing – Referencing the same memory cell with more than one name • E.g., in C, both x and y can be used to refer to the same memory cell int x = 5; int *y = &x; – Leads to errors • Reliability increases with better read/writability – If a program is difficult to read or write, its easier to make mistakes and more difficult to find them
  • 19. Language Design Trade-offs • Reliability and cost – costs more to ensure greater reliability – Example – type checking • In C, the index ranges of arrays are not checked • So executes fast, but it not so reliable • On the other hand, Java checks all references to array elements • Java executes slower, but is more reliable
  • 20. Lecture Questions • What are 5 criteria used to evaluate languages? 1. 2. 3. 4. 5.
  • 21. Lecture Questions (cont.) • How do think each of these affect software cost? – Readability – Writability – Reliability – Expressive Power
  • 22. Form and Meaning of Code • Syntax of a language defines the legal statements that can be written – how it looks • Semantics of a language defines how the statements are executed – the results that are produced when the program runs