SlideShare uma empresa Scribd logo
1 de 20
Baixar para ler offline
Object-Oriented ActionScript 3.0
                          Peter Elst
 4th-6th June 2008
 Edinburgh, Scotland
Object-Oriented Programming

■    Difficult
■    Scary
■    Overhead
■    Only for large teams




4th-6th June 2008
Edinburgh, Scotland
Object-Oriented Programming

■    Difficult? Structured code
■    Scary
■    Overhead
■    Only for large teams




4th-6th June 2008
Edinburgh, Scotland
Object-Oriented Programming

■    Difficult? Structured code
■    Scary? Initial learning curve
■    Overhead
■    Only for large teams




4th-6th June 2008
Edinburgh, Scotland
Object-Oriented Programming

■    Difficult? Structured code
■    Scary? Initial learning curve
■    Overhead? Promotes code reuse
■    Only for large teams




4th-6th June 2008
Edinburgh, Scotland
Object-Oriented Programming

■    Difficult? Structured code
■    Scary? Initial learning curve
■    Overhead? Promotes code reuse
■    Only for large teams? Useful for anyone




4th-6th June 2008
Edinburgh, Scotland
Classes               (the artist formerly known as prototype)


■ The way things were:
        function Conference() {
          this.name = quot;Flashforwardquot;;
        }

        Conference.prototype.getName = function() {
          trace(quot;conference name: quot;+this.name);
        }

        var myConference = new Conference();
        myConference.getName();


4th-6th June 2008
Edinburgh, Scotland
Classes               (the artist formerly known as prototype)


■ The way things are:
        package {
          public class Conference {
            public var name:String = quot;Flashforwardquot;;

                public function getName():void {
                  trace(quot;conference name: quot;+this.name);
                }
            }
        }



4th-6th June 2008
Edinburgh, Scotland
Instances

■ Classes provide a blueprint
■ Instances set their values for properties




4th-6th June 2008
Edinburgh, Scotland
Inheritance            (getting rich the easy way)


■ Classes can extend each-other
■ Avoids code duplication
■ Properties and methods can be overridden
         package {
           public class SuperClass extends BaseClass {
             public function SuperClass() {
               super();
             }
           }
         }

4th-6th June 2008
Edinburgh, Scotland
Inheritance vs composition

■ Inheritance deals with an is a relationship
■ Composition is used for has a relationships

    Employee is a Person
    Employee has a Job




4th-6th June 2008
Edinburgh, Scotland
Encapsulation               (don't touch my stuff)


■ Protect the inner workings of your code
  through the use of access modifiers
■ Provide an API for other classes to use by
  providing getter/setter methods

    public - anything can access this
    private - only the class itself can access
    protected - class and its subclasses can access
    internal (default) - all classes in the same class package

4th-6th June 2008
Edinburgh, Scotland
Polymorphism              (copycat behavior)


■ Have classes use the same method names
■ Allows classes to be swapped at runtime
■ Same name but different implementation

    Doctor.work()
    Fireman.work()
    WebDeveloper.work()



4th-6th June 2008
Edinburgh, Scotland
Interfaces            (sign on the dotted line)


■ Classes can use one or more interfaces
■ Interfaces require a class to implement a
  specific set of methods
■ Used to formalize polymorphism
■ Interfaces can extend each-other




4th-6th June 2008
Edinburgh, Scotland
Design Patterns
 General solutions to common problems




4th-6th June 2008
Edinburgh, Scotland
Observer pattern

■ Problem: notify other classes when an
  update occurs in a data model

■ Solution: keep an array of all instances that
  want to be notified and call their update
  method then the model has changed



4th-6th June 2008
Edinburgh, Scotland
Singleton pattern

■ Problem: allow only one instance of a class
  to exist in an application

■ Solution: prevent the constructor from being
  called outside of the class scope and provide
  a static method for returning the single class
  instance


4th-6th June 2008
Edinburgh, Scotland
Want to learn more?

Books
■ Object-Oriented ActionScript 3.0
■ Essential ActionScript 3.0

Course
■ Core ActionScript 3.0 (Skills Matter - London)


4th-6th June 2008
Edinburgh, Scotland
Thanks!


4th-6th June 2008
Edinburgh, Scotland
Get in touch!

  Peter Elst
  Flash Platform Consultant


  Blog: www.peterelst.com
  Email: training@peterelst.com
  LinkedIn: www.linkedin.com/in/peterelst
  Twitter: www.twitter.com/peterelst




4th-6th June 2008
Edinburgh, Scotland

Mais conteúdo relacionado

Semelhante a Object-Oriented ActionScript 3.0

3java Advanced Oop
3java Advanced Oop3java Advanced Oop
3java Advanced OopAdil Jafri
 
A Template-Based Approach for Annotating Long-Tailed Datasets
A Template-Based Approach for Annotating Long-Tailed DatasetsA Template-Based Approach for Annotating Long-Tailed Datasets
A Template-Based Approach for Annotating Long-Tailed Datasetsdgarijo
 
Framework prototype
Framework prototypeFramework prototype
Framework prototypeDevMix
 
Framework prototype
Framework prototypeFramework prototype
Framework prototypeDevMix
 
Framework prototype
Framework prototypeFramework prototype
Framework prototypeDevMix
 
Avoiding Over Design and Under Design
Avoiding Over Design and Under DesignAvoiding Over Design and Under Design
Avoiding Over Design and Under DesignTechWell
 
Introduction to Ecmascript - ES6
Introduction to Ecmascript - ES6Introduction to Ecmascript - ES6
Introduction to Ecmascript - ES6Nilesh Jayanandana
 
java object oriented programming.pdf
java object oriented programming.pdfjava object oriented programming.pdf
java object oriented programming.pdf79TarannumMulla
 
FFW Gabrovo PMG - PHP OOP Part 3
FFW Gabrovo PMG - PHP OOP Part 3FFW Gabrovo PMG - PHP OOP Part 3
FFW Gabrovo PMG - PHP OOP Part 3Toni Kolev
 
03 Java Language And OOP Part III
03 Java Language And OOP Part III03 Java Language And OOP Part III
03 Java Language And OOP Part IIIHari Christian
 
Pi j3.1 inheritance
Pi j3.1 inheritancePi j3.1 inheritance
Pi j3.1 inheritancemcollison
 
Take the Plunge with OOP from #pnwphp
Take the Plunge with OOP from #pnwphpTake the Plunge with OOP from #pnwphp
Take the Plunge with OOP from #pnwphpAlena Holligan
 
Java Course 9: Networking and Reflection
Java Course 9: Networking and ReflectionJava Course 9: Networking and Reflection
Java Course 9: Networking and ReflectionAnton Keks
 
OOPs Concepts - Android Programming
OOPs Concepts - Android ProgrammingOOPs Concepts - Android Programming
OOPs Concepts - Android ProgrammingPurvik Rana
 
02-OOP with Java.ppt
02-OOP with Java.ppt02-OOP with Java.ppt
02-OOP with Java.pptEmanAsem4
 
Corejava Training in Bangalore Tutorial
Corejava Training in Bangalore TutorialCorejava Training in Bangalore Tutorial
Corejava Training in Bangalore Tutorialrajkamaltibacademy
 

Semelhante a Object-Oriented ActionScript 3.0 (20)

Java for beginners
Java for beginnersJava for beginners
Java for beginners
 
3java Advanced Oop
3java Advanced Oop3java Advanced Oop
3java Advanced Oop
 
A Template-Based Approach for Annotating Long-Tailed Datasets
A Template-Based Approach for Annotating Long-Tailed DatasetsA Template-Based Approach for Annotating Long-Tailed Datasets
A Template-Based Approach for Annotating Long-Tailed Datasets
 
Framework prototype
Framework prototypeFramework prototype
Framework prototype
 
Framework prototype
Framework prototypeFramework prototype
Framework prototype
 
Framework prototype
Framework prototypeFramework prototype
Framework prototype
 
Avoiding Over Design and Under Design
Avoiding Over Design and Under DesignAvoiding Over Design and Under Design
Avoiding Over Design and Under Design
 
Introduction to Ecmascript - ES6
Introduction to Ecmascript - ES6Introduction to Ecmascript - ES6
Introduction to Ecmascript - ES6
 
Java 7: Quo vadis?
Java 7: Quo vadis?Java 7: Quo vadis?
Java 7: Quo vadis?
 
java object oriented programming.pdf
java object oriented programming.pdfjava object oriented programming.pdf
java object oriented programming.pdf
 
FFW Gabrovo PMG - PHP OOP Part 3
FFW Gabrovo PMG - PHP OOP Part 3FFW Gabrovo PMG - PHP OOP Part 3
FFW Gabrovo PMG - PHP OOP Part 3
 
03 Java Language And OOP Part III
03 Java Language And OOP Part III03 Java Language And OOP Part III
03 Java Language And OOP Part III
 
Pi j3.1 inheritance
Pi j3.1 inheritancePi j3.1 inheritance
Pi j3.1 inheritance
 
Take the Plunge with OOP from #pnwphp
Take the Plunge with OOP from #pnwphpTake the Plunge with OOP from #pnwphp
Take the Plunge with OOP from #pnwphp
 
Php oop presentation
Php   oop presentationPhp   oop presentation
Php oop presentation
 
Java Course 9: Networking and Reflection
Java Course 9: Networking and ReflectionJava Course 9: Networking and Reflection
Java Course 9: Networking and Reflection
 
OOPs Concepts - Android Programming
OOPs Concepts - Android ProgrammingOOPs Concepts - Android Programming
OOPs Concepts - Android Programming
 
02-OOP with Java.ppt
02-OOP with Java.ppt02-OOP with Java.ppt
02-OOP with Java.ppt
 
OOP in PHP
OOP in PHPOOP in PHP
OOP in PHP
 
Corejava Training in Bangalore Tutorial
Corejava Training in Bangalore TutorialCorejava Training in Bangalore Tutorial
Corejava Training in Bangalore Tutorial
 

Mais de Peter Elst

P2P on the local network
P2P on the local networkP2P on the local network
P2P on the local networkPeter Elst
 
P2P with Flash Player 10.1
P2P with Flash Player 10.1P2P with Flash Player 10.1
P2P with Flash Player 10.1Peter Elst
 
Big boys and their litl toys
Big boys and their litl toysBig boys and their litl toys
Big boys and their litl toysPeter Elst
 
Yes, you can do that with AIR 2.0
Yes, you can do that with AIR 2.0Yes, you can do that with AIR 2.0
Yes, you can do that with AIR 2.0Peter Elst
 
FATC - AIR 2.0 workshop
FATC - AIR 2.0 workshopFATC - AIR 2.0 workshop
FATC - AIR 2.0 workshopPeter Elst
 
Developing with Adobe AIR
Developing with Adobe AIRDeveloping with Adobe AIR
Developing with Adobe AIRPeter Elst
 
Introduction to AS3Signals
Introduction to AS3SignalsIntroduction to AS3Signals
Introduction to AS3SignalsPeter Elst
 
The Secret Life of a Flash Freelancer
The Secret Life of a Flash FreelancerThe Secret Life of a Flash Freelancer
The Secret Life of a Flash FreelancerPeter Elst
 
Getting Creative with Adobe AIR
Getting Creative with Adobe AIRGetting Creative with Adobe AIR
Getting Creative with Adobe AIRPeter Elst
 
Introduction to SQLite in Adobe AIR
Introduction to SQLite in Adobe AIRIntroduction to SQLite in Adobe AIR
Introduction to SQLite in Adobe AIRPeter Elst
 
Introduction to SQLite in Adobe AIR 1.5
Introduction to SQLite in Adobe AIR 1.5Introduction to SQLite in Adobe AIR 1.5
Introduction to SQLite in Adobe AIR 1.5Peter Elst
 
The Evolution of the Flash Platform
The Evolution of the Flash PlatformThe Evolution of the Flash Platform
The Evolution of the Flash PlatformPeter Elst
 
SQLite in Adobe AIR
SQLite in Adobe AIRSQLite in Adobe AIR
SQLite in Adobe AIRPeter Elst
 
Introduction to SQLite in Adobe AIR
Introduction to SQLite in Adobe AIRIntroduction to SQLite in Adobe AIR
Introduction to SQLite in Adobe AIRPeter Elst
 
RIA meets Desktop
RIA meets DesktopRIA meets Desktop
RIA meets DesktopPeter Elst
 
SkillsMatter - In-the-Brain session - What's new in ActionScript 3.0
SkillsMatter - In-the-Brain session - What's new in ActionScript 3.0SkillsMatter - In-the-Brain session - What's new in ActionScript 3.0
SkillsMatter - In-the-Brain session - What's new in ActionScript 3.0Peter Elst
 

Mais de Peter Elst (16)

P2P on the local network
P2P on the local networkP2P on the local network
P2P on the local network
 
P2P with Flash Player 10.1
P2P with Flash Player 10.1P2P with Flash Player 10.1
P2P with Flash Player 10.1
 
Big boys and their litl toys
Big boys and their litl toysBig boys and their litl toys
Big boys and their litl toys
 
Yes, you can do that with AIR 2.0
Yes, you can do that with AIR 2.0Yes, you can do that with AIR 2.0
Yes, you can do that with AIR 2.0
 
FATC - AIR 2.0 workshop
FATC - AIR 2.0 workshopFATC - AIR 2.0 workshop
FATC - AIR 2.0 workshop
 
Developing with Adobe AIR
Developing with Adobe AIRDeveloping with Adobe AIR
Developing with Adobe AIR
 
Introduction to AS3Signals
Introduction to AS3SignalsIntroduction to AS3Signals
Introduction to AS3Signals
 
The Secret Life of a Flash Freelancer
The Secret Life of a Flash FreelancerThe Secret Life of a Flash Freelancer
The Secret Life of a Flash Freelancer
 
Getting Creative with Adobe AIR
Getting Creative with Adobe AIRGetting Creative with Adobe AIR
Getting Creative with Adobe AIR
 
Introduction to SQLite in Adobe AIR
Introduction to SQLite in Adobe AIRIntroduction to SQLite in Adobe AIR
Introduction to SQLite in Adobe AIR
 
Introduction to SQLite in Adobe AIR 1.5
Introduction to SQLite in Adobe AIR 1.5Introduction to SQLite in Adobe AIR 1.5
Introduction to SQLite in Adobe AIR 1.5
 
The Evolution of the Flash Platform
The Evolution of the Flash PlatformThe Evolution of the Flash Platform
The Evolution of the Flash Platform
 
SQLite in Adobe AIR
SQLite in Adobe AIRSQLite in Adobe AIR
SQLite in Adobe AIR
 
Introduction to SQLite in Adobe AIR
Introduction to SQLite in Adobe AIRIntroduction to SQLite in Adobe AIR
Introduction to SQLite in Adobe AIR
 
RIA meets Desktop
RIA meets DesktopRIA meets Desktop
RIA meets Desktop
 
SkillsMatter - In-the-Brain session - What's new in ActionScript 3.0
SkillsMatter - In-the-Brain session - What's new in ActionScript 3.0SkillsMatter - In-the-Brain session - What's new in ActionScript 3.0
SkillsMatter - In-the-Brain session - What's new in ActionScript 3.0
 

Último

PicPay - GenAI Finance Assistant - ChatGPT for Customer Service
PicPay - GenAI Finance Assistant - ChatGPT for Customer ServicePicPay - GenAI Finance Assistant - ChatGPT for Customer Service
PicPay - GenAI Finance Assistant - ChatGPT for Customer ServiceRenan Moreira de Oliveira
 
AI Fame Rush Review – Virtual Influencer Creation In Just Minutes
AI Fame Rush Review – Virtual Influencer Creation In Just MinutesAI Fame Rush Review – Virtual Influencer Creation In Just Minutes
AI Fame Rush Review – Virtual Influencer Creation In Just MinutesMd Hossain Ali
 
NIST Cybersecurity Framework (CSF) 2.0 Workshop
NIST Cybersecurity Framework (CSF) 2.0 WorkshopNIST Cybersecurity Framework (CSF) 2.0 Workshop
NIST Cybersecurity Framework (CSF) 2.0 WorkshopBachir Benyammi
 
Introduction to Matsuo Laboratory (ENG).pptx
Introduction to Matsuo Laboratory (ENG).pptxIntroduction to Matsuo Laboratory (ENG).pptx
Introduction to Matsuo Laboratory (ENG).pptxMatsuo Lab
 
UiPath Studio Web workshop series - Day 6
UiPath Studio Web workshop series - Day 6UiPath Studio Web workshop series - Day 6
UiPath Studio Web workshop series - Day 6DianaGray10
 
Digital magic. A small project for controlling smart light bulbs.
Digital magic. A small project for controlling smart light bulbs.Digital magic. A small project for controlling smart light bulbs.
Digital magic. A small project for controlling smart light bulbs.francesco barbera
 
Salesforce Miami User Group Event - 1st Quarter 2024
Salesforce Miami User Group Event - 1st Quarter 2024Salesforce Miami User Group Event - 1st Quarter 2024
Salesforce Miami User Group Event - 1st Quarter 2024SkyPlanner
 
UiPath Solutions Management Preview - Northern CA Chapter - March 22.pdf
UiPath Solutions Management Preview - Northern CA Chapter - March 22.pdfUiPath Solutions Management Preview - Northern CA Chapter - March 22.pdf
UiPath Solutions Management Preview - Northern CA Chapter - March 22.pdfDianaGray10
 
UiPath Studio Web workshop series - Day 7
UiPath Studio Web workshop series - Day 7UiPath Studio Web workshop series - Day 7
UiPath Studio Web workshop series - Day 7DianaGray10
 
Empowering Africa's Next Generation: The AI Leadership Blueprint
Empowering Africa's Next Generation: The AI Leadership BlueprintEmpowering Africa's Next Generation: The AI Leadership Blueprint
Empowering Africa's Next Generation: The AI Leadership BlueprintMahmoud Rabie
 
Machine Learning Model Validation (Aijun Zhang 2024).pdf
Machine Learning Model Validation (Aijun Zhang 2024).pdfMachine Learning Model Validation (Aijun Zhang 2024).pdf
Machine Learning Model Validation (Aijun Zhang 2024).pdfAijun Zhang
 
UiPath Platform: The Backend Engine Powering Your Automation - Session 1
UiPath Platform: The Backend Engine Powering Your Automation - Session 1UiPath Platform: The Backend Engine Powering Your Automation - Session 1
UiPath Platform: The Backend Engine Powering Your Automation - Session 1DianaGray10
 
Linked Data in Production: Moving Beyond Ontologies
Linked Data in Production: Moving Beyond OntologiesLinked Data in Production: Moving Beyond Ontologies
Linked Data in Production: Moving Beyond OntologiesDavid Newbury
 
Computer 10: Lesson 10 - Online Crimes and Hazards
Computer 10: Lesson 10 - Online Crimes and HazardsComputer 10: Lesson 10 - Online Crimes and Hazards
Computer 10: Lesson 10 - Online Crimes and HazardsSeth Reyes
 
Cybersecurity Workshop #1.pptx
Cybersecurity Workshop #1.pptxCybersecurity Workshop #1.pptx
Cybersecurity Workshop #1.pptxGDSC PJATK
 
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdf
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdfIaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdf
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdfDaniel Santiago Silva Capera
 
Babel Compiler - Transforming JavaScript for All Browsers.pptx
Babel Compiler - Transforming JavaScript for All Browsers.pptxBabel Compiler - Transforming JavaScript for All Browsers.pptx
Babel Compiler - Transforming JavaScript for All Browsers.pptxYounusS2
 
RAG Patterns and Vector Search in Generative AI
RAG Patterns and Vector Search in Generative AIRAG Patterns and Vector Search in Generative AI
RAG Patterns and Vector Search in Generative AIUdaiappa Ramachandran
 
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve Decarbonization
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve DecarbonizationUsing IESVE for Loads, Sizing and Heat Pump Modeling to Achieve Decarbonization
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve DecarbonizationIES VE
 
COMPUTER 10 Lesson 8 - Building a Website
COMPUTER 10 Lesson 8 - Building a WebsiteCOMPUTER 10 Lesson 8 - Building a Website
COMPUTER 10 Lesson 8 - Building a Websitedgelyza
 

Último (20)

PicPay - GenAI Finance Assistant - ChatGPT for Customer Service
PicPay - GenAI Finance Assistant - ChatGPT for Customer ServicePicPay - GenAI Finance Assistant - ChatGPT for Customer Service
PicPay - GenAI Finance Assistant - ChatGPT for Customer Service
 
AI Fame Rush Review – Virtual Influencer Creation In Just Minutes
AI Fame Rush Review – Virtual Influencer Creation In Just MinutesAI Fame Rush Review – Virtual Influencer Creation In Just Minutes
AI Fame Rush Review – Virtual Influencer Creation In Just Minutes
 
NIST Cybersecurity Framework (CSF) 2.0 Workshop
NIST Cybersecurity Framework (CSF) 2.0 WorkshopNIST Cybersecurity Framework (CSF) 2.0 Workshop
NIST Cybersecurity Framework (CSF) 2.0 Workshop
 
Introduction to Matsuo Laboratory (ENG).pptx
Introduction to Matsuo Laboratory (ENG).pptxIntroduction to Matsuo Laboratory (ENG).pptx
Introduction to Matsuo Laboratory (ENG).pptx
 
UiPath Studio Web workshop series - Day 6
UiPath Studio Web workshop series - Day 6UiPath Studio Web workshop series - Day 6
UiPath Studio Web workshop series - Day 6
 
Digital magic. A small project for controlling smart light bulbs.
Digital magic. A small project for controlling smart light bulbs.Digital magic. A small project for controlling smart light bulbs.
Digital magic. A small project for controlling smart light bulbs.
 
Salesforce Miami User Group Event - 1st Quarter 2024
Salesforce Miami User Group Event - 1st Quarter 2024Salesforce Miami User Group Event - 1st Quarter 2024
Salesforce Miami User Group Event - 1st Quarter 2024
 
UiPath Solutions Management Preview - Northern CA Chapter - March 22.pdf
UiPath Solutions Management Preview - Northern CA Chapter - March 22.pdfUiPath Solutions Management Preview - Northern CA Chapter - March 22.pdf
UiPath Solutions Management Preview - Northern CA Chapter - March 22.pdf
 
UiPath Studio Web workshop series - Day 7
UiPath Studio Web workshop series - Day 7UiPath Studio Web workshop series - Day 7
UiPath Studio Web workshop series - Day 7
 
Empowering Africa's Next Generation: The AI Leadership Blueprint
Empowering Africa's Next Generation: The AI Leadership BlueprintEmpowering Africa's Next Generation: The AI Leadership Blueprint
Empowering Africa's Next Generation: The AI Leadership Blueprint
 
Machine Learning Model Validation (Aijun Zhang 2024).pdf
Machine Learning Model Validation (Aijun Zhang 2024).pdfMachine Learning Model Validation (Aijun Zhang 2024).pdf
Machine Learning Model Validation (Aijun Zhang 2024).pdf
 
UiPath Platform: The Backend Engine Powering Your Automation - Session 1
UiPath Platform: The Backend Engine Powering Your Automation - Session 1UiPath Platform: The Backend Engine Powering Your Automation - Session 1
UiPath Platform: The Backend Engine Powering Your Automation - Session 1
 
Linked Data in Production: Moving Beyond Ontologies
Linked Data in Production: Moving Beyond OntologiesLinked Data in Production: Moving Beyond Ontologies
Linked Data in Production: Moving Beyond Ontologies
 
Computer 10: Lesson 10 - Online Crimes and Hazards
Computer 10: Lesson 10 - Online Crimes and HazardsComputer 10: Lesson 10 - Online Crimes and Hazards
Computer 10: Lesson 10 - Online Crimes and Hazards
 
Cybersecurity Workshop #1.pptx
Cybersecurity Workshop #1.pptxCybersecurity Workshop #1.pptx
Cybersecurity Workshop #1.pptx
 
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdf
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdfIaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdf
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdf
 
Babel Compiler - Transforming JavaScript for All Browsers.pptx
Babel Compiler - Transforming JavaScript for All Browsers.pptxBabel Compiler - Transforming JavaScript for All Browsers.pptx
Babel Compiler - Transforming JavaScript for All Browsers.pptx
 
RAG Patterns and Vector Search in Generative AI
RAG Patterns and Vector Search in Generative AIRAG Patterns and Vector Search in Generative AI
RAG Patterns and Vector Search in Generative AI
 
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve Decarbonization
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve DecarbonizationUsing IESVE for Loads, Sizing and Heat Pump Modeling to Achieve Decarbonization
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve Decarbonization
 
COMPUTER 10 Lesson 8 - Building a Website
COMPUTER 10 Lesson 8 - Building a WebsiteCOMPUTER 10 Lesson 8 - Building a Website
COMPUTER 10 Lesson 8 - Building a Website
 

Object-Oriented ActionScript 3.0

  • 1. Object-Oriented ActionScript 3.0 Peter Elst 4th-6th June 2008 Edinburgh, Scotland
  • 2. Object-Oriented Programming ■ Difficult ■ Scary ■ Overhead ■ Only for large teams 4th-6th June 2008 Edinburgh, Scotland
  • 3. Object-Oriented Programming ■ Difficult? Structured code ■ Scary ■ Overhead ■ Only for large teams 4th-6th June 2008 Edinburgh, Scotland
  • 4. Object-Oriented Programming ■ Difficult? Structured code ■ Scary? Initial learning curve ■ Overhead ■ Only for large teams 4th-6th June 2008 Edinburgh, Scotland
  • 5. Object-Oriented Programming ■ Difficult? Structured code ■ Scary? Initial learning curve ■ Overhead? Promotes code reuse ■ Only for large teams 4th-6th June 2008 Edinburgh, Scotland
  • 6. Object-Oriented Programming ■ Difficult? Structured code ■ Scary? Initial learning curve ■ Overhead? Promotes code reuse ■ Only for large teams? Useful for anyone 4th-6th June 2008 Edinburgh, Scotland
  • 7. Classes (the artist formerly known as prototype) ■ The way things were: function Conference() { this.name = quot;Flashforwardquot;; } Conference.prototype.getName = function() { trace(quot;conference name: quot;+this.name); } var myConference = new Conference(); myConference.getName(); 4th-6th June 2008 Edinburgh, Scotland
  • 8. Classes (the artist formerly known as prototype) ■ The way things are: package { public class Conference { public var name:String = quot;Flashforwardquot;; public function getName():void { trace(quot;conference name: quot;+this.name); } } } 4th-6th June 2008 Edinburgh, Scotland
  • 9. Instances ■ Classes provide a blueprint ■ Instances set their values for properties 4th-6th June 2008 Edinburgh, Scotland
  • 10. Inheritance (getting rich the easy way) ■ Classes can extend each-other ■ Avoids code duplication ■ Properties and methods can be overridden package { public class SuperClass extends BaseClass { public function SuperClass() { super(); } } } 4th-6th June 2008 Edinburgh, Scotland
  • 11. Inheritance vs composition ■ Inheritance deals with an is a relationship ■ Composition is used for has a relationships Employee is a Person Employee has a Job 4th-6th June 2008 Edinburgh, Scotland
  • 12. Encapsulation (don't touch my stuff) ■ Protect the inner workings of your code through the use of access modifiers ■ Provide an API for other classes to use by providing getter/setter methods public - anything can access this private - only the class itself can access protected - class and its subclasses can access internal (default) - all classes in the same class package 4th-6th June 2008 Edinburgh, Scotland
  • 13. Polymorphism (copycat behavior) ■ Have classes use the same method names ■ Allows classes to be swapped at runtime ■ Same name but different implementation Doctor.work() Fireman.work() WebDeveloper.work() 4th-6th June 2008 Edinburgh, Scotland
  • 14. Interfaces (sign on the dotted line) ■ Classes can use one or more interfaces ■ Interfaces require a class to implement a specific set of methods ■ Used to formalize polymorphism ■ Interfaces can extend each-other 4th-6th June 2008 Edinburgh, Scotland
  • 15. Design Patterns General solutions to common problems 4th-6th June 2008 Edinburgh, Scotland
  • 16. Observer pattern ■ Problem: notify other classes when an update occurs in a data model ■ Solution: keep an array of all instances that want to be notified and call their update method then the model has changed 4th-6th June 2008 Edinburgh, Scotland
  • 17. Singleton pattern ■ Problem: allow only one instance of a class to exist in an application ■ Solution: prevent the constructor from being called outside of the class scope and provide a static method for returning the single class instance 4th-6th June 2008 Edinburgh, Scotland
  • 18. Want to learn more? Books ■ Object-Oriented ActionScript 3.0 ■ Essential ActionScript 3.0 Course ■ Core ActionScript 3.0 (Skills Matter - London) 4th-6th June 2008 Edinburgh, Scotland
  • 20. Get in touch! Peter Elst Flash Platform Consultant Blog: www.peterelst.com Email: training@peterelst.com LinkedIn: www.linkedin.com/in/peterelst Twitter: www.twitter.com/peterelst 4th-6th June 2008 Edinburgh, Scotland