Download presentation
Presentation is loading. Please wait.
1
CISC/CMPE320 - Prof. McLeod
Winter 2013 CISC/CMPE320 2/24/2019 CISC/CMPE320 RAD due this Friday 7pm. See last Wednesday’s lecture for more info. And: You must include a sprint made up with issues that have time to completion estimates. Don’t forget that the document must be created and presented in Confluence. Think of your audience as the executives of your client’s company who are looking to sign off on the completeness of your list of system requirements. Almost a contract! Have all team members been involved in the creation and editing of this document? Fall 2018 CISC/CMPE320 - Prof. McLeod Prof. Alan McLeod
2
CISC/CMPE320 - Prof. McLeod
Server Use? If any teams would like to have access to a remote server in order to test their system, let me know (soon). Fall 2018 CISC/CMPE320 - Prof. McLeod
3
CISC/CMPE320 - Prof. McLeod
Today Non-Functional Requirements. Continue Operator Overloading. Fall 2018 CISC/CMPE320 - Prof. McLeod
4
CISC/CMPE320 - Prof. McLeod
The RAD, Cont. The purpose of the RAD is to provide a complete list of requirements. Functional requirements are like “features” and are not too difficult to figure out. Non-functional requirements are harder to specify in advance (without having even built the system yet!). Fall 2018 CISC/CMPE320 - Prof. McLeod
5
Non-Functional Requirements
It might help to consider several categories: Usability Reliability Performance Supportability Implementation Interface Operation Packaging Legal Fall 2018 CISC/CMPE320 - Prof. McLeod
6
Non-Functional Requirements, Cont.
Usability What is the ability level of user? What interface standards are already familiar to the user? What docs does he need? Paper, pdf, web, CD? Will he use a help system or documentation or is he an engineer… Fall 2018 CISC/CMPE320 - Prof. McLeod
7
Non-Functional Requirements, Cont.
Reliability How reliable, available and robust? Can it be restarted after a failure? How much data can be lost? How are exceptions handled? Any safety requirements? Any security requirements? Fall 2018 CISC/CMPE320 - Prof. McLeod
8
Non-Functional Requirements, Cont.
Performance How responsive? What user tasks are time critical? How many concurrent users (now and in the future)? How much data? What is acceptable latency? Supportability What extensions will be needed? Who does the maintenance? Ported to different environments? Fall 2018 CISC/CMPE320 - Prof. McLeod
9
Non-Functional Requirements, Cont.
Implementation Constraints on the hardware platform? Constraints imposed by maintenance requirements? Constraints imposed by testing team? Interface Required interface with existing system? How is data imported/exported? Existing standards already in use by client? Operation Who will manage the system when it is operating? Fall 2018 CISC/CMPE320 - Prof. McLeod
10
Non-Functional Requirements, Cont.
Packaging Who does the installation? How many installations are anticipated? How long can the installation take? Legal How is it licensed? What liability results from system failures? Does the use of any components incur royalties or licensing fees? Fall 2018 CISC/CMPE320 - Prof. McLeod
11
Non-Functional Requirements, Cont.
Only a few of these may apply to your project, but: Non-functional requirements will likely determine the bounds of your system in terms of what can be done and what cannot. They will form design goals that everyone needs to keep in mind when they are fleshing out the functional requirements. Fall 2018 CISC/CMPE320 - Prof. McLeod
12
Operator Overloading, So Far
We are overloading binary arithmetic and Boolean operators for our MyComplex class: The best flexibility for mixed type expressions is obtained by non-member overloading or non-member friends. Non-member overloading required accessors, but non-member friends do not. The operator= overloading is provided by the compiler automatically, but will not work properly if the attributes use the heap. Next: increment and decrement operator overloading: Fall 2018 CISC/CMPE320 - Prof. McLeod
13
CISC/CMPE320 - Prof. McLeod
MyComplex Demo, Again See “version 4”: overloads ++ and +=. Which is faster? Pre-increment or post-increment? Why doesn’t post increment return a reference? Fall 2018 CISC/CMPE320 - Prof. McLeod
14
Aside - The this Pointer
This keyword provides a pointer to the current instance of the class at run-time. “Myself” You can use it to obtain members using -> *this de-references the pointer. Fall 2018 CISC/CMPE320 - Prof. McLeod
15
Overloading Conversion Operators
You don’t need to write these for assignment 2. Consider that your Fraction class has top for the numerator and bottom for the denominator. To overload a cast to type double: Fraction::operator double() const { return static_cast<double>(top) / bottom; } If test is a Fraction object, this allows stuff like: double aNum = static_cast<double>(test); Fall 2018 CISC/CMPE320 - Prof. McLeod
16
Overloading Conversion Operators, Cont.
Similarly for int. Note the lack of a return type. But if you have a conversion operator and an applicable conversion constructor this leads to an ambiguity: Which operator should be used in a mixed type expression? See MyComplexAmbiguous Fall 2018 CISC/CMPE320 - Prof. McLeod
17
Overloading Conversion Operators, Cont.
With just the constructor you can do things like: int aVal = 10; Fraction test = static_cast<Fraction>(aVal); Same as: Fraction test = Fraction(aVal); But you can’t do: aVal = static_cast<int>(test); Fall 2018 CISC/CMPE320 - Prof. McLeod
18
Overloading Conversion Operators, Cont.
So, what’s to do? If you ditch the single number constructor, then you give yourself a lot more work when you need to overload operators for mixed expressions. Might be easiest to keep the constructor and compromise: Write member functions called intVal() and doubleVal() instead? Or declare the constructor explicit? Fall 2018 CISC/CMPE320 - Prof. McLeod
19
CISC/CMPE320 - Prof. McLeod
The explicit Keyword If you want a constructor to just be a constructor and not for use as a rule for implicit type conversions, declare it with explicit. For example: class Fraction { // etc. explicit Fraction(int); }; Fall 2018 CISC/CMPE320 - Prof. McLeod
20
The explicit Keyword, Cont.
If you use explicit: From the MyComplexAmbiguous demo, what is the result of a mixed type expression with a number on one side and a MyComplex instance on the other? Fall 2018 CISC/CMPE320 - Prof. McLeod
21
Another Caution on the Use of Overloaded Conversion Operators
Suppose aComplex is 3 + 4i Do you want aComplex == 5 to be true? Fall 2018 CISC/CMPE320 - Prof. McLeod
22
CISC/CMPE320 - Prof. McLeod
Another Alternative? Suppose you have declared your conversion constructors explicit so that your conversion operators will still work. How can you now overload binary operators so that mixed type expressions will still work? Fall 2018 CISC/CMPE320 - Prof. McLeod
23
Overloading the Subscript Operator: [ ]
Appropriate for: A data structure requiring access using an index. A data structure that wants to make sure index values are legal. See the SafeArray class. Note the two versions of operator[] used. Note the use of a friend non-member function. Note the use of a destructor (getting ahead of myself…) Fall 2018 CISC/CMPE320 - Prof. McLeod
24
Overloading the Function Call Operator: ( )
Allows an object to behave as if it is a function. Called a function object. The only operator where the number of arguments is not fixed or limited to one or two. See the RandomInt class. Used in the STL. Fall 2018 CISC/CMPE320 - Prof. McLeod
25
Aside - inline Functions
Used in the RandomInt class. Used when the function body is short: ≤ 3 assignment statements. one conditional. one return. An inline function is not placed on the activation record stack, but is expanded in place and so is executed faster. Must be in the declaration file. The downside is that a copy is made every time the function is invoked – so it should be short. Fall 2018 CISC/CMPE320 - Prof. McLeod
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.