CSE 222: Software Components in Engineering (SCE) – Introduction Instructor: Jimmy Voss...
-
Upload
theodora-pearson -
Category
Documents
-
view
216 -
download
2
Transcript of CSE 222: Software Components in Engineering (SCE) – Introduction Instructor: Jimmy Voss...
![Page 1: CSE 222: Software Components in Engineering (SCE) – Introduction Instructor: Jimmy Voss Disclaimer: Not all material is original. Some is taken from the.](https://reader030.fdocuments.in/reader030/viewer/2022032415/56649efe5503460f94c13308/html5/thumbnails/1.jpg)
CSE 222: Software Components in Engineering (SCE) – Introduction
Instructor: Jimmy VossDisclaimer: Not all material is original. Some
is taken from the official course slides, and some is taken from Anna’s slides.
![Page 2: CSE 222: Software Components in Engineering (SCE) – Introduction Instructor: Jimmy Voss Disclaimer: Not all material is original. Some is taken from the.](https://reader030.fdocuments.in/reader030/viewer/2022032415/56649efe5503460f94c13308/html5/thumbnails/2.jpg)
Syllabus Information
• Course Coordinator: Dr. Bruce Weide• Instructor: Jimmy Voss– E-mail: [email protected]– Office: 407 Caldwell– Office Hours: 2:30 – 3:30 Tu Th
• Course website:– http://www.cse.ohio-state.edu/sce/now/222/
![Page 3: CSE 222: Software Components in Engineering (SCE) – Introduction Instructor: Jimmy Voss Disclaimer: Not all material is original. Some is taken from the.](https://reader030.fdocuments.in/reader030/viewer/2022032415/56649efe5503460f94c13308/html5/thumbnails/3.jpg)
Overview of Course
• Use RESOLVE/C++ to teach programming concepts and software engineering principles:– Use of data structures– Client View and Implementer’s View– Design by contract– Memory management / pointers– Data structure implementations
![Page 4: CSE 222: Software Components in Engineering (SCE) – Introduction Instructor: Jimmy Voss Disclaimer: Not all material is original. Some is taken from the.](https://reader030.fdocuments.in/reader030/viewer/2022032415/56649efe5503460f94c13308/html5/thumbnails/4.jpg)
What is RESOLVE/C++?
• An approach to programming in C++• Uses formal comments to specify precise
program behavior.• Implemented using macros, classes, and
formal comments.• Implements a set of template libraries.• Implements 4 standard operations for all
components.
![Page 5: CSE 222: Software Components in Engineering (SCE) – Introduction Instructor: Jimmy Voss Disclaimer: Not all material is original. Some is taken from the.](https://reader030.fdocuments.in/reader030/viewer/2022032415/56649efe5503460f94c13308/html5/thumbnails/5.jpg)
Review of Resolve
• Combines a programming language (C++) and a specification language.– For code to be correct, it must work precisely
when the specifications are met.– Use formal comments for specifications.– Some specifications described via keywords which
have no meaning in C++.• Disciplined way of programming C++
![Page 6: CSE 222: Software Components in Engineering (SCE) – Introduction Instructor: Jimmy Voss Disclaimer: Not all material is original. Some is taken from the.](https://reader030.fdocuments.in/reader030/viewer/2022032415/56649efe5503460f94c13308/html5/thumbnails/6.jpg)
Review of Resolve
• All Resolve components are classes with 4 predefined operations:– Swap -- denoted &=– Constructor– Destructor– Clear member function
![Page 7: CSE 222: Software Components in Engineering (SCE) – Introduction Instructor: Jimmy Voss Disclaimer: Not all material is original. Some is taken from the.](https://reader030.fdocuments.in/reader030/viewer/2022032415/56649efe5503460f94c13308/html5/thumbnails/7.jpg)
Sequence -- A Resolve/C++ component
• a sequence is an ordered grouping of objects– Example: “abc” is an ordered sequence of
characters. A Text object could be used.• Sequence – the Abstract RESOLVE/C++
component:– 4 operations allowed:
• Add( pos, x )• Remove( pos, x )• Accessor, i.e., [pos]• Length()
![Page 8: CSE 222: Software Components in Engineering (SCE) – Introduction Instructor: Jimmy Voss Disclaimer: Not all material is original. Some is taken from the.](https://reader030.fdocuments.in/reader030/viewer/2022032415/56649efe5503460f94c13308/html5/thumbnails/8.jpg)
Instantiating Sequence
#include "RESOLVE_Foundation.h"
#include "CT/Sequence/Kernel_1a_C.h"
concrete_instanceclass Sequence_Of_Integer : instantiates Sequence_Kernel_1a_C <Integer>{};
![Page 9: CSE 222: Software Components in Engineering (SCE) – Introduction Instructor: Jimmy Voss Disclaimer: Not all material is original. Some is taken from the.](https://reader030.fdocuments.in/reader030/viewer/2022032415/56649efe5503460f94c13308/html5/thumbnails/9.jpg)
Instantiating Sequence
#include "RESOLVE_Foundation.h"
#include "CT/Sequence/Kernel_1a_C.h"
concrete_instanceclass Sequence_Of_Integer : instantiates Sequence_Kernel_1a_C <Integer>{};
Preprocessor directives
RESOLVE Keyword
Template parameter
![Page 10: CSE 222: Software Components in Engineering (SCE) – Introduction Instructor: Jimmy Voss Disclaimer: Not all material is original. Some is taken from the.](https://reader030.fdocuments.in/reader030/viewer/2022032415/56649efe5503460f94c13308/html5/thumbnails/10.jpg)
Preprocessor directives
• #include– Used to include the contents of another file at the current
location in the current file.– Example:
• #include "RESOLVE_Foundation.h"
• #define– Used for text replacement which occurs before the
program is compiled.– Examples:
• #define concrete_instance• #define procedure_body virtual void
![Page 11: CSE 222: Software Components in Engineering (SCE) – Introduction Instructor: Jimmy Voss Disclaimer: Not all material is original. Some is taken from the.](https://reader030.fdocuments.in/reader030/viewer/2022032415/56649efe5503460f94c13308/html5/thumbnails/11.jpg)
Template parameters
• Template parameter – a token which represents a type name.
• Classes and functions can be defined on arbitrary types. To use such classes / functions, the user must supply the template parameter.
• Container classes such as Sequence require a template parameter to be instantiated.
• In this course, we instantiate template parameters via inheritance.
![Page 12: CSE 222: Software Components in Engineering (SCE) – Introduction Instructor: Jimmy Voss Disclaimer: Not all material is original. Some is taken from the.](https://reader030.fdocuments.in/reader030/viewer/2022032415/56649efe5503460f94c13308/html5/thumbnails/12.jpg)
Inheritance and templating
• Inheritance takes on the form:class child : instantiates parent
• The child class contains all member functions and variables of the parent class.
• If the parent class has requires a template parameter, then a new class with the template parameter filled in is created via:
parent< template_type >
• Note: This is not the only way of filling in template parameters.
![Page 13: CSE 222: Software Components in Engineering (SCE) – Introduction Instructor: Jimmy Voss Disclaimer: Not all material is original. Some is taken from the.](https://reader030.fdocuments.in/reader030/viewer/2022032415/56649efe5503460f94c13308/html5/thumbnails/13.jpg)
Instantiating Sequence
#include "RESOLVE_Foundation.h"
#include "CT/Sequence/Kernel_1a_C.h"
concrete_instanceclass Sequence_Of_Integer : instantiates Sequence_Kernel_1a_C <Integer>{};
Preprocessor directives
RESOLVE Keyword
Template type parameter
![Page 14: CSE 222: Software Components in Engineering (SCE) – Introduction Instructor: Jimmy Voss Disclaimer: Not all material is original. Some is taken from the.](https://reader030.fdocuments.in/reader030/viewer/2022032415/56649efe5503460f94c13308/html5/thumbnails/14.jpg)
![Page 15: CSE 222: Software Components in Engineering (SCE) – Introduction Instructor: Jimmy Voss Disclaimer: Not all material is original. Some is taken from the.](https://reader030.fdocuments.in/reader030/viewer/2022032415/56649efe5503460f94c13308/html5/thumbnails/15.jpg)
![Page 16: CSE 222: Software Components in Engineering (SCE) – Introduction Instructor: Jimmy Voss Disclaimer: Not all material is original. Some is taken from the.](https://reader030.fdocuments.in/reader030/viewer/2022032415/56649efe5503460f94c13308/html5/thumbnails/16.jpg)
FormalComment /the contract
Pass by reference
![Page 17: CSE 222: Software Components in Engineering (SCE) – Introduction Instructor: Jimmy Voss Disclaimer: Not all material is original. Some is taken from the.](https://reader030.fdocuments.in/reader030/viewer/2022032415/56649efe5503460f94c13308/html5/thumbnails/17.jpg)
An Example (Continued)global_procedure Smooth( preserves Sequence_Of_Integer & s1, produces Sequence_Of_Integer & s2)/*! ... !*/{ // s2 is produces mode and should not depend on // the input. s2.Clear();
object Integer Index = 0; while ( Index < s1.Length() - 1 ) { s2.Add( Index, (s1[Index] + s1[Index+1]) / 2 ); }}
![Page 18: CSE 222: Software Components in Engineering (SCE) – Introduction Instructor: Jimmy Voss Disclaimer: Not all material is original. Some is taken from the.](https://reader030.fdocuments.in/reader030/viewer/2022032415/56649efe5503460f94c13308/html5/thumbnails/18.jpg)
Set
• Set – A set is an unordered collection of objects which contain no duplicates.
• Examples of sets:– {1, 2, 3, 4, 5}– {}– {“Bob”, “the cat”, “Tom”, “Random string”}
• Not a set:– {0, 0, 1, 2}
![Page 19: CSE 222: Software Components in Engineering (SCE) – Introduction Instructor: Jimmy Voss Disclaimer: Not all material is original. Some is taken from the.](https://reader030.fdocuments.in/reader030/viewer/2022032415/56649efe5503460f94c13308/html5/thumbnails/19.jpg)
Requires: x self
Requires: x self
![Page 20: CSE 222: Software Components in Engineering (SCE) – Introduction Instructor: Jimmy Voss Disclaimer: Not all material is original. Some is taken from the.](https://reader030.fdocuments.in/reader030/viewer/2022032415/56649efe5503460f94c13308/html5/thumbnails/20.jpg)
![Page 21: CSE 222: Software Components in Engineering (SCE) – Introduction Instructor: Jimmy Voss Disclaimer: Not all material is original. Some is taken from the.](https://reader030.fdocuments.in/reader030/viewer/2022032415/56649efe5503460f94c13308/html5/thumbnails/21.jpg)
![Page 22: CSE 222: Software Components in Engineering (SCE) – Introduction Instructor: Jimmy Voss Disclaimer: Not all material is original. Some is taken from the.](https://reader030.fdocuments.in/reader030/viewer/2022032415/56649efe5503460f94c13308/html5/thumbnails/22.jpg)
![Page 23: CSE 222: Software Components in Engineering (SCE) – Introduction Instructor: Jimmy Voss Disclaimer: Not all material is original. Some is taken from the.](https://reader030.fdocuments.in/reader030/viewer/2022032415/56649efe5503460f94c13308/html5/thumbnails/23.jpg)
![Page 24: CSE 222: Software Components in Engineering (SCE) – Introduction Instructor: Jimmy Voss Disclaimer: Not all material is original. Some is taken from the.](https://reader030.fdocuments.in/reader030/viewer/2022032415/56649efe5503460f94c13308/html5/thumbnails/24.jpg)
![Page 25: CSE 222: Software Components in Engineering (SCE) – Introduction Instructor: Jimmy Voss Disclaimer: Not all material is original. Some is taken from the.](https://reader030.fdocuments.in/reader030/viewer/2022032415/56649efe5503460f94c13308/html5/thumbnails/25.jpg)
![Page 26: CSE 222: Software Components in Engineering (SCE) – Introduction Instructor: Jimmy Voss Disclaimer: Not all material is original. Some is taken from the.](https://reader030.fdocuments.in/reader030/viewer/2022032415/56649efe5503460f94c13308/html5/thumbnails/26.jpg)