Day in Programmer`s LifeSession #6MuhamadHesham
AgendaState vs Strategy
Day in Programmer Life
GOF visit
Project DescriptionPattern’s ChallengeAre they Twin patterns?What are the differences between State and Strategy Pattern?
Our Target GameLearning through Game ProgrammingWhy Game Programming ?1.Fun& Interesting2.Resourceintensive software3.Interactions till death4.Coding non-stopOOD & Design patterns in action
Our Target GamePlatformer SkeletonMain Actors  Level
 Player
 Enemy
 GemCall for new requirementOnce the player collects a gem I want:Enemy increases its speed.Other gems change its color to a random color.
First try for implementation1. We need find the place in code where the gem is tested for being collected.2. We need modify enemy speed.3. We need modify gem color.
1. We expose private members to the public.2. We are dependant on certain members.3. Each time we need modifythe level code.Without correct patternOur code smells bad!
Call for new requirementOnce the player die I want:Enemies speed is reset.Other gems change its color to black.
Call for new requirementEach level can be in one of two styles:PharonicAztecFirst level is Aztec.Second and third levels are Pharonic.
First try for implementation1. We need find where we decide which image we load.2. Categorize images to 2 sets, Pharonic an Aztec.
Each time we add a new theme we add piles of if-elsestatements.Our class do more than its job (SCSR).Without correct patternOur code smells bad!
Call for new requirementMy nephew has another opinionFirst level is Pharonic.Second level is AztecThird levelis random.
Call for new requirementI want the enemy turn crazy when you collect a gem.If you touch the enemy while it is crazy, you die and it turns idle again.Increase crazy enemy speed by 4 times.
First try for implementationWhat do you think we need do this time ?
Violates Open Closed Principle.Further additions will cause bugs.State transitions are buried between if-else.Without correct patternOur code smells bad!
Original Enemy State Machinereach cliffafter a whileRunningIdle
Updated Enemy State Machinereach cliffafter a whileRunningIdlegem collectedgem collectedplayer diedCrazy
Call for new requirementI want …Go to HELL !!!

More Related Content

PPT
The Programmer Life Cycle
PPTX
Design Patterns- Course for students .pptx
PDF
Educational Game Design Thesis
PPTX
Application of SDP
PPTX
Design Patterns Summer Course 2010-2011 - Session#1
PPTX
Software Engineer- A unity 3d Game
PDF
Design Patterns Summer Course 2009-2010 - Session#1
PPTX
03 fsm how_toimplementai_state_20161006_jintaeks
The Programmer Life Cycle
Design Patterns- Course for students .pptx
Educational Game Design Thesis
Application of SDP
Design Patterns Summer Course 2010-2011 - Session#1
Software Engineer- A unity 3d Game
Design Patterns Summer Course 2009-2010 - Session#1
03 fsm how_toimplementai_state_20161006_jintaeks

Similar to Design Patterns Summer Course 2010-2011 - Session#2 (20)

PDF
Design Patterns Summer Course 2009-2010 - Session#2
PDF
Controlling Project Size for Student/Hobby Videogame Development
PDF
Game Production
PDF
Practical level design for F2P
PDF
Game Programming 01 - Introduction
PDF
Game design document template for serious games
PPT
Game designdocs
PDF
Game Design for Modern Times
PPT
BiowareDesignDoc.ppt
KEY
No Show 2012 - Heather Decker-Davis and Luke Dicken - Procedural Processes
PDF
All Work And No Play: What You can Learn from Game Design
PPTX
Evolution Explosion - Final Year Project Presentation
PDF
C Game Programming New Book Learn C From Scratch And Start Build Your Very Ow...
PPT
Game designdocs
PPTX
Gaming Design for Beginners_Document.pptx
PDF
Creative Engineering 101
PDF
Design Patterns in Game Programming
PDF
Compiler Case Study - Design Patterns in C#
PDF
Story behind PF 2016
PPTX
LAFS Game Design 6 - Conceptualization
Design Patterns Summer Course 2009-2010 - Session#2
Controlling Project Size for Student/Hobby Videogame Development
Game Production
Practical level design for F2P
Game Programming 01 - Introduction
Game design document template for serious games
Game designdocs
Game Design for Modern Times
BiowareDesignDoc.ppt
No Show 2012 - Heather Decker-Davis and Luke Dicken - Procedural Processes
All Work And No Play: What You can Learn from Game Design
Evolution Explosion - Final Year Project Presentation
C Game Programming New Book Learn C From Scratch And Start Build Your Very Ow...
Game designdocs
Gaming Design for Beginners_Document.pptx
Creative Engineering 101
Design Patterns in Game Programming
Compiler Case Study - Design Patterns in C#
Story behind PF 2016
LAFS Game Design 6 - Conceptualization
Ad

Recently uploaded (20)

PDF
FOISHS ANNUAL IMPLEMENTATION PLAN 2025.pdf
PDF
Practical Manual AGRO-233 Principles and Practices of Natural Farming
PDF
Vision Prelims GS PYQ Analysis 2011-2022 www.upscpdf.com.pdf
PDF
Complications of Minimal Access-Surgery.pdf
PDF
BP 704 T. NOVEL DRUG DELIVERY SYSTEMS (UNIT 2).pdf
PPTX
Chinmaya Tiranga Azadi Quiz (Class 7-8 )
PDF
FORM 1 BIOLOGY MIND MAPS and their schemes
DOC
Soft-furnishing-By-Architect-A.F.M.Mohiuddin-Akhand.doc
PPTX
A powerpoint presentation on the Revised K-10 Science Shaping Paper
PDF
ChatGPT for Dummies - Pam Baker Ccesa007.pdf
PDF
My India Quiz Book_20210205121199924.pdf
PDF
What if we spent less time fighting change, and more time building what’s rig...
PDF
Uderstanding digital marketing and marketing stratergie for engaging the digi...
PDF
OBE - B.A.(HON'S) IN INTERIOR ARCHITECTURE -Ar.MOHIUDDIN.pdf
PPTX
ELIAS-SEZIURE AND EPilepsy semmioan session.pptx
PPTX
B.Sc. DS Unit 2 Software Engineering.pptx
PDF
advance database management system book.pdf
PPTX
TNA_Presentation-1-Final(SAVE)) (1).pptx
PPTX
20th Century Theater, Methods, History.pptx
PDF
Weekly quiz Compilation Jan -July 25.pdf
FOISHS ANNUAL IMPLEMENTATION PLAN 2025.pdf
Practical Manual AGRO-233 Principles and Practices of Natural Farming
Vision Prelims GS PYQ Analysis 2011-2022 www.upscpdf.com.pdf
Complications of Minimal Access-Surgery.pdf
BP 704 T. NOVEL DRUG DELIVERY SYSTEMS (UNIT 2).pdf
Chinmaya Tiranga Azadi Quiz (Class 7-8 )
FORM 1 BIOLOGY MIND MAPS and their schemes
Soft-furnishing-By-Architect-A.F.M.Mohiuddin-Akhand.doc
A powerpoint presentation on the Revised K-10 Science Shaping Paper
ChatGPT for Dummies - Pam Baker Ccesa007.pdf
My India Quiz Book_20210205121199924.pdf
What if we spent less time fighting change, and more time building what’s rig...
Uderstanding digital marketing and marketing stratergie for engaging the digi...
OBE - B.A.(HON'S) IN INTERIOR ARCHITECTURE -Ar.MOHIUDDIN.pdf
ELIAS-SEZIURE AND EPilepsy semmioan session.pptx
B.Sc. DS Unit 2 Software Engineering.pptx
advance database management system book.pdf
TNA_Presentation-1-Final(SAVE)) (1).pptx
20th Century Theater, Methods, History.pptx
Weekly quiz Compilation Jan -July 25.pdf
Ad

Design Patterns Summer Course 2010-2011 - Session#2