17.6.2003ada-europe’2003 ada as a language ehud lamm the open university of israel

21
17.6.2003 Ada-Europe’2003 Ada as a Language Ehud Lamm The Open University of Israel

Upload: spencer-jacobs

Post on 30-Dec-2015

214 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: 17.6.2003Ada-Europe’2003 Ada as a Language Ehud Lamm The Open University of Israel

17.6.2003 Ada-Europe’2003

Ada as a Language

Ehud Lamm

The Open University of Israel

Page 2: 17.6.2003Ada-Europe’2003 Ada as a Language Ehud Lamm The Open University of Israel

17.6.2003 Ada-Europe’2003

Context

• Current course: Software Engineering with Ada (Booch).

• Good, but perhaps not good enough.• Ada perceived as hindrance.• I examined several Java textbooks, and

discovered Lisokv’s Program Development in Java.

• What should be our next step?

Page 3: 17.6.2003Ada-Europe’2003 Ada as a Language Ehud Lamm The Open University of Israel

17.6.2003 Ada-Europe’2003

Why & How

• Undergraduate SE course (CS students)

• Classic Software Design– Traditional approach (imperative, OOP)

• “Essentials of Software Engineering”– Modularity, Reliability, Readability, Flexibility,

Software Life Cycle– University education

Page 4: 17.6.2003Ada-Europe’2003 Ada as a Language Ehud Lamm The Open University of Israel

17.6.2003 Ada-Europe’2003

Why & How

• Practical course

• Challenging design problems– Programming Should be Fun– Not just “getting it to work”– Students evaluate and re-evaluate their

designs.

• Make the language invisible

Page 5: 17.6.2003Ada-Europe’2003 Ada as a Language Ehud Lamm The Open University of Israel

17.6.2003 Ada-Europe’2003

• Interface/Implementation

• Adequacy

• Operation Categories

• Exceptions

• Pre/Post Conditions

• Invariants

Course Outline

• Data Abstraction– ADT/ADO

• Generic Units

• Inheritance

• Basic Tasking

• Flexibility

• Parameterization

• Separate Compilation

• Combining abstractions

• Runtime Polymorphism

• Heterogenic collections

• Classwide/Dispatching

• IS-A (LSP)

• Composition (HAS-A)

Page 6: 17.6.2003Ada-Europe’2003 Ada as a Language Ehud Lamm The Open University of Israel

17.6.2003 Ada-Europe’2003

Q1: Log file

Log Gen_Log

Event’Class

Filter’Class

Writer’Class Dual Buffering

Page 7: 17.6.2003Ada-Europe’2003 Ada as a Language Ehud Lamm The Open University of Israel

17.6.2003 Ada-Europe’2003

Priority Queue

Priority QueuePriority Queue

Priority is (<>)Priority is priv.with func “<“(..)

array of queues sorted linked list

Q2: Priority Queue

Page 8: 17.6.2003Ada-Europe’2003 Ada as a Language Ehud Lamm The Open University of Israel

17.6.2003 Ada-Europe’2003

generic

type Struct is lim. priv.

type Elem is priv.

with proc Insert

with proc Remove

package Any_Struct is

end;

Package Protect_Struct

protected type Struct

….

end;

Struct is new Any_Struct(<>)

Page 9: 17.6.2003Ada-Europe’2003 Ada as a Language Ehud Lamm The Open University of Israel

17.6.2003 Ada-Europe’2003

with pack Any_Iter(<>)function Max(S) …

begin

Start(S);

while More_Elements(S) loop

….

Next(S);

end loop;

End;

pack BST

--Binary_Search_Tree

func BST.Max..

Page 10: 17.6.2003Ada-Europe’2003 Ada as a Language Ehud Lamm The Open University of Israel

17.6.2003 Ada-Europe’2003

generic

type Item is priv.

package Sets is

type Set is abs. tagged null rec

end;

generic

with func “<“(I1,I2:Item);

package Sets.Sorted_List is

type Set is new Sets.Set with priv.

Page 11: 17.6.2003Ada-Europe’2003 Ada as a Language Ehud Lamm The Open University of Israel

17.6.2003 Ada-Europe’2003

Does the choice of programming language really matter?

Page 12: 17.6.2003Ada-Europe’2003 Ada as a Language Ehud Lamm The Open University of Israel

17.6.2003 Ada-Europe’2003

No

but...

Page 13: 17.6.2003Ada-Europe’2003 Ada as a Language Ehud Lamm The Open University of Israel

17.6.2003 Ada-Europe’2003

In theory, there’s no difference between theory and practice; In

practice, there is.

Page 14: 17.6.2003Ada-Europe’2003 Ada as a Language Ehud Lamm The Open University of Israel

17.6.2003 Ada-Europe’2003

‘Ideal’ Language

• Rich type system• Information hiding

– Explicit interfaces– Value semantics

• Genericity • Inheritance• Garbage collection• Design by Contract• First-class functions• Rich libraries, variety of

tools

Ada Java

Page 15: 17.6.2003Ada-Europe’2003 Ada as a Language Ehud Lamm The Open University of Israel

17.6.2003 Ada-Europe’2003

Language Community

• Libraries

• Reusable code

• Tools (e.g., VS IDEs, diagramming, DbC, etc.)

• Tutorials/textbooks

• etc.

Page 16: 17.6.2003Ada-Europe’2003 Ada as a Language Ehud Lamm The Open University of Israel

17.6.2003 Ada-Europe’2003

Problematic features (Ada)(in my experience)

• Many kinds of Interfaces

• Access to subprograms (accessibility)

• Controlled (vs. other approaches to destructors/constructors)

• Controlled & Generics

• Controlling child visibility

• Verbosity (exercises take too much time)

Page 17: 17.6.2003Ada-Europe’2003 Ada as a Language Ehud Lamm The Open University of Israel

17.6.2003 Ada-Europe’2003

Problematic features (Java)

• Conjecture. Let me know what you think.

• The type system

• Reference semantics

• Low level concurrency

• Generics are coming..

Page 18: 17.6.2003Ada-Europe’2003 Ada as a Language Ehud Lamm The Open University of Israel

17.6.2003 Ada-Europe’2003

The textbooks

• A language can’t survive without good textbook, for all levels and needs.

• Liskov’s book is much more suited for an academic SE course.

Page 19: 17.6.2003Ada-Europe’2003 Ada as a Language Ehud Lamm The Open University of Israel

17.6.2003 Ada-Europe’2003

Conclusions

• Ada is still a strong candidate for a teaching language for SE

• Most of the technical problems can be solved rather easily.

• Better error messages should help with the remaining issues.

• The language isn’t the problem: Good News and Bad News

• Community and Cultural roadblocks

Page 20: 17.6.2003Ada-Europe’2003 Ada as a Language Ehud Lamm The Open University of Israel

17.6.2003 Ada-Europe’2003

Conclusions

• Can we and should we try to change the way Ada is perceived in universities?

• How?– Evangelism– Textbooks– GNAT– etc.

Page 21: 17.6.2003Ada-Europe’2003 Ada as a Language Ehud Lamm The Open University of Israel

17.6.2003 Ada-Europe’2003

Thank You

Any Questions?