Thread: Stacks
View Single Post
  #13 (permalink)  
Old 05-05-2008, 07:44 AM
danielstoner's Avatar
danielstoner danielstoner is offline
Senior Member
 
Join Date: Apr 2008
Location: Canada
Posts: 183
danielstoner is on a distinguished road
My 2 cents...

I believe there is a time and place for every idea. Yes stacks allow you to work with the top of the stack always but the main idea behind it is not that. The main idea is to maintain an order for doing something and then undoing it. And stacks are just a solution for this problem.
But then, there are other problems to be solved out there. Sometimes after you build the stack you might need to know some information about it. Sometimes you might need to peek inside and make some decisions. The implementation in Java simply allows the programmer to use a versatile library class as he sees fit.
By the way, there are programming languages out there that use stack manipulation at runtime in order to do optimizations and to offer "magical" features.
Nothing scares me in programming and in life more than a dogma and a religious war . The only rule is "there are no rules". Don't take a book definition of a fact and make it your "dogma". This will only make you turn a blind eye to other points of view and other possibilities.
Just think about it. Isn't a stack implementation more useful and flexible and possibly a part of the solution for more problems if it allows you to know more about its internal state at any moment? Of course it is also easier to mess up . But nothing stops you from writing a wrapper that only gives access to the basic stack functionality.
__________________
Daniel @ [
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
]
Language is froth on the surface of thought
Reply With Quote