CISC/CMPE320 - Prof. McLeod

Slides:



Advertisements
Similar presentations
Bellevue University CIS 205: Introduction to Programming Using C++ Lecture 3: Primitive Data Types.
Advertisements

All the Operators. Precedence An operator with higher precedence is done earlier (prededes) one with lower precedence –A higher precedence is indicated.
All the Operators. Precedence An operator with higher precedence is done earlier (prededes) one with lower precedence –A higher precedence is indicated.
More about Numerical Computation CS-2301, B-Term More about Numerical Computation CS-2301, System Programming for Non-Majors (Slides include materials.
2015/8/221 Data Types & Operators Lecture from (Chapter 3,4)
DEPARTMENT OF COMPUTER SCIENCE & TECHNOLOGY FACULTY OF SCIENCE & TECHNOLOGY UNIVERSITY OF UWA WELLASSA 1 CST 221 OBJECT ORIENTED PROGRAMMING(OOP) ( 2 CREDITS.
IT253: Computer Organization Lecture 3: Memory and Bit Operations Tonga Institute of Higher Education.
C++ Basics Tutorial 6 Operators. What are going to see today? Assignment operator(=) Arithmetic operators(+,-,*,/,%) Compound assignment(+=,-=,*=……..)
15-Nov-15 All the Operators. operators.ppt 2 Precedence An operator with higher precedence is done earlier (precedes) one with lower precedence A higher.
Fall 2015CISC/CMPE320 - Prof. McLeod1 CISC/CMPE320 Meet with your team later today in ELL321 at 6:30pm. Teams are listed on the Project page of the course.
Fall 2015CISC/CMPE320 - Prof. McLeod1 CISC/CMPE320 Assignment 1 due today, 7pm. RAD due next Friday in your Wiki. Presentations week 6. Today: –Continue.
Fall 2015CISC/CMPE320 - Prof. McLeod1 CISC/CMPE320 Assignment 1 due tomorrow, 7pm. RAD due next Friday in your Wiki. Presentations week 6. Tomorrow’s lecture.
Fall 2015CISC/CMPE320 - Prof. McLeod1 CISC/CMPE320 Today: –Review declaration, implementation, simple class structure. –Add an exception class and show.
Fall 2015CISC/CMPE320 - Prof. McLeod1 CISC/CMPE320 How did your team meetings go? A list of three possible “adoptable” projects is linked near the bottom.
ECE 103 Engineering Programming Chapter 4 Operators Herbert G. Mayer, PSU CS Status 6/19/2015 Initial content copied verbatim from ECE 103 material developed.
Fall 2015CISC/CMPE320 - Prof. McLeod1 CISC/CMPE320 Reminders: Have you filled out the questionnaire in Moodle? (3 left – as of last night). Office hours.
Announcements Assignment 2 Out Today Quiz today - so I need to shut up at 4:25 1.
Chapter 1: Preliminaries Lecture # 2. Chapter 1: Preliminaries Reasons for Studying Concepts of Programming Languages Programming Domains Language Evaluation.
OPERATORS IN C CHAPTER 3. Expressions can be built up from literals, variables and operators. The operators define how the variables and literals in the.
CMSC 202 Lesson 26 Miscellaneous Topics. Warmup Decide which of the following are legal statements: int a = 7; const int b = 6; int * const p1 = & a;
ECE 103 Engineering Programming Chapter 4 Operators Herbert G. Mayer, PSU Status 6/10/2016 Initial content copied verbatim from ECE 103 material developed.
Bitwise Operations C includes operators that permit working with the bit-level representation of a value. You can: - shift the bits of a value to the left.
C# Operator Overloading and Type Conversions
2.0 FUNDAMENTALS OF JAVA PROGRAMMING LANGUAGE
CISC/CMPE320 - Prof. McLeod
CISC/CMPE320 - Prof. McLeod
Precedence and Associativity
CISC/CMPE320 - Prof. McLeod
CISC/CMPE320 - Prof. McLeod
CISC/CMPE320 - Prof. McLeod
Expressions and Assignment Statements
Lecture 5 from (Chapter 4, pages 73 to 96)
Character Set The character set of C represents alphabet, digit or any symbol used to represent information. Types Character Set Uppercase Alphabets A,
All the Operators 22-Nov-18.
More about Numerical Computation
Fall 2018 CISC124 12/3/2018 CISC124 or talk to your grader with questions about assignment grading. Fall 2018 CISC124 - Prof. McLeod Prof. Alan McLeod.
All the Operators 4-Dec-18.
CISC101 Reminders Assn 3 due tomorrow, 7pm.
Bitwise Operations C includes operators that permit working with the bit-level representation of a value. You can: - shift the bits of a value to the left.
Chapter-3 Operators.
Programming in JavaScript
Lesson 26 Miscellaneous Topics
CISC/CMPE320 - Prof. McLeod
CISC/CMPE320 - Prof. McLeod
CISC/CMPE320 - Prof. McLeod
CISC124 Labs start this week in JEFF 155. Fall 2018
CISC/CMPE320 - Prof. McLeod
CISC/CMPE320 - Prof. McLeod
CISC/CMPE320 - Prof. McLeod
CISC/CMPE320 - Prof. McLeod
CISC/CMPE320 - Prof. McLeod
SE1H421 Procedural Programming LECTURE 4 Operators & Conditionals (1)
Fall 2018 CISC124 2/24/2019 CISC124 Quiz 1 marking is complete. Quiz average was about 40/60 or 67%. TAs are still grading assn 1. Assn 2 due this Friday,
CISC/CMPE320 - Prof. McLeod
Programming in JavaScript
CMPE212 – Reminders The other four assignments are now posted.
Overloading functions
CISC101 Reminders All assignments are now posted.
All the Operators 6-Apr-19.
All the Operators 13-Apr-19.
Homework Finishing Chapter 2 of K&R. We will go through Chapter 3 very quickly. Not a lot is new. Questions?
Herbert G. Mayer, PSU CS Status 7/19/2015
Winter 2019 CISC101 4/28/2019 CISC101 Reminders
CISC/CMPE320 - Prof. McLeod
CISC/CMPE320 - Prof. McLeod
OPERATORS in C Programming
CISC101 Reminders Assignment 3 due today.
CMPE212 – Reminders Assignment 2 due next Friday.
OPERATORS in C Programming
Presentation transcript:

CISC/CMPE320 - Prof. McLeod Winter 2013 CISC/CMPE320 2/5/2019 CISC/CMPE320 Teams are assembled. They are listed on the project page. Let me know if you are with someone that you cannot get along with (bloodshed might result…). Fall 2018 CISC/CMPE320 - Prof. McLeod Prof. Alan McLeod

CISC/CMPE320 - Prof. McLeod Today First team meeting. Introduction to “Being Agile”. Back to C++: Finish up Operators Bitwise Operations Boolean Expressions Fall 2018 CISC/CMPE320 - Prof. McLeod

CISC/CMPE320 - Prof. McLeod First Team Meeting Introduce each other -  Exchange contact info? Present your background/experience.  Which hardware/OS do you like to use for C++ development? Has each member read over and understood the projects page?  Do you know what the deliverables are and when they are due? Pick a notetaker for this meeting. Notetaker takes attendance and records any momentous decisions – is anyone missing?  Use Confluence to record notes and link them to an issue in Jira. Or, keep separate notes on paper or on a laptop and copy them into Confluence later. Fall 2018 CISC/CMPE320 - Prof. McLeod

First Team Meeting, Cont. Discuss project ideas – negotiate? Other meeting time(s) than just the tutorial time? If you do settle on a project idea, discuss it with your TA (your mentor) to see if it is too hard/too easy and just what might be involved with implementation. Write an “executive summary” to be sent to the CEO. Start thinking about two major roles that must be filled soon: Team Manager (or “Lead”) and Primary Software Architect. Start putting in your story line so you can build your first sprint! Fall 2018 CISC/CMPE320 - Prof. McLeod

The Role of the Primary Software Architect Forms and owns the mental model of the software product. Includes the detailed specifications for all functionality. Must communicate this model to the rest of the team. Prevents deviations from the model. Must represent the user when it comes time to form tradeoffs between time to completion, cost, performance and ease of use. Like a movie director! Fall 2018 CISC/CMPE320 - Prof. McLeod

Primary Software Architect, Cont. Does not necessarily write any code (in the “real world”) – in this course he or she will have to! This job can be too demanding for one person on a very large project. So, it can be split up along very clear system boundaries. Object oriented programming languages help enable this splitting up. But all architects must agree on the overall vision. Fall 2018 CISC/CMPE320 - Prof. McLeod

Architect – Builder Interaction The code writers or “Builders” implement the architect’s vision. The architect should not decide on how the functionality is implemented – he can only suggest. This allows the builders to come up with better ideas. In CISC/CMPE320 – all team members will be code writers. Fall 2018 CISC/CMPE320 - Prof. McLeod

Project Management Role Or “Team Lead”. The primary architect will be too busy to fill a management role too. So another person should be the project manager. Like a movie producer. He or she is responsible for the implementation of the architect’s vision. Fall 2018 CISC/CMPE320 - Prof. McLeod

CISC/CMPE320 - Prof. McLeod Lots of Other Roles Chief Programmer Other Programmers, like component programmers and other specialist programmers Note-takers Archivists (Confluence, Jira, etc.) Technical Writers Illustrators Testers Accountant Public relations Researcher Interface specialist Artists Story writers Repository design and maintenance … Fall 2018 CISC/CMPE320 - Prof. McLeod

Agile Teams – Important Characteristics Small team, skilled, experienced, able to co-exist. Minimal management. Strange work hours! Coding, design, testing all at the same time. Frequent (nightly?) builds. Many short efficient meetings (SCRUMs). Absolute reliance on CASE tools. Rapid prototyping to demonstrate to client/user. Frequent input/changes from client/user who may even be a team member. Fall 2018 CISC/CMPE320 - Prof. McLeod

CISC/CMPE320 - Prof. McLeod Agile Teams, Cont. Compared to earlier, classical project teams: Smaller. Less formal. Less time spent on documentation. More effective in a shorter time – more people coding. But: When an Agile team goes wrong – they go really wrong! Results from a lack of all the formal checks and balances of a more “formal” approach. Difficult to tell when things go wrong. Little accountability. Often have to start again. Fall 2018 CISC/CMPE320 - Prof. McLeod

CISC/CMPE320 - Prof. McLeod Your Team From this: To this!: See: http://taswar.zeytinsoft.com/2011/01/25/starting-an-agile-team-to-become-the-a-team/ Fall 2018 CISC/CMPE320 - Prof. McLeod

CISC/CMPE320 - Prof. McLeod Cute Video Being Agile is Our Favourite Thing: http://www.youtube.com/watch?v=ALWHCUNU8Nw Fall 2018 CISC/CMPE320 - Prof. McLeod

CISC/CMPE320 - Prof. McLeod Operators Discussed in order of highest to lowest precedence. See: http://en.cppreference.com/w/cpp/language/operator_precedence Highest Precedence: Scope resolution (when defining only): class_name::member Or namespace_name::member Fall 2018 CISC/CMPE320 - Prof. McLeod

CISC/CMPE320 - Prof. McLeod Operators, Cont. Next Highest Precedence (level 2): Member selection . (see slide 19). Subscripting arrays: pointer[expr] ( ) when used with function calls or value constructors. Post increment or post decrement: var++ var—- Type identification: typeid(type or expr) Casts like static_cast<type>(expr) Fall 2018 CISC/CMPE320 - Prof. McLeod

CISC/CMPE320 - Prof. McLeod Aside – typeid() Used to find out the types of pointers. More useful in a function: A trivial example: int aVal = 100; int* ptr_aVal = &aVal; cout << typeid(ptr_aVal).name() << endl; Displays: Pi Fall 2018 CISC/CMPE320 - Prof. McLeod

CISC/CMPE320 - Prof. McLeod Operators, Cont. Level 3 Precedence: sizeof(type) Pre-increment and pre-decrement. Complement: ~expr Not: !expr Negation: -expr Address of and dereference (& and *) The heap operators: new, delete and delete[] C – style cast: (type)expr Fall 2018 CISC/CMPE320 - Prof. McLeod

CISC/CMPE320 - Prof. McLeod Operators, Cont. Level 4: Member selection (and dereference) -> Level 5: Multiply, Divide, Modulo: *, /, % Level 6: Add, subtract: +, - Fall 2018 CISC/CMPE320 - Prof. McLeod

CISC/CMPE320 - Prof. McLeod Operators, Cont. Level 7: Bitwise shift left: expr << expr Bitwise shift right: expr >> expr Level 8: <, <=, >, >= Level 9: ==, != Fall 2018 CISC/CMPE320 - Prof. McLeod

CISC/CMPE320 - Prof. McLeod Operators, Cont. Levels 10 to 12: Bitwise AND: expr & expr Bitwise exclusive OR (or XOR): expr ^ expr Bitwise OR: expr | expr Levels 13 and 14: Logical AND: expr && expr Logical OR: expr || expr Level 15: Conditional Expression: expr ? expr : expr AND has precedence over OR Fall 2018 CISC/CMPE320 - Prof. McLeod

Operators, Cont. (Still!) Level 16: All assignment operators: = *=, /=, %=, +=, -=, <<=, >>=, &=, |=, ^= Level 17: Throw exception: throw expr Lowest Precedence!: Comma: , Fall 2018 CISC/CMPE320 - Prof. McLeod

CISC/CMPE320 - Prof. McLeod Notes on Precedence Prefix operators (~, !, -, &, *, pre-increment and pre-decrement) and assignment operators are right associative (right to left) – all others are left-associative (left to right). So: int a = b + c + d; Means int a = (b + c) + d; But, int x = y = z; Means int x = (y = z); (Yes, the assignment operator returns something!) Fall 2018 CISC/CMPE320 - Prof. McLeod

CISC/CMPE320 - Prof. McLeod Precedence Notes, Cont. Use ( ) to control precedence. When in doubt, control precedence! If an expression gets too long, use intermediate variables to make it more readable. Fall 2018 CISC/CMPE320 - Prof. McLeod

Bit and Shift Operations These operate on all integer types and enums. Complement, ~, carries out a bitwise negation of each bit (1 becomes 0, 0 becomes 1). Binary &, | and ^: A B A&B A|B A^B 1 Fall 2018 CISC/CMPE320 - Prof. McLeod

Bit and Shift Operations, Cont. The left shift operator, <<, moves all bits in val to the left by n positions: val << n. Zeros are added to the least significant bits. This is the same as multiplying a number by 2n. Right shift, >>, moves all bits to the right. For unsigned integers zeros are added to the most significant bits – same as dividing by 2n. For signed integers, the result is not predicable as the sign bit may be duplicated. Fall 2018 CISC/CMPE320 - Prof. McLeod

Bitwise Operations, Examples Set the nth bit in a number and the rest are zeros: 1 << n To set the nth bit of any number, x, and not change the rest: x = x | 1 << n To check to see if the nth bit is set: if ((x & 1 << n) != 0)… Fall 2018 CISC/CMPE320 - Prof. McLeod

CISC/CMPE320 - Prof. McLeod Boolean Expressions We have seen the boolean operators already. Here are a few notes: Something like a < b < c will compile and run, but may not produce the desired result. Better to use: a < b && b < c Remember that & and | are bitwise operators, not logical ones. Fall 2018 CISC/CMPE320 - Prof. McLeod

Boolean Expressions, Cont. The && and || logical operators use “short circuit evaluation”: For && if the LHS is false then the RHS is not evaluated. For || if the LHS is true then the RHS is not evaluated. (Same as in Java.) Fall 2018 CISC/CMPE320 - Prof. McLeod

Boolean Expressions, Cont. Non zero integers are treated as being true, and zero is treated as being false. (Ouch!) So, you can use logical operators, && || and !, with integers. For example, the code: int x = 10; if (x) is the same as: if (x != 0) Fall 2018 CISC/CMPE320 - Prof. McLeod

Boolean Expressions, Cont. Also, this is legal syntax: if (x = 10) The assignment operator returns the value being assigned, which in this case is a true! But suppose x is 12 and you really meant to type ==… Ouch, again! Fall 2018 CISC/CMPE320 - Prof. McLeod

Boolean Expressions, Cont. See TestStuff.cpp. Applying ! to a non-zero integer returns false or zero. An if statement will treat a pointer by itself as an integer – it will be true unless it is nullptr. You can also test assignment statements since the assignment operator returns the value being assigned. Fall 2018 CISC/CMPE320 - Prof. McLeod