Object Oriented Programming - help required to find training material
Hi,
I am working in ABAP for 4 years. I did not get any chance to work in OOPs concept.
However I know how to create classes,methods and how to access methods and attributes of class inside the report program and I hope apart from these we are having many things to learn OOPs ABAP.
Can anyone help me to find OOPs training materials with examples?
Thanks
Hi Colleen,
This is to inform you that, I am not expecting SCN or anyone to spoon feed me. I believe in IT industry Spoon feeding is not going to help in long time to survive. I am also using google,scn,sap technical.com and so many sites for my queries and learning.Please remember I am working in IT for long. Why should I expect people to spoon feed me.
I have posted this question, because already many people might have searched and got some good and best articles with examples. So by believing that I will get good articles from the experts I have posted, but not for spoon feeding.
I agree that whatever you have pointed in this post are good suggestion, but please before answering to such issues, please think in which situation they are seeking other's help.
Everyone's time is very precious. So I will not waste anyone's time and I will not waste my time too. I am not here to raise any concern on anyone. I just needed some help and got from the experts too.
Instead of making this discussion to grow further, kindly close this here itself or remove this thread. I did not expect such sort of communication for asking the best training material for learning OOPs ABAP.
Thanks
Similar Messages
-
Object oriented programming help
i am learning OOP in java, and there is one hurtle that i cant jump: lets say that you write a class called CellPhoneBill, and you write another class called CellBill that instantiates the CellPhoneBill objects. and lets say that in the CellPhoneBill class, i have 3 methods: WeekendNightMinsUsed, PeakMinUsed, and TotalBill; the WeekendNightMinsUsed method is to come up with a double x, but not necessarily return it (print it out); the PeakMInsUsed method is to come up with a double y, but not necessarily return it; and the TotalBill method is to use the if/then and boolean to compare the end result of the WeekendNightMinsUsed method (x), the end result of the PeakMInsUsed method (y), and depending on the outcome, prints out a string; the problem is that the TotalBill method doesnt recognize the x and y; why is that, and what can i do about it? PS., i know its not my code, because i have tried numerous ways to write it, but to no avail; please help.
at the end of WeekendNightMInsUsed and PeakMinsUsed,
i put return x/y at the end; in TotalBill, i write
'if x = blablabla && y = boablabla'; it stilll
doesnt recognize it.You can't just declare a variable in one method and expect to use it in another. This was already explained above. If you don't understand the explanation given, say so. Don't just keep asking the same question over and over. -
Article: Object-flow Programming - Merging Dataflow and Object-Oriented Programming
I just posted an ExpressionFlow article:
Object-flow Programming - Merging Dataflow and Object-Oriented Programming
I guess you may find it interesting. If you like it, you should
bookmark it with one of the social bookmarking tools (click the
bookmark link next to the timeline image in the article). That may help
us to get readers and comments from outside the LabVIEW community. And
don't hesitate to participate the discussion. I'd love to hear you
comments on the subject.
Tomi
Tomi MailaAfter having problems with spam block software malfunction, I was able recover the following comments to the EXPRESSIONFLOW article Object-flow Programming - Merging Dataflow and Object-Oriented Programming
Written by Zen:
Some combination of data-flow and object-oriented programming, I think,
could make a great impact on sysytem development. However, I see it in
slightly different way than yours....
Written by Matt Holt:
I don't believe NI can get object-flow programming to move far enough
into mainstream that Forbes would cover it. NI has a bit of a
stranglehold on LabVIEW with it's price as compared to say… VS2005. It
seems that by promoting it as "easy to use" that NI may have shot
itself in the foot….
Written by Jim Kring:
Hi Tomi, In my opinion, LabVIEW's native object-oriented programming
capabilities (LabVOOP) do not currently provide a complete tool for
allowing us to implement our OOP system designs. Nearly all of my
system designs require distributed active objects by reference. I think
that National Instruments certainly can evolve LabVIEW to address such
requirements, but I think that it is not a real focus of NI....
If anybody else is missing their comments, I'm sorry I was unable to recover them. Please repost your comments, I appology for the inconvenience.
Tomi Maila -
I'm working on a code associated with object-oriented programming:
The StreetAddress class has this constructor:
StreetAddress( String street, String city,
String state, String zip );
and the following methods:
void SetStreet( String street ); and String GetStreet();
void SetCity( String city); and String GetCity();
void SetState( String state ); and String GetState();
void SetZIP( String zip ); and String GetZIP();
String MailingLabel();.
The last of these returns the mailing address in the following form:
street
city, state zipand this is what i have so far:
public class StretAddress
private String myStreet;
private String myCity;
private String myState;
private String myZip;
public StreetAddress( String street, String city, String state, String zip)
myStreet = street;
myCity = city;
myState = state;
myZip = zip;
public String getStreet()
return myStreet;
public void SetStreet( String street )
myStreet = street;
public String getCity()
return myCity;
public void SetCity( String city )
myCiy = city;
public String getState()
return myState;
public void SetState( String state )
myState = state;
public String getZip()
return myZip;
public void SetZip( String zip )
myZip = zip;
public String MailingLabel()
System.out.println(street \n city, state + " " + zip);
}I have no idea what to do now, can someone please help me with this?ejp wrote:
personally, i don't think you need all four in order to be object-oriented.Without all four it might be class-based, or object-based, but not object-oriented. See Peter Wegner's paper which defined all this in 1987:
http://www.cse.msu.edu/~stire/cse891f04/wegner.pdf
With all due respect, I find this "definition" more meaningful:
http://www.youtube.com/watch?v=bfx7tvGisbA -
Concept of object oriented programming
does anyone have notes on concepts of object oriented programming language (Encapsulation,polymorphism,messages,class,inheritance and all that) i tried to find them but i only got definitions for them but i want advantages and disadvantages of concepts also plz can anyone help me
You want the advantages/disadvantages.. hard to find... i got some notes on OO concepts.. u want? Please send me a email to [email protected].. will post it on geocities with the link once u send me the email
-
Java is a Partially Object-Oriented Programming (True/False)
Hi everybody,
Many of them saying that Java is not purely Object-Oriented Programming.
I am very much confusing on that, so please help me to confirm that "Java is a Partially Object-Oriented Programming Language".JAVA_NV wrote:
gopivista wrote:
Hi everybody,
Many of them saying that Java is not purely Object-Oriented Programming.
I am very much confusing on that, so please help me to confirm that "Java is a Partially Object-Oriented Programming Language".Java is not purely Object-Oriented Programming,for this two reasons are there
one is we cant create Objects to the primitive data types and there is no multiple Inheritance concept .While there are many definitions of "purely object oriented," and no on widely accepted standard, I've never heard one that requires multiple inheritance. That would NOT be a reason why Java is not fully OO. -
Table Control in Object oriented programing
Hi ,
All of our programs are converted into OO Programing, i have a requirement that can we have an alternative for Table Control in Object oriented programing ?
can we have any base class for Table Control to display the data in the grid ?
For Ex: we can place a ALVA Tree on the container , For this the base class is CL_GUI_ALVA_TREE, like the same way can we have any alternative,
If i am not wrong is it possible by ALV grid Control.. can any body help me the out
of this confusion.
Thansk In Advance.
Regards
NagThanks for this, it is very help full. If you don't mind is there any demo program which is already given by SAP, or if you have please send me the code so that
i can start looking on it .
thanks In Advance.
Regards
Nag -
How to avoid the case of leaks memory in Object Oriented Programming
Hi, Everyone, I am writing a simple web-baed application for JSP and Servlet, I pass all data from JSP to Servlet, It is due to the number of row of record are variable, so I should write a Java Instance class to stored to specific data in a Java Object, and then stored those object in a arraylist In the Servlet class, and then pass the arraylist in to a session, to pass the session from the servlet to another JSP......
But some thing I am worried about is that if the no of row of record user input is large, then the number of object stored in the arraylist will also large. I am worried it will serious leaks memoary in my server. Because my server always occurs "Out Of Memoary Exception" in Tomcat, So If I use the above method. I affarid the memory will be further leaking in my server. So What can I do? Is it having any better method to prevent memory leaking when using Object Oriented Programming(Except using Hibernate)?
Can Anyone be help me?
Thank you very much for All, THXBecause many people say that the large amount of
using Object will lead to "memory leak", I am worried
about the size of object I use is too large and then
it will construct "memory leak". No it will not! You get a 'memory leak' by holding references to objects you no longer require.
>
The detail of my case is that:
In my web application, there is a session variable
pass through from one servlet to another jsp/servlet.You should only place small amounts of data in the session. If you need forward from a Servlet to a JSP (or JSP to Servlet) then you should place the data object in the request (using the setAttribute() method), not in the session. In this way, when the session is re-claimed so will be the data object.
And this session variable is stored a Instance Object
(which is a class write by me) with the following
issue:
1) This instance object having "has-a relationship"
with another four instance object (all are the
classes write by me)
2) This instance object having "has relationship"
with a arraylist, this arraylist is stored about 4-5
instance object(all are the classes write by me) .
If this object having the above issue, Will this
object construct a "leaks memory" when this object
stored in the session and pass through servlet to
another jsp/servlet?
Message was edited by:
sabre150 -
Object-oriented programming: state and behaivor
First of all, sorry for my level english.
In Object-Oriented programming, should an object save always some state?
What about session stateless bean service? What is the sense?
These objects have only behaivour and not state.
Perhaps, the sense is that you can send a message to this object, in oposite of a static methods in utility class?
Thanks and regards.I suppose you could argue that if it doesn't have any state, then it's not really an "object" in the OOP sense, but who cares, really.
Personally, I use state and behavior as a way to help clarify the responsibilities of various classes in the system, and if I see a codebase with a lot of objects with state but no behavior or behavior but no state, then it's a a red flag that it's a messy, poorly-thought-out design (and it usually turns out to be exactly that). The whole point of OOP (IMHO) is encapsulation, and bundling state and behavior together makes things encapsulated (you can prove that state changes only in certain areas in certain circumstances). Encapsulation makes for more easily maintainable code.
It's easy to spot the blue squares in a Mondrian. It's difficult to spot the blue bits in a Pollock. The former is well-encapsulated OOP and the latter is poorly-encapsulated spaghetti code.
That said, it's not the end of the world if you have a static utility class here and there. -
Object oriented programming in LabVIEW
Please send this message to everybody who has an opinion about this.
Please try to keep it short, but if you can't control yourselves, let
it all out!
I would like to have your opinions about the nature of Labview and it's
ability to support object oriented programming.
I have a couple of questions to fire the discussion.
1- Do you think that LV was built to support OO Programming?
2- Is OO the only way we have to support large applications, or is it
feasible to support it with a good dataflow architecture including all
the flowcharts and all the data definitions?
3- Is LV going to stay "dataflow" or is it going to become OO?
4- What would be the great benefits of turning LV to OO that we don't
already have w
ith the dataflow approach?
5- My opinion is that trying to implement OO in LabVIEW, is like trying
to
Thank you all for your time.
Sent via Deja.com
http://www.deja.com/> 1- Do you think that LV was built to support OO Programming?
LV was initially designed in 1983. OOP existed at that point,
but LV wasn't designed to be OO. It was designed to allow
engineers and researchers a simple language appropriate
for controlling their research labs from a computer.
> 2- Is OO the only way we have to support large applications, or is it
> feasible to support it with a good dataflow architecture including all
> the flowcharts and all the data definitions?
OO lends itself to large projects because it provides
abstraction, encapsulation, and organizes code into
modules that can more easily be implemented independent
of one another since they can be specified in finer
detail. Also, the compilers help to enforce the
specifications providing they can be encoded in the
interface between objects.
These OO principles were already a part of big projects
long before there were OO languages. It was just that
the language didn't necessarily have features which
supported it. Similarly, they can be a part of big
projects today despite the language being used.
LV 2 style globals, which as the name suggests were
in use long ago, encapsulate data with an interface.
They disallow arbitrary access to the data and can be
used to enforce correct access. With other functions
layered on top, you get a nice interface to stored data.
Functions and structs/clusters abstract away details.
Building a subVI that does an FFT means that for 99%
of the uses, you don't need any more information except
that this block performs an abstract mathematical function,
an FFT. The implementation can be completely changed
to speed it up or make it more accurate and your code
isn't affected. Its abstract definition still holds, so
your code still works.
There are other things that OO languages bring to the
table that LV, and GOOP don't yet offer. In my opinion,
a few more OO features can be added to LV to allow for
even larger projects in the future provided they are used
well.
Earlier posts pointed out that C++ doesn't guarantee that
a project will succeed. OO features are just another tool,
and the tool can be misused leading to a failed project.
This is true to LV, C, C++, and all other engineering tools.
The key is using the tools at hand to best solve the
problems we face. Not glorifying or blaming the tools for
the state of the project.
> 3- Is LV going to stay "dataflow" or is it going to become OO?
LV is dataflow to the core. The definition of what data
is flowing may be expanded, but it will still be data
flowing down wires from one node to another that accounts
for how the program executes.
One of the limitations of the current GOOP is that all
objects are dealt with by a reference. By adding
language features, objects could be made to flow down
the wire, just like strings and arrays, meaning that
branching a wire doesn't lead to side-effects,
and there is no need to dispose objects.
> 4- What would be the great benefits of turning LV to OO that we don't
> already have with the dataflow approach?
Remember when LV didn't have typedefs? It was easy for
a cluster datatype to change once a project was underway.
That usually led to lots of edits on other panels to get
them back in synch. Without the unbundle by name, you
then went through the diagrams fixing all of the bundlers
and unbundlers to have the right number of terminals.
Changing the order of the cluster was even worse since
the diagrams may not bread, they might just access the
wrong field instead.
In many respects, an object is just another step along the
same path. An object is a typedef that can have code
associated with it for access -- maybe like Array and
Cluster Tools. Some of the typedef contents might be
publicly accessable, like now, while other elements are
hidden, only available to the implementation of the
typedef. That would force the user to use your functions
to manipulate things rather than hacking away at the
typedef contents. As an example, a LV string is really
just a cluster of size and characters. Since the diagram
can only modify the string using the string functions, you
never get the size and characters out of synch. That is
until you take it into LV generated code, a DLL or CIN
where you have access to the inner fields.
A related problem is that current typedefs are transparent
to built-in LV functions. If your typedef is just some
numbers, LV will be happy to perform arithmetic on your
typedef. Maybe this is what you want, but if this doesn't
make sense on your typedef, then your left with adding a
Boolean or a string so that the arithmetic isn't allowed.
Ideally, you would be able to state that = makes sense, >
and < don't, + and - only operates on the first numeric, and
* is something that you implement yourself. There would be
some safeguards so that the user of your typedef, which
includes you, wouldn't accidentally mangle the typedef
contents.
These may not seem like much at first, but they allow for
much more abstraction and better encapsulation. Finally,
there is a technique called inheritance that allows for
similar objects to be acted on by common code in one
location, and by specific code in another location depending
on which type of object is actually there at runtime.
This of usually done today by switching out on some inner
tag and dealing with each type in its own diagram. This
works fine until projects get large and teams get large.
Inheritance is a different way of implementing the exact
same thing that usually works much better for bigger teams
and bigger projects.
> 5- My opinion is that trying to implement OO in LabVIEW, is like trying
> to
Is this a fill-in-the blank question? It is difficult today
because the LV language doesn't yet support OO very well.
Early C++ was implemented on top of C using just a bunch
of macros and the preprocessor to mangle the C++ back into
C so that it could be compiled and run. Debugging was
done on practically unreadable text that vaguely resembled
your original code. By comparison, GOOP actually looks
pretty good. It is written entirely on top of the current
LV language and makes clever use of things like datalog
refnums to make strict types.
Over time I think GOOP will mature, and like typedefs,
some users will come to rely on it in a big way.
Other users will hopefully not even notice that anything
changed. If their project grows in complexity and they
need another tool to manage things, it will be just
another feature that helps them to get useful things done.
Greg McKaskle -
Object Oriented Programming concepts
Hi Friends,
I need your help to understand the Object Oriented Programming concepts.
Please help me…
Thanks,
Fl4syedHi,
We can learn oops concepts very easily.Refering some books and search this concepts in some websites related to it.I think the author Robert lafore of oops is one of the best way to learn oops concepts. -
Object Oriented Programming features
Hello,
i want to know more about Object Oriented Programming features, actually i have basic knowledge on Polymorphism, abstraction, DataHidding, Encapsulation, Inheritance. I know the basic bookish definition of these, but can u people give me the definition in terms of java program or any definition which i can co relate with java program.
ex. Class is an example of encapsulation.
Thanks.RGEO wrote:Hello,
i want to know more about Object Oriented Programming features, actually i have basic knowledge on Polymorphism, abstraction, DataHidding, Encapsulation, Inheritance. I know the basic bookish definition of these, but can u people give me the definition in terms of java program or any definition which i can co relate with java program.
ex. Class is an example of encapsulation.
Thanks.see if we talk about encapsulation ----which means data hiding....now this can b expalined by the following example:
class Rect {
protected int len,br;
public void getdata()
len=14;
br=20;
public int area()
return len*br;
class box extends Rect
private int h;
public void getdata()
super.getdata();
h=56;
System.out.println("the height is :"+h);
public int volume()
return len*br*h;
{color:#ff0000}class inheritance
{color}
{color:#ff0000}public static void main(String[] args)
box obj=new box();
obj.getdata();
System.out.println("volume of box is:"+obj.volume());
}{color}
In the above example we are showing inheritance alongwith encapsulation and it goes like this:
we are able to view the result through main methods i.e. we call our method in main method with the help of objects....so we can say that whatever a user is showing he is showing through main method and not showing the logic because when we complie it then we are only shown the result and not the logic behind it.......This is known as encapsulation----showing relevant features and hiding rest all the things.
Edited by: Namrata.Kakkar on Jul 29, 2009 10:46 PM -
Object oriented programming on PXI-System
Greetings,
i've developed some object-oriented LV classes, wich i've succesfully tested on my desktop pc. The next step would have been to test them on a PXI-controller. However, the LV 8.20 methods of object oriented programming seam to be incompatible to PXI-systems.
All i'm getting is an broken arrow with an error message like that
HardwareIOAnalog.lv.class:setTimingNP.vi
Frontpanel-Anschluss 'HardwareIOAnalog in': Der Typ wird für das aktuelle Ziel nicht unterstützt (means: Type not supported by current target)
Does that mean that object-oriented design is not supported in general by PXI, or is it depending on the type of the PXI-System. Is there an easy way around, or do i have to re-program all my classes to conventional (Sub)VIs?
Help appriciated! ;-)
Regards,
Bennet Gedan
Student (Electrical Engineering/Mechatronics)
Darmstadt University of Technology
Bennet Gedan
Student (Electrical Engineering / Mechatronics)
Darmstadt University of TechnologyOkay, thanks. Meanwhile I reprogramed the whole thing and set OOP aside (at least on the PXI-Target). It's a pity to loose some advantages of OOP, but it brougth me some interesting new programing techniques i could transfer to non OOP stuff.
Regards,
Bennet Gedan
Student (Electrical Engineering / Mechatronics)
Darmstadt University of Technology -
Object oriented programming aspects in Oracle
Dear All,
Can you one explain me the aspects of Object Oriented Programming in Oracle. How to use oops concepts in Oracle Procedures, functions, packages, etc.
Thanks,
Moorthy.GSOracle 9i introduces support for inheritance, method overriding and dynamic method dispatch (or "dynamic binding", or "virtual").
A method call is dispatched to the nearest implementation, working back up the inheritance hierarchy from the current or specified type.
See, for example, how we can implement the Template Design Pattern in PL/SQL, using inheritance, method overriding and dynamic method dispatch:
http://www.quest-pipelines.com/pipelines/plsql/tips06.htm#OCTOBER
Oracle 11g introduces support for "super" object-oriented keyword. One attempt to do this in PLSQL 9i/10g:
Calling the Parent Object's Version of an Overridden Method
http://www.quest-pipelines.com/pipelines/plsql/tips03.htm#JUNE
I expect some OO improvements in the future (in Oracle 12oo ...):
1. References between transient objects (instances of objects types) and (then) garbage collector
2. Generic classes (templates, generics) like in Eiffel, C++, Java 5 (PL/SQL was modeled after ADA 83, and ADA 83 has generic packages)
3. Multiple inheritance like in Eiffel (inner classes like in Java - no, please)
4. Design By Contract like in Eiffel (C++ / Java 1.4 assert is not enough)
Design by contract (DBC) is a method whose author is Bertrand Mayer, also maker of OOPL language Eiffel
(Eiffel was designed in 1985, commercialy released in 1986, ISO-standardized in 2006).
Simplified, DBC is based on principle that in each routine (procedure or function) with standard code,
two additional parts – PRECONDITION and POSTCONDITION - need to be asserted.
An additional assertion in class is called INVARIANT.
Contract is based on routine's putting up an obligation to caller (to some other routine)
to satisfy conditions of precondition and conditions of invariant, and hers (called routine's) obligation
to satisfy conditions of postcondition and conditions of invariant.
The object oriented Eiffel programming language was created to implement DBC.
For now, other OO (object-oriented) languages don’t support directly the ideas behind DBC.
However, precondition and postcondition are applicable to many programming languages, both OO and not OO.
Invariants are applicable only in OOPL.
This is my attempt to use DBC methodology (including invariants) in Oracle PL/SQL.
Eiffel class interface (not like Java interface, but more like PL/SQL package specification)
from Bertrand Meyer's book "Object oriented software construction", second edition (OOSC2), 1997, page 390-391:
class interface STACK [G]
creation make
feature -- Initialization
make (n: INTEGER) is -- Alocate stack for a maximum of n elements
require
non_negative_capacity: n >= 0
ensure
capacity_set: capacity = n
end
feature -- Access
capacity: INTEGER -- Maximum number of stack elements
count: INTEGER -- Number of stack elements
item: G is -– Top element
require
not_empty: not empty
end
feature -- Status report
empty: BOOLEAN is –- Is stack empty?
ensure
empty_definition: Result = (count = 0)
end
full: BOOLEAN is –- Is stack full?
ensure
full_definition: Result = (count = capacity)
end
feature -- Element change
put (x: G) is –- Add x on top
require
not_full: not full
ensure
not_empty: not empty
added_to_top: item = x
one_more_item: count = old count + 1
end
remove is -– Remove top element
require
not_empty: not empty
ensure
not_full: not full
one_fewer: count = old count - 1
end
invariant
count_non_negative: 0 <= count
count_bounded: count <= capacity
empty_if_no_elements: empty = (count = 0)
end -– class interface STACK
-- PL/SQL "equivalent":
-- Stack implementation - TABLE of INTEGER.
-- Eiffel has generic classes (like C++ templates and better than Java generics).
-- PL/SQL (now) has not generic classes or generic packages.
CREATE OR REPLACE TYPE array_t AS TABLE OF INTEGER
-- utility package:
CREATE OR REPLACE PACKAGE dbc AS
-- 0 = no check
-- 1 = check preconditions
-- 2 = check preconditions + postconditions
-- 3 = check preconditions + postconditions + invariants
c_no_check CONSTANT INTEGER := 0;
c_check_preconditions CONSTANT INTEGER := 1;
c_check_pre_postconditions CONSTANT INTEGER := 2;
c_check_pre_post_invariants CONSTANT INTEGER := 3;
FUNCTION check_preconditions RETURN BOOLEAN;
FUNCTION check_pre_postconditions RETURN BOOLEAN;
FUNCTION check_pre_post_invariants RETURN BOOLEAN;
PROCEDURE set_level (p_level INTEGER);
PROCEDURE display_error (p_error VARCHAR2);
END;
CREATE OR REPLACE PACKAGE BODY dbc AS
m_level INTEGER := c_no_check;
FUNCTION check_preconditions RETURN BOOLEAN IS
BEGIN
IF m_level >= c_check_preconditions THEN
RETURN TRUE;
ELSE
RETURN FALSE;
END IF;
END;
FUNCTION check_pre_postconditions RETURN BOOLEAN IS
BEGIN
IF m_level >= c_check_pre_postconditions THEN
RETURN TRUE;
ELSE
RETURN FALSE;
END IF;
END;
FUNCTION check_pre_post_invariants RETURN BOOLEAN IS
BEGIN
IF m_level >= c_check_pre_post_invariants THEN
RETURN TRUE;
ELSE
RETURN FALSE;
END IF;
END;
PROCEDURE set_level (p_level INTEGER) IS
BEGIN
IF p_level NOT IN
(c_no_check, c_check_preconditions, c_check_pre_postconditions, c_check_pre_post_invariants)
THEN
RAISE_APPLICATION_ERROR (-20000, 'Wrong checking level');
END IF;
m_level := p_level;
END;
PROCEDURE display_error (p_error VARCHAR2) IS
BEGIN
RAISE_APPLICATION_ERROR (-20000, 'ERROR in method ' || p_error);
END;
END;
CREATE OR REPLACE TYPE stack AS OBJECT (
-- Maximum number of stack elements
capacity INTEGER,
-- Number of stack elements
el_count INTEGER,
-- Stack implementation
stack_implementation array_t,
-- Alocate stack for a maximum of n elements
CONSTRUCTOR FUNCTION stack (n INTEGER) RETURN SELF AS RESULT,
-- Top element
MEMBER FUNCTION item (SELF IN OUT stack) RETURN INTEGER,
-- Is stack empty?
MEMBER FUNCTION empty RETURN BOOLEAN,
-- Is stack full?
MEMBER FUNCTION full RETURN BOOLEAN,
-- Add x on top
MEMBER PROCEDURE put (x INTEGER),
-- Remove top element
MEMBER PROCEDURE remove,
-- INVARIANTS
-- Note:
-- If subprogram is declared in an object type body (in PL/SQL 8i/9i/10g)
-- it must be defined in the object type specification too.
MEMBER FUNCTION count_non_negative RETURN BOOLEAN,
MEMBER FUNCTION count_bounded RETURN BOOLEAN,
MEMBER FUNCTION empty_if_no_elements RETURN BOOLEAN,
MEMBER PROCEDURE check_invariants
) NOT FINAL;
CREATE OR REPLACE TYPE BODY stack AS
CONSTRUCTOR FUNCTION stack (n INTEGER) RETURN SELF AS RESULT IS
BEGIN
IF dbc.check_preconditions AND n < 0 THEN
dbc.display_error ('stack - PRE');
END IF;
check_invariants;
capacity := n;
stack_implementation := array_t();
stack_implementation.EXTEND (n);
IF dbc.check_pre_postconditions AND capacity <> n THEN
dbc.display_error ('stack - POST');
END IF;
check_invariants;
END;
MEMBER FUNCTION item (SELF IN OUT stack) RETURN INTEGER IS
BEGIN
IF dbc.check_preconditions AND empty THEN
dbc.display_error ('item - PRE');
END IF;
check_invariants;
RETURN stack_implementation(el_count);
END;
MEMBER FUNCTION empty RETURN BOOLEAN IS
BEGIN
IF el_count = 0 THEN
RETURN TRUE;
ELSE
RETURN FALSE;
END IF;
END;
MEMBER FUNCTION full RETURN BOOLEAN IS
BEGIN
IF el_count = capacity THEN
RETURN TRUE;
ELSE
RETURN FALSE;
END IF;
END;
MEMBER PROCEDURE put (x INTEGER) IS
BEGIN
IF dbc.check_preconditions AND full THEN
dbc.display_error ('put - PRE');
END IF;
check_invariants;
el_count := el_count + 1;
stack_implementation(el_count) := x;
-- PL/SQL has not Eiffel's OLD
-- one_more_item: count = old count + 1
IF dbc.check_pre_postconditions AND (empty OR item <> x) THEN
dbc.display_error ('put - POST');
END IF;
check_invariants;
END;
MEMBER PROCEDURE remove IS BEGIN
IF dbc.check_preconditions AND empty THEN
dbc.display_error ('remove - PRE');
END IF;
check_invariants;
el_count := el_count - 1;
-- PL/SQL has not Eiffel's OLD
-- one_fewer: count = old count - 1
IF dbc.check_pre_postconditions AND full THEN
dbc.display_error ('remove - POST');
END IF;
check_invariants;
END;
-- INVARIANTS
MEMBER FUNCTION count_non_negative RETURN BOOLEAN IS
BEGIN
IF el_count >= 0 THEN
RETURN TRUE;
ELSE
RETURN FALSE;
END IF;
END;
MEMBER FUNCTION count_bounded RETURN BOOLEAN IS
BEGIN
IF el_count <= capacity THEN
RETURN TRUE;
ELSE
RETURN FALSE;
END IF;
END;
MEMBER FUNCTION empty_if_no_elements RETURN BOOLEAN IS
BEGIN
IF empty AND (el_count = 0)
OR
NOT empty AND (el_count <> 0)
THEN
RETURN TRUE;
ELSE
RETURN FALSE;
END IF;
END;
MEMBER PROCEDURE check_invariants IS
BEGIN
IF NOT dbc.check_pre_post_invariants THEN
RETURN; -- without checking invariants
END IF;
IF NOT count_non_negative THEN
dbc.display_error ('INVARIANT count_non_negative');
END IF;
IF NOT count_bounded THEN
dbc.display_error ('INVARIANT count_bounded');
END IF;
IF NOT empty_if_no_elements THEN
dbc.display_error ('INVARIANT empty_if_no_elements');
END IF;
END;
END; -- class body STACK
/Regards,
Zlatko Sirotic -
What are the basic pillars of Object Oriented Programming?
there are 3 pillars of OOP which are Encapsulation, inheritance, polymorphism, but i heard lot's of people even companies software engineers use abstraction is a pillar, i haven't find it from MSDN why abstraction is not a pillar ?
Whereas encapsulation, inheritence and polymorphism are specific implementation details of OOP (i.e. the key ideas that make programming
object-oriented), abstraction is a high-level way of looking at your overall application design.
For example, in a simple database application you would not want to write your code so that your user-interface, business logic, and database code was all hard-coded and "tied" to each other.
Ideally you would think about your design and try to plan your application so that your user-interface code is independent of your business logic code (which can be "plugged-in" and/or changed as necessary), which is again independent of your database
code such that you could even switch to a different database and only need to change that one part of your code-base.
As an example, you might not pass a class representing some business logic directly into your user-interface code. Rather, you may want to create an interface representing a generic way of representing your logic that could be re-used by lots of business
classes. It is then this interface that could be used by your UI code or database code to validate data, rather than specific classes. Then you could create more classes in future that just have to implement the same interfaces, knowing that the rest of your
code would not need to change. This is just one aspect of "abstraction".
If you do a search for "application design patterns" or "object-oriented design patterns" you will find plenty of articles and books on how to go about doing this.
Maybe you are looking for
-
Report Builder on Linux?
Hi Everyone, Is it possible to run a version of Oracle report builder in linux? Currently right now I am running Reports 6i in Windows XP. I've found a way to run all my other apps in linux and have switched over except for a couple of Oracle apps. T
-
Is it possible to reset the form submit state? I have a page with many input components, some of which are set to "Auto-Submit on Change". When submitting, a new window is opened with the report results. I need the user to go back to the original inp
-
6600gt problems (AGP)
Before installing my 6600gt I had a geforce 2 ti which I uninstalled all the drivers for. When I put this card in I installed the drivers that came with it. When I click on the MSI information tab it says my bus type is agp but agp 4x or 8x arent che
-
IMovie 9.0.8 update falling to install
Both the update from Software update & from Apple downlaods get stuck at the moving items into place (does nothing for over 8 hours) It gets stuck and I see shove runnig but not using any cpu I have iMovie 9.0.7 installed Any idea how to fix it so 9.
-
I tried to catch unique signal(SIGCHLD) from child processes. A problem is that parent should catch SIGCHLD signals from multiple children simultaneously. In Solaris 5.5 and 5.8, some of SIGCHLD signals disapear. But there is no zombie process. I thi