Object Classes: Notes on designing Shopping Cart

Similar documents
The WebShop E-Commerce Framework

OOP Design Handout written by Nick Parlante

Software Design. Software Design. Software design is the process that adds implementation details to the requirements.

Java: Learning to Program with Robots. Chapter 11: Building Quality Software

RARITAN VALLEY COMMUNITY COLLEGE ACADEMIC COURSE OUTLINE. CISY 105 Foundations of Computer Science

Entrematic E-commerce

ATM Case Study Part 1

How To Design Software

Case Study: Design and Implementation of an Ordering system using UML, Formal specification and Java Builder

Software Engineering. System Models. Based on Software Engineering, 7 th Edition by Ian Sommerville

CS 111 Classes I 1. Software Organization View to this point:

AP Computer Science File Input with Scanner

Masters programmes in Computer Science and Information Systems. Object-Oriented Design and Programming. Sample module entry test xxth December 2013

Web Application Development Using UML

The WebShop e-commerce framework

Summit Public Schools Summit, New Jersey Grade Level / Content Area: Mathematics Length of Course: 1 Academic Year Curriculum: AP Computer Science A

Morris School District. AP Computer Science A Curriculum Grades 9-12

How To Teach Object Oriented Programming At An Introductory Level Course

Foundations of Programming

Contents. 9-1 Copyright (c) N. Afshartous

Computer Science III Advanced Placement G/T [AP Computer Science A] Syllabus

Java Programming (10155)

Questions? Assignment. Techniques for Gathering Requirements. Gathering and Analysing Requirements

Shopping: Week 1 of 2

AP Computer Science A - Syllabus Overview of AP Computer Science A Computer Facilities

Course Description. Prerequisites. CS-119/119L, Section 0137/0138 Course Syllabus Program Design & Development - Fall 2015

Java Classes. GEEN163 Introduction to Computer Programming

CHESHIRE PUBLIC SCHOOLS SUBJECT AREA SUMMARY SHEETS MUSIC

Management Information Systems 260 Web Programming Fall 2006 (CRN: 42459)

Free Java textbook available online. Introduction to the Java programming language. Compilation. A simple java program

Free Java textbook available online. Introduction to the Java programming language. Compilation. A simple java program

11 November

CHESHIRE PUBLIC SCHOOLS SUBJECT AREA SUMMARY SHEETS MUSIC

The C Programming Language course syllabus associate level

Programming and Software Development CTAG Alignments

Greetings Keyboard Mastery Keyboarding Students! Teacher: Mrs. Wright

University of Washington, Tacoma TCSS 360 (Software Development and Quality Assurance Techniques), Spring 2005 Handout 1: Course Syllabus

CompuScholar, Inc. Alignment to Utah's Computer Programming II Standards

Follett Punch-out Catalog Business Process & Helpful Tips

The stock market: How it works

Course Syllabus. COSC 1437 Programming Fundamentals II. Revision Date: August 21, 2013

Object-oriented design methodologies

Java Application Developer Certificate Program Competencies

More on Objects and Classes

How To Create A Diagram On Rational Software Development Platform

Student Program Information 2014

Electronic Healthcare Design and Development

Object-Oriented Design Guidelines

COMPUTER INFORMATION SYSTEMS (CIS)

Sequence Diagrams. Massimo Felici. Massimo Felici Sequence Diagrams c

Programming Languages CIS 443

How To Teach C++ Data Structure Programming

Software Architecture Document

FIDDLIN WITH FRACTIONS

Computer Science. 232 Computer Science. Degrees and Certificates Awarded. A.S. Degree Requirements. Program Student Outcomes. Department Offices

AP Computer Science Java Subset

CSE 203 Web Programming 1. Prepared by: Asst. Prof. Dr. Maryam Eskandari

Financial Management System

Advanced Placement Psychology Course description

Web Design Syllabus. Mr. Calabrese. Room Phone: x5550

AP Psychology Course Syllabus and Survival Guide

7 th Grade Integer Arithmetic 7-Day Unit Plan by Brian M. Fischer Lackawanna Middle/High School

CSE 1020 Introduction to Computer Science I A sample nal exam

Software Specification and Architecture 2IW80

Topics. Introduction. Java History CS 146. Introduction to Programming and Algorithms Module 1. Module Objectives

The Online Grade Book A Case Study in Learning about Object-Oriented Database Technology

Java (12 Weeks) Introduction to Java Programming Language

Online Student Orientation

Rational Software White Paper

What ninth grade classes will help me reach my long-term educational and career goals? MATERIALS

Shelly, G. B., & Campbell, J. T. (2012). Web design: Introductory (4th ed.). Boston, MA: Course Technology.

Part I. Multiple Choice Questions (2 points each):

CMSC Fundamentals of Computer Programming II (C++)

CSCI 528: OBJECT ORIENTED PROGRAMMING, Fall 2015

Design and UML Class Diagrams. Suggested reading: Practical UML: A hands on introduction for developers

Creating Database Tables in Microsoft SQL Server

Manual - Schlatter E-Shop

Lesson 5: Renting vs. Buying Home Sweet Home

Graduate Assessment Test (Sample)

Introduction to Programming System Design. CSCI 455x (4 Units)

CS 51 Intro to CS. Art Lee. September 2, 2014

Lesson # 5A Workshop: Complex Networks and Graphs (Adapted from Teaching Engineering s It s a Connected World )

AP Computer Science AB Syllabus 1

Notes on Plagiarism: An Electrical Engineering and Computer Science Perspective

Information systems modelling UML and service description languages

CENTRAL TEXAS COLLEGE SYLLABUS FOR MUSI 1306 MUSIC APPRECIATION. Semester Hours Credit: 3

COURSE OUTLINE. Prerequisites: Course Description:

Basic academic skills (1) (2) (4) Specialized knowledge and literacy (3) Ability to continually improve own strengths Problem setting (4) Hypothesis

ITLP - Illinois Textbook Loan Program

Computer. Course Description

Transcription:

Object Classes: Notes on designing Shopping Cart Additions for Garfield HS AP CS to supplement: Building Java Programs, by Stuart Reges and Marty Stepp (http://www.buildingjavaprograms.com/ ). (March 2013, Mr. Bergquist)

Write down your thoughts First let s look at the Shopping Cart Project you will be writing four Classes that interact. Take about 5 minutes to answer the following questions: What is the point of object oriented programming? Discuss 3-4 concepts you have learned that will apply to the Shopping Cart assignment 2

NullPointerException Before a variable of an object type is initialized with new, it holds a reference to null (nothing!) Calling a method on null gives a NullPointerException Make sure to initialize fields in your constructor 2 phase creation public class Student { private ArrayList<Integer> grades; // phase 1 } public Student() { // Student Constructor grades = new ArrayList<Integer>(); // phase 2 }... 3

Reference to an Object Variables don t directly hold objects, they hold the memory address of objects. 4

Object-Oriented Design Design is critical in OOD and key to success; take the time to structure your design (i.e. draw & think it out!) Think first what are the nouns in the specification? (ex: Item) These are likely your Objects or possibly key data in an object. Which responsibilities belong to which nouns? These are likely to become their methods. What are the relationships between nouns (Objects)? Draw it out that will help you visualize how they are interconnected. 5

Objects Composed of Objects You will find that several Objects have a Has-a relationship An ItemOrder has an Item (one to one relationship) A ShoppingCart has many ItemOrders (one to many relationship) Put in an UML Diagram: Unified Modeling Language http://en.wikipedia.org/wiki/unified_modeling_language 6

Top Down Design Shopping Cart d: itemorderlist d: discount one to many Catalog d: name d: itemlist one to many m: add (itemorder) m: setdiscount (value) m: gettotal() Item Order d: item d: quantity Item Order d: item m: getprice() d: quantity Item Order m: getitem() d: item m: getprice() d: quantity m: getitem() m: getprice() m: getitem() one to one m: add(item) m: size() m: get(index) m: getname() Item d: name Item d: price d: name Item d: bulkquantity d: price d: name d: bulkprice d: bulkquantity d: price d: bulkprice d: bulkquantity m: pricefor(quant) d: bulkprice m: tostring() m: pricefor(quant) m: tostring() m: pricefor(quant) m: tostring() 7

Bottom Up Implementation Write the simplest classes without dependencies first the lowest level. Which is that for Shopping Cart? Test each new Object with a Client test to make sure it works. You are required to turn in ShoppingTest.java Link these simple system pieces to the next level up, larger Object subsystems, and keep building upward. Test at each level to make sure you re not building off a bad foundation mistakes could cause: take more time finding where the error lies (what level??) you to need to fix more code at multiple levels 8

Additional Help? Any new questions about the Shopping Cart Project? Reminder do not collaborate working with classmates on the project I want you to solve this. Only talk in concepts not code. RESOURCES: Class Presentations & Lesson handouts Class Object Concepts & Vocabulary Sheet http://www.garfieldcs.com/wordpress/wordpress/wp-content/uploads/2013/02/class-objects-vocabulary-2013.pdf Object Class Review Slides http://www.garfieldcs.com/wordpress/wordpress/wp-content/uploads/2012/02/2012-feb-27-object-class-review.pdf Java Syntax Sheet (now with ArrayList Details) http://www.garfieldcs.com/wordpress/wordpress/wp-content/uploads/2013/03/ap-cs-java-syntax-summary-5.pdf 9

More Resources Textbook, chapters 8: Objects and 10: ArrayLists Supplemental Videos (see our class website for links) Defining a Class Constructors Advanced Instance Methods Encapsulation Removing from an ArrayList Adding to an ArrayList of Integers Ask Mr. Bergquist! Best of luck on the project! 10