Re: Basic Explaination of OO in Ada



richard.charts@xxxxxxxxx writes:

I'm new to Ada, having to learn it for work, and I am beginning to
understand the language, I think.
However, coming from C (and family) and Java and other "modern"
languages, I can't seem to wrap my head around Ada's OO methods. Is it
that there is simply nothing like a class in C++ or Java?

Right. The things you can do are roughly the same, but they look rather
different.

In Ada, packages are all about visibility, encapsulation, information
hiding, and so forth. Tageged and class-wide types are all about type
extension and run-time polymorphism and so forth. C++ and Java combine
all these things into one language feature -- the "class" -- whereas Ada
splits them in two.

Another unusual thing about Ada is the split between "specific type",
which represents a particular point in the type heirarchy, and
"class-wide type", which represents a whole [sub]hierarchy.

As a learning exercise, I'm trying to convert a simple Python program
to Ada.
The basics of the program were that it took in data about a Person
object(or Student or Advisor) and stored it into array for
manipulation.
At first, I kept trying to convert almost line for line to Ada. But I
couldn't build the classes in the same way.
Is the correct way to think in Ada, that in a package, there is some
record "object" and also a number of subprograms that can interact
with/on that record?

Usually, for each abstraction, you have a package containing one main
type, along with primitive operations on that type.

- Bob
.



Relevant Pages

  • Re: Question about OO programming in Ada
    ... package, then you can use that type in the child packages. ... But note that, in Ada, a class is a set of types, whereas in C++ ... There is an alternative unique to the Ada language. ... Lists and Nodes ...
    (comp.lang.ada)
  • Re: Feasibility of using Ada in new development
    ... Ada is a great language, but you might want to check out Eiffel. ... Java programmers that compromise software quality. ... The GUI creation tool, GtkAda, was laughable as compared to something ...
    (comp.lang.ada)
  • Re: 71% Say Finding New Energy Sources More Important than Conservation
    ... Most of the drive to define was for a test programming language, because each tester had it's own language and the engineer would have to re-write the program every time the testor changed. ... The only reason it was used was because people saw that it would have a longer life time than ADA. ... My group at Stanford switched to Java as their language of choice after giving up on C++ as too flawed to use. ...
    (soc.retirement)
  • Re: Newbie Needs Ada Advice
    ... the "right" thing, and it seems to me like Ada is, in theory, a great ... text-to-whatever-type conversion when you read stuff from the GUI back ... "right" language to me for most of what my objectives are. ... Ada as the "engine" for my program, and somehow use Java to create the ...
    (comp.lang.ada)
  • Re: Newbie Needs Ada Advice
    ... the "right" thing, and it seems to me like Ada is, in theory, a great ... text-to-whatever-type conversion when you read stuff from the GUI back ... "right" language to me for most of what my objectives are. ... Ada as the "engine" for my program, and somehow use Java to create the ...
    (comp.lang.ada)