SlideShare una empresa de Scribd logo
1 de 50
Compile and Run. No change. Good!
Don’t think of an elephant!  (ii) The TActivation class
How to implement the sigmoid? B3=IF(A3<=0.5,A3,1.0-A3)
[object Object],[object Object],[object Object]
Class Structure ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Bureaucratic stuff
 
 
 
So OUR own code for “activation.increase” should be a Strategy Pattern ,[object Object],[object Object],[object Object],[object Object]
Advantages of a strategy pattern ,[object Object],[object Object]
[object Object],[object Object]
How do we change a method to a strategy pattern? ,[object Object]
1. Create an interface that defines the strategic operation ,[object Object],[object Object],[object Object]
How do we change a method to a strategy pattern? ,[object Object],[object Object]
2.  Implement the interface with classes that represent each strategy ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
How do we change a method to a strategy pattern? ,[object Object],[object Object],[object Object]
3.  Refactor the code to select and to use an instance of the right strategic class ,[object Object],[object Object]
(3.2)  Now on to include methods to set_activation_sigmoid, or set_activation_linear; hence we include in the TActivation Class:  ,[object Object]
[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object],[object Object]
[object Object],[object Object]
[object Object],[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object],[object Object]
[object Object]
[object Object],[object Object],[object Object],[object Object],[object Object]
Copycat’s slipnet
Let’s do classes for  nodes  and for  links ,[object Object],[object Object],[object Object],[object Object],[object Object]
[object Object],[object Object]
[object Object],[object Object]
TLINK.Create_Link (Node1, Node2, Link_Type, Link_Distance, etc.) ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Rewriting… if spread_activation belongs to NODES… ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
OR…if spread_activation belongs to LINKS… ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
NODES Activation Data Data … Method Method Method … LINKS Distance Data Data … Method Method Method … The classes become strongly coupled. It will be very hard to change them in 2010. Practically impossible to include new links at runtime.
Welcome to the observer pattern! Can you imagine calling a method  without knowing which  method from which object you are calling?
 
 
How could we include a new display if they have all been hardcoded? By changing this code?  That would be bad!  We don’t want to change code.   What if we want to include a new display during runtime?
 
 
 
 
 
 
 
 
So here's what the design looks like: ,[object Object],[object Object],Node= subject/publisher Links=observers
So here's what the design looks like: ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Node= subject/publisher Links=observers
NODES implement: ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Links implement: ,[object Object],[object Object]
So here's what the design looks like: ,[object Object],[object Object],Node= subject/publisher Links=observers

Más contenido relacionado

La actualidad más candente

Tracking my face with matlab ws word format
Tracking my face with matlab ws word formatTracking my face with matlab ws word format
Tracking my face with matlab ws word format
Gaspard Ggas
 

La actualidad más candente (15)

10 strategy pattern
10 strategy pattern10 strategy pattern
10 strategy pattern
 
4759826-Java-Thread
4759826-Java-Thread4759826-Java-Thread
4759826-Java-Thread
 
Javascripts hidden treasures BY - https://geekyants.com/
Javascripts hidden treasures            BY  -  https://geekyants.com/Javascripts hidden treasures            BY  -  https://geekyants.com/
Javascripts hidden treasures BY - https://geekyants.com/
 
Trigger
TriggerTrigger
Trigger
 
Command and Adapter Pattern
Command and Adapter PatternCommand and Adapter Pattern
Command and Adapter Pattern
 
Tracking my face with matlab ws word format
Tracking my face with matlab ws word formatTracking my face with matlab ws word format
Tracking my face with matlab ws word format
 
Template Method Pattern
Template Method PatternTemplate Method Pattern
Template Method Pattern
 
Clean code
Clean codeClean code
Clean code
 
2. Design patterns. part #2
2. Design patterns. part #22. Design patterns. part #2
2. Design patterns. part #2
 
How and why I turned my old Java projects into a first-class serverless compo...
How and why I turned my old Java projects into a first-class serverless compo...How and why I turned my old Java projects into a first-class serverless compo...
How and why I turned my old Java projects into a first-class serverless compo...
 
Comparing different concurrency models on the JVM
Comparing different concurrency models on the JVMComparing different concurrency models on the JVM
Comparing different concurrency models on the JVM
 
Chain of responsibility
Chain of responsibilityChain of responsibility
Chain of responsibility
 
Programming in Java: Control Flow
Programming in Java: Control FlowProgramming in Java: Control Flow
Programming in Java: Control Flow
 
Java concurrency model - The Future Task
Java concurrency model - The Future TaskJava concurrency model - The Future Task
Java concurrency model - The Future Task
 
Behavioral Design Patterns
Behavioral Design PatternsBehavioral Design Patterns
Behavioral Design Patterns
 

Destacado (13)

How to beat Jeff Hawkins
How to beat Jeff HawkinsHow to beat Jeff Hawkins
How to beat Jeff Hawkins
 
You only get one life
You only get one life You only get one life
You only get one life
 
Semantic Web, circa 2008
Semantic Web, circa 2008Semantic Web, circa 2008
Semantic Web, circa 2008
 
Discos duros virtuales43
Discos duros virtuales43Discos duros virtuales43
Discos duros virtuales43
 
Carta a Santa (Viejito Pascuero)
Carta a Santa (Viejito Pascuero)Carta a Santa (Viejito Pascuero)
Carta a Santa (Viejito Pascuero)
 
herramientas wed2
herramientas wed2 herramientas wed2
herramientas wed2
 
herramientas wed2
herramientas wed2herramientas wed2
herramientas wed2
 
Web 2 0
Web 2 0Web 2 0
Web 2 0
 
Web 2.0 en el ámbito educativo
Web 2.0 en el ámbito educativoWeb 2.0 en el ámbito educativo
Web 2.0 en el ámbito educativo
 
Jazzy Graphic Designer
Jazzy Graphic Designer Jazzy Graphic Designer
Jazzy Graphic Designer
 
Presentacion Vuce
Presentacion VucePresentacion Vuce
Presentacion Vuce
 
1. Graduacao 2008
1. Graduacao 20081. Graduacao 2008
1. Graduacao 2008
 
O Mundo é Plano Cap 7
O Mundo é Plano Cap 7O Mundo é Plano Cap 7
O Mundo é Plano Cap 7
 

Similar a 6. Compile And Run

Dot Net Accenture
Dot Net AccentureDot Net Accenture
Dot Net Accenture
Sri K
 
GDE Lab 1 – Traffic Light Pg. 1 Lab 1 Traffic L.docx
GDE Lab 1 – Traffic Light  Pg. 1     Lab 1 Traffic L.docxGDE Lab 1 – Traffic Light  Pg. 1     Lab 1 Traffic L.docx
GDE Lab 1 – Traffic Light Pg. 1 Lab 1 Traffic L.docx
budbarber38650
 
Interview Questions.docx
Interview Questions.docxInterview Questions.docx
Interview Questions.docx
ReddyRavi5
 
Data structures and algorithms lab2
Data structures and algorithms lab2Data structures and algorithms lab2
Data structures and algorithms lab2
Bianca Teşilă
 

Similar a 6. Compile And Run (20)

Refactoring Tips by Martin Fowler
Refactoring Tips by Martin FowlerRefactoring Tips by Martin Fowler
Refactoring Tips by Martin Fowler
 
TDD And Refactoring
TDD And RefactoringTDD And Refactoring
TDD And Refactoring
 
Dot Net Accenture
Dot Net AccentureDot Net Accenture
Dot Net Accenture
 
Implementing the Adapter Design Pattern
Implementing the Adapter Design PatternImplementing the Adapter Design Pattern
Implementing the Adapter Design Pattern
 
How To Use IO Monads in Scala?
 How To Use IO Monads in Scala? How To Use IO Monads in Scala?
How To Use IO Monads in Scala?
 
Instant DBMS Homework Help
Instant DBMS Homework HelpInstant DBMS Homework Help
Instant DBMS Homework Help
 
SystemVerilog OOP Ovm Features Summary
SystemVerilog OOP Ovm Features SummarySystemVerilog OOP Ovm Features Summary
SystemVerilog OOP Ovm Features Summary
 
Spring boot
Spring bootSpring boot
Spring boot
 
maXbox Starter 45 Robotics
maXbox Starter 45 RoboticsmaXbox Starter 45 Robotics
maXbox Starter 45 Robotics
 
Web technologies-course 12.pptx
Web technologies-course 12.pptxWeb technologies-course 12.pptx
Web technologies-course 12.pptx
 
Android Dagger 2
Android  Dagger 2Android  Dagger 2
Android Dagger 2
 
Android Application Development - Level 3
Android Application Development - Level 3Android Application Development - Level 3
Android Application Development - Level 3
 
GDE Lab 1 – Traffic Light Pg. 1 Lab 1 Traffic L.docx
GDE Lab 1 – Traffic Light  Pg. 1     Lab 1 Traffic L.docxGDE Lab 1 – Traffic Light  Pg. 1     Lab 1 Traffic L.docx
GDE Lab 1 – Traffic Light Pg. 1 Lab 1 Traffic L.docx
 
The Ring programming language version 1.9 book - Part 98 of 210
The Ring programming language version 1.9 book - Part 98 of 210The Ring programming language version 1.9 book - Part 98 of 210
The Ring programming language version 1.9 book - Part 98 of 210
 
How much do we know about Object-Oriented Programming?
How much do we know about Object-Oriented Programming?How much do we know about Object-Oriented Programming?
How much do we know about Object-Oriented Programming?
 
Interview Questions.docx
Interview Questions.docxInterview Questions.docx
Interview Questions.docx
 
C++.pptx
C++.pptxC++.pptx
C++.pptx
 
Reactive programming with rx java
Reactive programming with rx javaReactive programming with rx java
Reactive programming with rx java
 
Data structures and algorithms lab2
Data structures and algorithms lab2Data structures and algorithms lab2
Data structures and algorithms lab2
 
Can't Dance The Lambda
Can't Dance The LambdaCan't Dance The Lambda
Can't Dance The Lambda
 

Más de Alexandre Linhares

(Slideshare Version) 3. The Nature Of Understanding
(Slideshare Version) 3. The Nature Of Understanding(Slideshare Version) 3. The Nature Of Understanding
(Slideshare Version) 3. The Nature Of Understanding
Alexandre Linhares
 
(Slideshare Version) 2. Emergence, Priming, And Understanding
(Slideshare Version) 2. Emergence, Priming, And Understanding(Slideshare Version) 2. Emergence, Priming, And Understanding
(Slideshare Version) 2. Emergence, Priming, And Understanding
Alexandre Linhares
 
O Mundo é Plano Cap 9+Conclusao
O Mundo é Plano Cap 9+ConclusaoO Mundo é Plano Cap 9+Conclusao
O Mundo é Plano Cap 9+Conclusao
Alexandre Linhares
 

Más de Alexandre Linhares (20)

Hathor@FGV: Introductory notes by Dr. A. Linhares
Hathor@FGV: Introductory notes by Dr. A. LinharesHathor@FGV: Introductory notes by Dr. A. Linhares
Hathor@FGV: Introductory notes by Dr. A. Linhares
 
4. Serving Two Masters
4. Serving Two Masters4. Serving Two Masters
4. Serving Two Masters
 
(Slideshare Version) 3. The Nature Of Understanding
(Slideshare Version) 3. The Nature Of Understanding(Slideshare Version) 3. The Nature Of Understanding
(Slideshare Version) 3. The Nature Of Understanding
 
(Slideshare Version) 2. Emergence, Priming, And Understanding
(Slideshare Version) 2. Emergence, Priming, And Understanding(Slideshare Version) 2. Emergence, Priming, And Understanding
(Slideshare Version) 2. Emergence, Priming, And Understanding
 
1. The Game Of The Century
1. The Game Of The Century1. The Game Of The Century
1. The Game Of The Century
 
Taisa Secao3 A
Taisa Secao3 ATaisa Secao3 A
Taisa Secao3 A
 
The Club of Rome
The Club of Rome The Club of Rome
The Club of Rome
 
O Mundo é Plano Cap 8 B
O Mundo é Plano Cap 8 BO Mundo é Plano Cap 8 B
O Mundo é Plano Cap 8 B
 
A Cauda Longa Cap 1
A Cauda Longa Cap 1A Cauda Longa Cap 1
A Cauda Longa Cap 1
 
O Mundo é Plano Cap 9+Conclusao
O Mundo é Plano Cap 9+ConclusaoO Mundo é Plano Cap 9+Conclusao
O Mundo é Plano Cap 9+Conclusao
 
O Mundo é Plano Cap 8 A
O Mundo é Plano Cap 8 AO Mundo é Plano Cap 8 A
O Mundo é Plano Cap 8 A
 
The business school myth
The business school mythThe business school myth
The business school myth
 
Outline of Globalization course at FGV/EBAPE
Outline of Globalization course at FGV/EBAPEOutline of Globalization course at FGV/EBAPE
Outline of Globalization course at FGV/EBAPE
 
test
testtest
test
 
Mighty Wal-Mart
Mighty Wal-MartMighty Wal-Mart
Mighty Wal-Mart
 
Class 8
Class 8Class 8
Class 8
 
Class 6
Class 6Class 6
Class 6
 
Class 5
Class 5Class 5
Class 5
 
Class 4
Class 4Class 4
Class 4
 
Class 3
Class 3Class 3
Class 3
 

Último

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 

Último (20)

Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelMcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital Adaptability
 
AI in Action: Real World Use Cases by Anitaraj
AI in Action: Real World Use Cases by AnitarajAI in Action: Real World Use Cases by Anitaraj
AI in Action: Real World Use Cases by Anitaraj
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Introduction to use of FHIR Documents in ABDM
Introduction to use of FHIR Documents in ABDMIntroduction to use of FHIR Documents in ABDM
Introduction to use of FHIR Documents in ABDM
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontology
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 

6. Compile And Run

  • 1. Compile and Run. No change. Good!
  • 2. Don’t think of an elephant! (ii) The TActivation class
  • 3. How to implement the sigmoid? B3=IF(A3<=0.5,A3,1.0-A3)
  • 4.
  • 5.
  • 6.  
  • 7.  
  • 8.  
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
  • 18.
  • 19.
  • 20.
  • 21.
  • 22.
  • 23.
  • 24.
  • 25.
  • 27.
  • 28.
  • 29.
  • 30.
  • 31.
  • 32.
  • 33. NODES Activation Data Data … Method Method Method … LINKS Distance Data Data … Method Method Method … The classes become strongly coupled. It will be very hard to change them in 2010. Practically impossible to include new links at runtime.
  • 34. Welcome to the observer pattern! Can you imagine calling a method without knowing which method from which object you are calling?
  • 35.  
  • 36.  
  • 37. How could we include a new display if they have all been hardcoded? By changing this code? That would be bad! We don’t want to change code. What if we want to include a new display during runtime?
  • 38.  
  • 39.  
  • 40.  
  • 41.  
  • 42.  
  • 43.  
  • 44.  
  • 45.  
  • 46.
  • 47.
  • 48.
  • 49.
  • 50.