Chapter 3.4 Programming Fundamentals. 2 Data Structures Arrays – Elements are adjacent in memory (great cache consistency) – They never grow or get reallocated.

Slides:



Advertisements
Similar presentations
Data Structures.
Advertisements

4. Object-Oriented Programming Procedural programming Structs and objects Object-oriented programming Concepts and terminology Related keywords.
Lecture 10: Part 1: OO Issues CS 540 George Mason University.
Design Patterns Pepper. Find Patterns Gang of Four created 23 Siemens published another good set x
Solutions to Review Questions. 4.1 Define object, class and instance. The UML Glossary gives these definitions: Object: an instance of a class. Class:
Ch 12: Object-Oriented Analysis
CSCE 590E Spring 2007 Game Programming By Jijun Tang.
1 Software Testing and Quality Assurance Lecture 12 - The Testing Perspective (Chapter 2, A Practical Guide to Testing Object-Oriented Software)
Reza Gorgan Mohammadi AmirKabir University of Technology, Department of Computer Engineering & Information Technology Advanced design.
Observer Pattern Tu Nguyen. General Purpose When one object changes state, all the dependent objects are notified and updated. Allows for consistency.
Chapter 3.3 Programming Fundamentals Languages Paradigms Basic Data Types Data Structures OO in Game Design Component Systems Design Patterns.
Irwin/McGraw-Hill Copyright © 2004 The McGraw-Hill Companies. All Rights reserved Whitten Bentley DittmanSYSTEMS ANALYSIS AND DESIGN METHODS6th Edition.
Page 1 Processes and Threads Chapter Processes 2.2 Threads 2.3 Interprocess communication 2.4 Classical IPC problems 2.5 Scheduling.
Chapter 3.7 Memory and I/O Systems. 2 Memory Management Only applies to languages with explicit memory management (C or C++) Memory problems are one of.
Chapter 10 Class and Method Design
Chapter 3.6 Game Architecture. 2 Overall Architecture The code for modern games is highly complex With code bases exceeding a million lines of code, a.
ECE 355 Design Patterns Tutorial Part 2 (based on slides by Ali Razavi) Presented by Igor Ivković
Slide 1 Chapter 10 Class and Method Design. Slide 2 REVISITING THE BASIC CHARACTERISTICS OF OBJECT-ORIENTATION.
Chapter 26 Applying Gang of Four Design Patterns 1CS6359 Fall 2012 John Cole.
Chapter 14: Object-Oriented Data Modeling
Behavioral Patterns  Behavioral patterns are patterns whose purpose is to facilitate the work of algorithmic calculations and communication between classes.
Design Patterns.
OBJECT AND CLASES: THE BASIC CONCEPTS Pertemuan 8 Matakuliah: Konsep object-oriented Tahun: 2009.
JIT in webkit. What’s JIT See time_compilation for more info. time_compilation.
Abstract Factory Design Pattern making abstract things.
Chapter 26 GoF Design Patterns. The Adapter Design Pattern.
CSCE 552 Spring 2009 Programming Fundamentals By Jijun Tang.
Design Pattern. The Observer Pattern The Observer Pattern defines a one-to-many dependency between objects so that when one object changes state, all.
Chapter 3.5 Memory and I/O Systems. 2 Memory Management Memory problems are one of the leading causes of bugs in programs (60-80%) MUCH worse in languages.
1/20/03A2-1 CS494 Interfaces and Collection in Java.
Chapter 8 Analysis & Modeling. Data Modeling examines data objects independently of processing focuses attention on the data domain creates a model at.
Slide 1 Systems Analysis and Design with UML Version 2.0, Second Edition Alan Dennis, Barbara Haley Wixom, and David Tegarden Chapter 10: Class and Method.
Object Oriented Design David Talby. Welcome! n Introduction n UML u Use Case Diagrams u Interaction Diagrams u Class Diagrams n Design Patterns u Composite.
July 28, 2015IAT 2651 Design Patterns. “Gang of Four” July 28, 2015IAT 2652.
Standard Template Library The Standard Template Library was recently added to standard C++. –The STL contains generic template classes. –The STL permits.
Learners Support Publications Object Oriented Programming.
DESIGN PATTERNS COMMONLY USED PATTERNS What is a design pattern ? Defining certain rules to tackle a particular kind of problem in software development.
Behavioral Patterns CSE301 University of Sunderland Harry R Erwin, PhD.
Sadegh Aliakbary. Copyright ©2014 JAVACUP.IRJAVACUP.IR All rights reserved. Redistribution of JAVACUP contents is not prohibited if JAVACUP.
Gang of Four Patterns 23 total 15 useful How are they different from GRASP Patterns?
Manali Joshi1 The Observer Design Pattern Presented By: Manali Joshi.
Design Patterns Software Engineering CS 561. Last Time Introduced design patterns Abstraction-Occurrence General Hierarchy Player-Role.
Implementation Highlights Mike Miller Yale University.
CSCE 552 Fall 2012 Language and Programming By Jijun Tang.
CS 210 Proxy Pattern Nov 16 th, RMI – A quick review A simple, easy to understand tutorial is located here:
PowerPoint Presentation for Dennis, Wixom, & Tegarden Systems Analysis and Design with UML, 3rd Edition Copyright © 2009 John Wiley & Sons, Inc. All rights.
CSCE , SPRING 2016 INSTRUCTOR: DR. NANCY M. AMATO 1.
CLASSIFICATION OF DESIGN PATTERNS Hladchuk Maksym.
Java Programming: Guided Learning with Early Objects Chapter 9 Inheritance and Polymorphism.
CH 1-4 : INTRODUCTION ACKNOWLEDGEMENT: THE SLIDES ARE PREPARED FROM SLIDES PROVIDED WITH DATA STRUCTURES AND ALGORITHMS IN C++, GOODRICH, TAMASSIA AND.
Language and Programming
Game Architecture Rabin is a good overview of everything to do with Games A lot of these slides come from the 1st edition CS 4455.
CS 215 Final Review Ismail abumuhfouz Fall 2014.
Chapter 10 Design Patterns.
Observer Design Pattern
Chapter 8 Analysis & Modeling
Presented by Igor Ivković
Advanced Programming Behnam Hatami Fall 2017.
Lec 3: Object-Oriented Data Modeling
Frameworks And Patterns
Introduction to Data Structure
Chapter 2 Processes and Threads 2.1 Processes 2.2 Threads
Object Oriented Design
Presented by Igor Ivković
Chapter 11 Class Inheritance
Chapter 8 - Design Strategies
The Object Paradigm Classes – Templates for creating objects
Systems Analysis and Design with UML Version 2.0, Second Edition
Jim Fawcett CSE687 – Object Oriented Design Spring 2015
GoF Patterns Ch. 26.
Presentation transcript:

Chapter 3.4 Programming Fundamentals

2 Data Structures Arrays – Elements are adjacent in memory (great cache consistency) – They never grow or get reallocated – In C++ there's no check for going out of bounds – Inserting and deleting elements in the middle is expensive

3 Data Structures Linked lists – Very cheap to add/remove elements. – Available in the STL (std::list) – Every element is allocated separately Lots of little allocations – Not placed contiguously in memory

4 Data Structures Dictionaries – Maps a set of keys to some data. – std::map, std::hash, etc – Very fast access to data – Perfect for mapping IDs to pointers, or resource handles to objects

5 Data Structures Stacks – First in, last out – std::stack adaptor in STL Queues – First in, first out – std::deque

6 Data Structures Bit packing – Fold all necessary data into a smaller number of bits – Very useful for storing boolean flags (pack 32 in a double word) – Possible to apply to numerical values if we can give up range or accuracy – Very low level trick Only use when absolutely necessary

7 Object Oriented Design Concepts – Class Abstract specification of a data type – Instance A region of memory with associated semantics to store all the data members of a class – Object Another name for an instance of a class

8 Object Oriented Design Inheritance – Models “is-a” relationship – Extends behavior of existing classes by making minor changes

9 Object Oriented Design Inheritance – UML diagram representing inheritance

10 Object Oriented Design Polymorphism – The ability to refer to an object through a reference (or pointer) of the type of a parent class – Key concept of object oriented design

11 Object Oriented Design Multiple Inheritance – Allows a class to have more than one base class – Derived class adopts characteristics of all parent classes – Huge potential for problems (clashes, casting, etc) – Multiple inheritance of abstract interfaces is much less error prone

12 Component Systems Limitations of inheritance – Tight coupling – Unclear flow of control – Not flexible enough – Static hierarchy

13 Component Systems Component system organization – Use aggregation (composition) instead of inheritance – A game entity can “own” multiple components that determine its behavior – Each component can execute whenever the entity is updated – Messages can be passed between components and to other entities

14 Component Systems Component system organization

15 Component Systems Data-Driven Composition – The structure of the game entities can be specified in data – Components are created and loaded at runtime – Very easy to change (which is very important in game development)

16 Component Systems Analysis – Very hard to debug – Performance can be a bottleneck – Keeping code and data synchronized can be a challenge – Extremely flexible Great for experimentation and varied gameplay – Not very useful if problem/game is very well known ahead of time

17 Design Patterns Singleton – Implements a single instance of a class with global point of creation and access – Don't overuse it!!!

18 Design Patterns Object Factory – Creates objects by name – Pluggable factory allows for new object types to be registered at runtime – Extremely useful in game development for creating new objects, loading games, or instantiating new content after game ships

19 Design Patterns Object factory

20 Design Patterns Observer – Allows objects to be notified of specific events with minimal coupling to the source of the event – Two parts subject and observer

21 Design Patterns Observer

22 Design Patterns Composite – Allow a group of objects to be treated as a single object – Very useful for GUI elements, hierarchical objects, inventory systems, etc

23 Design Patterns Composite