+2 votes
in Software Engineering by

1 Answer

+1 vote
selected by
Best answer
Take, for example, a stack component. This will provide basic operations that are common to all stacks such as Initialise (Create a stack), Push (an item onto the stack), Pop (an item from the stack), Size (the number of items currently on the stack), and perhaps others. However, each application will use stacks in different ways and so may require different versions of these operations and additional operations.

For example, consider a graphical browsing operation that allows users to browse a digital library. The library is divided into areas and the identifier for each area points to the books in that area. When the user enters an area, its identifier is pushed onto a stack and popped from the stack when he or she leaves that area and goes back to the previous area. Thus, the top of the stack always refers to the books in the current area. However, there is a requirement to provide a facility where the user can view all areas visited and this requires an additional stack operation that provides access to all stack elements. This then has to be added to the stack component. It also requires the Pop operation to be modified so that, when an item is popped from the stack it is added to a ‘visited areas’ list that can be displayed in conjunction with the current stack elements.

Related questions

Welcome to CPEN Talk
Solution-oriented students of computer engineering on one platform to get you that


Chuck Norris doesn't bug hunt as that signifies a probability of failure, he goes bug killing.