affiliate marketing
Showing posts with label data structure specification. Show all posts
Showing posts with label data structure specification. Show all posts

Monday, 12 December 2011

6. Layered Software


Recall the picture that I showed you earlier:
It illustrates an important, general idea: the idea of layered software. In this picture there are two layers: the application layer and the implementation layer. The critical point - the property that makes these truly separate layers - is that the functionality of the upper layer, and the code that implements that functionality, are completely independent of the code of the lower layer. Furthermore the functionality of the lower layer is completely described in the specification.
We have already discussed how this arrangement permits very rapid, bug-free changes to the code implementing an abstract data type. But this is not the only advantage.
Reusability

5. Specification (Sections 3.3 & 3.5)


5. Specification (Sections 3.3 & 3.5)
Handout Stack Specification.
Handout: Stack Specification
Let us now look in detail at how we specify an abstract datatype. We will use `stack' as an example.
The data structure stack is based on the everyday notion of a stack, such as a stack of books, or a stack of plates. The defining property of a stack is that you can only access the top element of the stack, all the other elements are underneath the top one and can't be accessed except by removing all the elements above them one at a time.
The notion of a stack is extremely useful in computer science, it has many applications, and is so widely used that microprocessors often are stack-based or at least provide hardware implementations of the basic stack operations.
We will briefly consider some of the applications later. First, let us see how we can define, or specify, the abstract concept of a stack. The main thing to notice here is how we specify everything needed in order to use stacks without any mention of how stacks will be implemented.
5.1. Pre & Post Conditions
Preconditions: