Statecharts are a visual formalism for specifying reactive systems that can be in different states. They extend traditional state diagrams with concepts like depth, orthogonality, concurrency and broadcasting to handle complex systems. Stativus is a JavaScript library that implements statecharts to help with specification, design, implementation, testing and maintenance of reactive systems. Statecharts help address issues in reactive systems by providing a visual model, improving communication and encouraging developers to think ahead about all possible states and transitions.
Concurrent Programming with Ruby and Tuple Spacesluccastera
Ruby threads are limited due to the Global Interpreter Lock. Therefore, the best way to do parallel computing with Ruby is to use multiple processes but how do you get these processes to communicate?
This session will provide some strategies for handling multi-process communication in Ruby, with a focus on the use of TupleSpaces. A TupleSpace provides a repository of tuples that can be accessed concurrently to implement a Blackboard system. Ruby ships with a built-in implementation of a TupleSpace with the Rinda library.
During the session, Luc will demonstrate how to use Rinda and will highlight other libraries/projects that facilitate interprocess communication and parallel computing in Ruby.
"To be tested a system has to be designed to be tested"
Eberhardt Rechtin, The Art Of System Architecting
Testing is one of the main activities through which we gather data to assess the quality of our software; this makes testability an important attribute of software--not only for development, but also for maintenance and bug fixing.
Design for testability is a term that has its origin in hardware design, where the concept was introduced in order to make it easier testing circuits while reducing the costs of doing so.
In this talk I'll show how to translate this concept to the software domain along with the consequences on various aspects of the development activities, both from the technical point of view (e.g., design, code quality, choice of frameworks, etc.), and the product management point of view (e.g., management of team dependencies, delivery time, costs, etc.). I'll provide examples based on real world experience, both for the technical and the management aspects.
Concurrent Programming with Ruby and Tuple Spacesluccastera
Ruby threads are limited due to the Global Interpreter Lock. Therefore, the best way to do parallel computing with Ruby is to use multiple processes but how do you get these processes to communicate?
This session will provide some strategies for handling multi-process communication in Ruby, with a focus on the use of TupleSpaces. A TupleSpace provides a repository of tuples that can be accessed concurrently to implement a Blackboard system. Ruby ships with a built-in implementation of a TupleSpace with the Rinda library.
During the session, Luc will demonstrate how to use Rinda and will highlight other libraries/projects that facilitate interprocess communication and parallel computing in Ruby.
"To be tested a system has to be designed to be tested"
Eberhardt Rechtin, The Art Of System Architecting
Testing is one of the main activities through which we gather data to assess the quality of our software; this makes testability an important attribute of software--not only for development, but also for maintenance and bug fixing.
Design for testability is a term that has its origin in hardware design, where the concept was introduced in order to make it easier testing circuits while reducing the costs of doing so.
In this talk I'll show how to translate this concept to the software domain along with the consequences on various aspects of the development activities, both from the technical point of view (e.g., design, code quality, choice of frameworks, etc.), and the product management point of view (e.g., management of team dependencies, delivery time, costs, etc.). I'll provide examples based on real world experience, both for the technical and the management aspects.
SERENE 2014 School: Resilience in Cyber-Physical Systems: Challenges and Oppo...SERENEWorkshop
SERENE 2014 School on Engineering Resilient Cyber Physical Systems
Talk: Resilience in Cyber-Physical Systems: Challenges and Opportunities, by Gabor Karsai
Nelson: Rigorous Deployment for a Functional WorldTimothy Perrett
Functional programming finds its roots in mathematics - the pursuit of purity and completeness. We functional programmers look to formalize system behaviors in an algebraic and total manner. Despite this, when it comes time to deploy ones beautiful monadic ivory towers to production, most organizations cast caution to the wind and use a myriad of bash scripts and sticky tape to get the job done. In this talk, the speaker will introduce you to Nelson, an open-source project from Verizon that looks to provide rigor to your large distributed system, whilst offering best-in-class security, runtime traffic shifting and a fully immutable approach to application lifecycle. Nelson itself is entirely composed of free algebras and coproducts, and the speaker will show not only how this has enabled development, but also how it provided a frame with which to reason about solutions to fundamental operational problems.
Chapter 17: Models of the system
from
Dix, Finlay, Abowd and Beale (2004).
Human-Computer Interaction, third edition.
Prentice Hall. ISBN 0-13-239864-8.
http://www.hcibook.com/e3/
Declaratvie UI is a huge concept, but we can always start small. This is a very brief introduction to declarative UI pattern on iOS, without having SwiftUI.
SERENE 2014 School: Measurement-Driven Resilience Design of Cloud-Based Cyber...SERENEWorkshop
SERENE 2014 School on Engineering Resilient Cyber Physical Systems
Talk: Measurement-Driven Resilience Design of Cloud-Based Cyber-Physical Systems, by Imre Kocsis
Building Sexy Real-Time Analytics Systems - Erlang Factory NYC / Toronto 2013lpgauth
In the world of Real-time bidding (RTB), it is crucial to get performance metrics as soon as possible. This is why AdGear build their own real-time analytics system.
In this talk, Louis-Philippe will share with you what he has learnt building this system and he will introduce Swirl, AdGear's lightweight distributed stream processor. He will also give some clues on how to build a subset of SQL to power your distributed jobs.
Talk objectives:
- Introduce Swirl, a lightweight distributed stream processor
- Implement a subset of SQL (lexer + parser + boolean logic)
- Demo real-time graphing web interface powered by Swirl, Cowboy, Bullet and D3.js
Recent years have seen the emergence of several static analysis techniques for reasoning about programs. This talk presents several major classes of techniques and tools that implement these techniques. Part of the presentation will be a demonstration of the tools.
Dr. Subash Shankar is an Associate Professor in the Computer Science department at Hunter College, CUNY. Prior to joining CUNY, he received a PhD from the University of Minnesota and was a postdoctoral fellow in the model checking group at Carnegie Mellon University. Dr. Shankar also has over 10 years of industrial experience, mostly in the areas of formal methods and tools for analyzing hardware and software systems.
Introduction to Streaming Distributed Processing with StormBrandon O'Brien
Contact:
https://www.linkedin.com/in/brandonjobrien
@hakczar
Introducing streaming data concepts, Storm cluster architecture, Storm topology architecture, and demonstrate working example of a WordCount topology for SIGKDD Seattle chapter meetup.
Presented by Brandon O'Brien
Code example: https://github.com/OpenDataMining/brandonobrien
Meetup: http://www.meetup.com/seattlesigkdd/events/222955114/
Data Platform at Twitter: Enabling Real-time & Batch Analytics at ScaleSriram Krishnan
The Data Platform at Twitter supports engineers and data scientists running batch jobs on Hadoop clusters that are several 1000s of nodes, and real-time jobs on top of systems such as Storm. In this presentation, I discuss the overall Data Platform stack at Twitter. In particular, I talk about enabling real-time and batch analytics at scale with the help of Scalding, which is a Scala DSL for batch jobs using MapReduce, Summingbird, which is a framework for combined real-time and batch processing, and Tsar, which is a framework for real-time time-series aggregations.
GraphRAG is All You need? LLM & Knowledge GraphGuy Korland
Guy Korland, CEO and Co-founder of FalkorDB, will review two articles on the integration of language models with knowledge graphs.
1. Unifying Large Language Models and Knowledge Graphs: A Roadmap.
https://arxiv.org/abs/2306.08302
2. Microsoft Research's GraphRAG paper and a review paper on various uses of knowledge graphs:
https://www.microsoft.com/en-us/research/blog/graphrag-unlocking-llm-discovery-on-narrative-private-data/
Neuro-symbolic is not enough, we need neuro-*semantic*Frank van Harmelen
Neuro-symbolic (NeSy) AI is on the rise. However, simply machine learning on just any symbolic structure is not sufficient to really harvest the gains of NeSy. These will only be gained when the symbolic structures have an actual semantics. I give an operational definition of semantics as “predictable inference”.
All of this illustrated with link prediction over knowledge graphs, but the argument is general.
SERENE 2014 School: Resilience in Cyber-Physical Systems: Challenges and Oppo...SERENEWorkshop
SERENE 2014 School on Engineering Resilient Cyber Physical Systems
Talk: Resilience in Cyber-Physical Systems: Challenges and Opportunities, by Gabor Karsai
Nelson: Rigorous Deployment for a Functional WorldTimothy Perrett
Functional programming finds its roots in mathematics - the pursuit of purity and completeness. We functional programmers look to formalize system behaviors in an algebraic and total manner. Despite this, when it comes time to deploy ones beautiful monadic ivory towers to production, most organizations cast caution to the wind and use a myriad of bash scripts and sticky tape to get the job done. In this talk, the speaker will introduce you to Nelson, an open-source project from Verizon that looks to provide rigor to your large distributed system, whilst offering best-in-class security, runtime traffic shifting and a fully immutable approach to application lifecycle. Nelson itself is entirely composed of free algebras and coproducts, and the speaker will show not only how this has enabled development, but also how it provided a frame with which to reason about solutions to fundamental operational problems.
Chapter 17: Models of the system
from
Dix, Finlay, Abowd and Beale (2004).
Human-Computer Interaction, third edition.
Prentice Hall. ISBN 0-13-239864-8.
http://www.hcibook.com/e3/
Declaratvie UI is a huge concept, but we can always start small. This is a very brief introduction to declarative UI pattern on iOS, without having SwiftUI.
SERENE 2014 School: Measurement-Driven Resilience Design of Cloud-Based Cyber...SERENEWorkshop
SERENE 2014 School on Engineering Resilient Cyber Physical Systems
Talk: Measurement-Driven Resilience Design of Cloud-Based Cyber-Physical Systems, by Imre Kocsis
Building Sexy Real-Time Analytics Systems - Erlang Factory NYC / Toronto 2013lpgauth
In the world of Real-time bidding (RTB), it is crucial to get performance metrics as soon as possible. This is why AdGear build their own real-time analytics system.
In this talk, Louis-Philippe will share with you what he has learnt building this system and he will introduce Swirl, AdGear's lightweight distributed stream processor. He will also give some clues on how to build a subset of SQL to power your distributed jobs.
Talk objectives:
- Introduce Swirl, a lightweight distributed stream processor
- Implement a subset of SQL (lexer + parser + boolean logic)
- Demo real-time graphing web interface powered by Swirl, Cowboy, Bullet and D3.js
Recent years have seen the emergence of several static analysis techniques for reasoning about programs. This talk presents several major classes of techniques and tools that implement these techniques. Part of the presentation will be a demonstration of the tools.
Dr. Subash Shankar is an Associate Professor in the Computer Science department at Hunter College, CUNY. Prior to joining CUNY, he received a PhD from the University of Minnesota and was a postdoctoral fellow in the model checking group at Carnegie Mellon University. Dr. Shankar also has over 10 years of industrial experience, mostly in the areas of formal methods and tools for analyzing hardware and software systems.
Introduction to Streaming Distributed Processing with StormBrandon O'Brien
Contact:
https://www.linkedin.com/in/brandonjobrien
@hakczar
Introducing streaming data concepts, Storm cluster architecture, Storm topology architecture, and demonstrate working example of a WordCount topology for SIGKDD Seattle chapter meetup.
Presented by Brandon O'Brien
Code example: https://github.com/OpenDataMining/brandonobrien
Meetup: http://www.meetup.com/seattlesigkdd/events/222955114/
Data Platform at Twitter: Enabling Real-time & Batch Analytics at ScaleSriram Krishnan
The Data Platform at Twitter supports engineers and data scientists running batch jobs on Hadoop clusters that are several 1000s of nodes, and real-time jobs on top of systems such as Storm. In this presentation, I discuss the overall Data Platform stack at Twitter. In particular, I talk about enabling real-time and batch analytics at scale with the help of Scalding, which is a Scala DSL for batch jobs using MapReduce, Summingbird, which is a framework for combined real-time and batch processing, and Tsar, which is a framework for real-time time-series aggregations.
GraphRAG is All You need? LLM & Knowledge GraphGuy Korland
Guy Korland, CEO and Co-founder of FalkorDB, will review two articles on the integration of language models with knowledge graphs.
1. Unifying Large Language Models and Knowledge Graphs: A Roadmap.
https://arxiv.org/abs/2306.08302
2. Microsoft Research's GraphRAG paper and a review paper on various uses of knowledge graphs:
https://www.microsoft.com/en-us/research/blog/graphrag-unlocking-llm-discovery-on-narrative-private-data/
Neuro-symbolic is not enough, we need neuro-*semantic*Frank van Harmelen
Neuro-symbolic (NeSy) AI is on the rise. However, simply machine learning on just any symbolic structure is not sufficient to really harvest the gains of NeSy. These will only be gained when the symbolic structures have an actual semantics. I give an operational definition of semantics as “predictable inference”.
All of this illustrated with link prediction over knowledge graphs, but the argument is general.
Elevating Tactical DDD Patterns Through Object CalisthenicsDorra BARTAGUIZ
After immersing yourself in the blue book and its red counterpart, attending DDD-focused conferences, and applying tactical patterns, you're left with a crucial question: How do I ensure my design is effective? Tactical patterns within Domain-Driven Design (DDD) serve as guiding principles for creating clear and manageable domain models. However, achieving success with these patterns requires additional guidance. Interestingly, we've observed that a set of constraints initially designed for training purposes remarkably aligns with effective pattern implementation, offering a more ‘mechanical’ approach. Let's explore together how Object Calisthenics can elevate the design of your tactical DDD patterns, offering concrete help for those venturing into DDD for the first time!
UiPath Test Automation using UiPath Test Suite series, part 3DianaGray10
Welcome to UiPath Test Automation using UiPath Test Suite series part 3. In this session, we will cover desktop automation along with UI automation.
Topics covered:
UI automation Introduction,
UI automation Sample
Desktop automation flow
Pradeep Chinnala, Senior Consultant Automation Developer @WonderBotz and UiPath MVP
Deepak Rai, Automation Practice Lead, Boundaryless Group and UiPath MVP
The Art of the Pitch: WordPress Relationships and SalesLaura Byrne
Clients don’t know what they don’t know. What web solutions are right for them? How does WordPress come into the picture? How do you make sure you understand scope and timeline? What do you do if sometime changes?
All these questions and more will be explored as we talk about matching clients’ needs with what your agency offers without pulling teeth or pulling your hair out. Practical tips, and strategies for successful relationship building that leads to closing the deal.
Securing your Kubernetes cluster_ a step-by-step guide to success !KatiaHIMEUR1
Today, after several years of existence, an extremely active community and an ultra-dynamic ecosystem, Kubernetes has established itself as the de facto standard in container orchestration. Thanks to a wide range of managed services, it has never been so easy to set up a ready-to-use Kubernetes cluster.
However, this ease of use means that the subject of security in Kubernetes is often left for later, or even neglected. This exposes companies to significant risks.
In this talk, I'll show you step-by-step how to secure your Kubernetes cluster for greater peace of mind and reliability.
Epistemic Interaction - tuning interfaces to provide information for AI supportAlan Dix
Paper presented at SYNERGY workshop at AVI 2024, Genoa, Italy. 3rd June 2024
https://alandix.com/academic/papers/synergy2024-epistemic/
As machine learning integrates deeper into human-computer interactions, the concept of epistemic interaction emerges, aiming to refine these interactions to enhance system adaptability. This approach encourages minor, intentional adjustments in user behaviour to enrich the data available for system learning. This paper introduces epistemic interaction within the context of human-system communication, illustrating how deliberate interaction design can improve system understanding and adaptation. Through concrete examples, we demonstrate the potential of epistemic interaction to significantly advance human-computer interaction by leveraging intuitive human communication strategies to inform system design and functionality, offering a novel pathway for enriching user-system engagements.
DevOps and Testing slides at DASA ConnectKari Kakkonen
My and Rik Marselis slides at 30.5.2024 DASA Connect conference. We discuss about what is testing, then what is agile testing and finally what is Testing in DevOps. Finally we had lovely workshop with the participants trying to find out different ways to think about quality and testing in different parts of the DevOps infinity loop.
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...DanBrown980551
Do you want to learn how to model and simulate an electrical network from scratch in under an hour?
Then welcome to this PowSyBl workshop, hosted by Rte, the French Transmission System Operator (TSO)!
During the webinar, you will discover the PowSyBl ecosystem as well as handle and study an electrical network through an interactive Python notebook.
PowSyBl is an open source project hosted by LF Energy, which offers a comprehensive set of features for electrical grid modelling and simulation. Among other advanced features, PowSyBl provides:
- A fully editable and extendable library for grid component modelling;
- Visualization tools to display your network;
- Grid simulation tools, such as power flows, security analyses (with or without remedial actions) and sensitivity analyses;
The framework is mostly written in Java, with a Python binding so that Python developers can access PowSyBl functionalities as well.
What you will learn during the webinar:
- For beginners: discover PowSyBl's functionalities through a quick general presentation and the notebook, without needing any expert coding skills;
- For advanced developers: master the skills to efficiently apply PowSyBl functionalities to your real-world scenarios.
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf91mobiles
91mobiles recently conducted a Smart TV Buyer Insights Survey in which we asked over 3,000 respondents about the TV they own, aspects they look at on a new TV, and their TV buying preferences.
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Albert Hoitingh
In this session I delve into the encryption technology used in Microsoft 365 and Microsoft Purview. Including the concepts of Customer Key and Double Key Encryption.
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Ramesh Iyer
In today's fast-changing business world, Companies that adapt and embrace new ideas often need help to keep up with the competition. However, fostering a culture of innovation takes much work. It takes vision, leadership and willingness to take risks in the right proportion. Sachin Dev Duggal, co-founder of Builder.ai, has perfected the art of this balance, creating a company culture where creativity and growth are nurtured at each stage.
8. “The literature on software and systems
engineering is almost unanimous in
recognizing the existence of a major problem
in the specification and design of large scale
and complex reactive systems.”
-- David Harel, Statecharts: A Visual Formalism For Complex Systems, 1987
26. Button View Exercise
Exercise: create a statechart that models the behavior of a button view:
1. action fires on mouseUp event only if the mouse is over the button
2. when the mouse is over the button, it should show a hover image
Events:
mouseEntered
mouseExited
mouseDown
mouseUp
mouseMoved
42. Resources
• Statecharts: A Visual Formalism For Complex Systems, David Harel
• Constructing the User Interface with Statecharts, Ian Horrocks
• Practical UML Statecharts in C/C++, Miro Samek
• Erich Ocean Sproutcore Training, http://erichocean.com/training/app.html, US
$99
• Ki Documentation: https://github.com/frozencanuck/ki
• Stativus website: http://stativ.us/
• Statecharts in the Making: a Personal Account, David Harel
• Stativus on github: https://github.com/etgryphon/stativus
• Omnigraffle to draw the statecharts
• NI LabView Statecharts: http://www.ni.com/white-paper/6194/en & http://
www.ni.com/white-paper/7413/en
Editor's Notes
Buenas Tarde. Mi nombre es Luc Castera y hoy voy a hablar de Statecharts. Esta charla tiene dos partes. En la primera, vamos a aprender que son statecharts y como se usan. En la segunda parte, vamos a ver como usar Stativus para crear un Statechart.\n
Podemos dividir todo proyectos de software en 7 fases, desde la iniciacion hasta el mantenimiento. Cuando hablamos de statechart, se trata de las fases de especification y de diseno. La implementacion viene despues que tenemos nuestro diseno y statecharts listos. Entonces, para poder implementar statecharts, primero tenemos que entender como funcionan. Por eso, una gran parte de esta charla va a ser mas teoria. Pero al fin, vamos a ver como implementar lo que aprendemos y escribir un poco de codigo.\n
Podemos dividir todo sistemas de software en 2 categorias. La primera categoria trata de sistemas transformationales donde tenemos un output for cada input. Lo que pasa a dentro de esa funcion solo cambia si el input cambia. Nosotros programadores son bien acostumbrados a este tipo de sistemas.\n
Pero tambien hay un otro tipo de sistemas que llamamos sistemas reactivos, que son ‘event-driven’. Estos sistemas tienen que cambiar de estado o reaccionar cuando pasa algo. Estos eventos pueden ser internos o externos.\n
Un ejemplo de un sistema reactivo es un reloj. Cuando tu manejas el boton al lado del reloj para cambiar la hora o la fecha, el sistema tiene que hacer algo. Entonces, el sistema siempre esta esperando que pasa algo y sabe como cambiarse cuando recibe un evento.\n
Un otro ejemplo mas cerca de nosotros son los Browsers o aplicaciones web que tienen que reaccionar cuando un usuario hace un lick, escribe algo, o mueve su mouse.\n
Usamos Javascript en el Browser para escuchar estos eventos. Pero tambien, en el servidor, con node.js por ejemplo, una aplicacion puede recibir eventos. Node.js es una plataforma de javascript que puedes usar en un servidor. Node.js es famoso por ser ‘event-driven’ entonces es un buen ejemplo de un sistema reactivo.\n
Pero hay un problema con sistemas reactivos. Durante anos, no habia una buena manera de especificar y disenar sistemas reactivos muy complejos. En 1987, David Harel, mientras trabajando por el Israel Aircarft Industries, publicó un papel intitulado “Statecharts: A visual Formalism for Complex Systems”. En este papel, que recomendo leer, el describe una manera de representar sistemas reactivos complejos usando Statecharts.\n
Pero que son statecharts?\n
La manera mas rapida, de definir un statechart es asi. Statecharts son ‘state diagrams’ pero con 3 cosas addicionales. Primero, un state diagram es algo plano mientras un statechart te permite representar profundidad con multiples planos. Tambien, state diagrams no tienen una manera de representar cosas que se produzcan al mismo tiempo, en paralelo. Statecharts hacen eso. Y finalmente, statecharts tiene una manera de representar communicacion en modo ‘broadcast’.\n
Todo esto parece bien complicado pero la verdad es que es muy simple. Vamos a aprender como hacer un statecharts y la notación oficial de los statecharts.\n\nQue presten atencion porque al fin van a tomar un examen :-)\n
Este es un statechart muy simple. Tiene 3 estados: A, B, y C. Tiene 2 eventos. El evento D, tiene una condicion E. Entonces, si estamos en el estado A, y recibimos un evento D, si la condicion E es verdadera, vamos a ir al estado B. Del estado B, si recibimos un evento F, vamos a ir al estado C, pero tambien vamos a hacer la accion ‘writeMessage’. Los parentensis representant una condicion, y la notacion F / writeMessage representa una accion que debemos tomar cuando cambiamos de estado.\n
Tambien hay eventos que deben tomar una acion sin cambiar de estado, como el evento G en este Statechart. Esos se llaman ‘internal events’ o eventos internos. Usamos esta notacion para representarlos.\n
Este statechart es el mismo que el de antes pero con un evento adicional, el evento H. Podemos ver que en dos estados, el B y el C, el evento H nos hacemos ir al estado A. Todo esta claro?\n
En este caso, podemos agrupar los eventos B y C, y tener solo una flecha para el evento H. Esto es lo que llamamos ‘clustering’. Aca tenemos un nuevo estado G que es un grupo de estados. Entienden eso?\n
Cuando tienes un statechart muy complicado, a veces es impossible poner todo el statechart en una pagina, en este caso puedes mostrar el grupo G de la pagina antes, de esta manera. Es como si hicimos un zoom-out para ver el statechart desde mas lejos. Claro que tenemos que definir lo que hay adentro del grupo G pero lo podemos hacer en una otra pagina. Asi podemos representar problems muy complejos con un statechart pero en muchas paginas.\n
Hay algo importante que no hemos visto en los ultimos statechart: como empeza todo? Un statechart necesita un ‘default state’ o un estado por defecto donde vamos a empezar. En este ejemplo, cambie un poquito el statechart para mostrar que vamos a iniciar el statechart en el estado A. Tambien, cuando entramos el estado G, vamos a ir primero al estado B.\n
Hay un otro concepto importante que es el concepto de Historia. En este statechart, pueden ver que el ‘default state’ del grupo G tiene una flecha que va a un circulo con un H. Eso es la notacion para la historia. Eso significa, que cuando entramos el estado G, vamos a ir al estado entre B y C donde estabamos la ultima vez que fuimos en el estado G. Si es la primera vez que entramos el estado G, vamos a ir al estado B.\n
Tambien hay un concepto de deep History con la notacion H*. Esto significa que vamos a conserer la historia no solo del grupo G, pero tambien de los grupos adentros: los grupos B y C. Esto es un tema bien avanzado que nunca he tenido que utilizar entonces avanzamos.\n
Un statechart tambien puede tener ‘transient states’ que son estados ‘de pasajes’. Estos estados cambian de estados sin la participacion del usuario del software. Por ejemplo, imaginate que cuando entramos el estado Z, hicimos un Ajax request para ver si el usuario tiene una cuenta y esta logged in. Despues de un rato, vamos a recibir la repuesta del servidor y cambiar de estadio.\n
A veces un sistema tiene differentes partes que estan en estados differentes al mismo tiempo. Tambien hay una notacion para esto como pueden ver aca. Cuando este statecharts empeza, vamos a estar en el estado B y el estado D al mismo tiempo. Siempre vamos a estar en dos estados. Puede ser B y D o C y F o C y D., etc....\n
Bueno, ya aprendimos casi toda la teoria de statecharts. Hay otros conceptos mas complicados que no vamos a ver hoy porque son conceptos mas avanzados que no siempre van a usar. Con lo que ya aprendimos hoy, podemos hacer mucho. Hace casi 2 anos que estoy usando statecharts y pienso que nunca he utilizado un concepto afuera de los que vimos ahora. Pero si quieren aprender mas sobre statecharts, el papel de Harel es muy bueno.\n\nAhora vamos a ver unos ejemplos. El primero viene directamente del papel de Harel.\n
En el papel de Harel, explican como construir el statechart para este reloj digital que tiene 4 botones para cambiar la hora, la fecha, las 2 alarmas, la luz, etc...\n
Esto es el statechart :-)\n\nNo lo vamos a estudiar, lo pongo aca solo para que tengan una idea de un statechart de un tamaño un poco mas grande. Pero aca se puede ver que tenemos estados en paralelos. El mas importante es el que controla la pantalla. Los otros son muy simples: controlan el estado de las alarmas o la luz. Por ejemplo, el de la luz es super simple.\n\n
Aca tengo un otro ejemplo, es tu applicacion sin statecharts donde usas un monton de variables y boolean para mantener estados diferentes.\n\nEn realidad, lo que haces es usar un solo estado unico y usas variables y funciones por todo lado. A veces tienes que tener variables globales...\n\nEso puede ser feo, pero tambien no es muy estable porque cualquier accion puede pasar a cualquier tiempo si olvidaste de chequear un variable. En este tipo de applicaciones, bugs son mas comunes.\n\nBuenos, se sienten seguros que entienden todo y estan listos para cambiar eso y construir sus propios statecharts?\n
Aca tengo un pequeno ejercicio que vamos a hacer. Ustedes tienen 5 minutos para hacerlo. Tengo papel y lapices aca para los que necesitan.\n\nVamos a escribir el statechart para un boton en un browser. Ustedes ya saben como funcionan:\n1. si pulsas y sueltas el boton mientras el cursor esta adentro del boton, el accion se dispara.\n2. Cuando el mouse esta adentro del boton, el boton debe ser de una otro color.\n\nBueno, tienen 5 minutes para el ejercicio. Si tienen preguntas, me consultan.\n
Aqui esta la solucion. No se puede hacer con menos que 4 estados sin tener bugs.\n\nVoy a darles unos minutos para revisar la solucion y ver si entienden todo o si tienen preguntas.\n\nAlgunos estaban cercas?\n\nBuenos, la verdad es que esta solucion tiene un bug que a veces han encontrado en software que utilizan. Hasta Mac OS X tenia este bug en el pasado. Vamos a arreglar el statechart para matar a este bug.\n
El bug se manifesta cuando empezamos la applicacion, no podemos empezar la applicacion en el ‘Mouse Out Mouse Up’ state sin chequear primero si no estamos adentro del boton. Entonces, aca necesitamos un ‘transient state’ para ver si estamos a dentro del boton al principio.\n
Bueno, ahora que entiendan como usar statecharts, la pregunta es: porque?\n\nPorque usarlos en nuestras applicaciones?\n
Ya vimos que son buenos para documentar la especification de applicaciones complejos.\n
Pero tambien son buenos para communicar con tus compañeros. En particular, un non-techie no va a leer tu codigo pero pueden ver un statechart y entender lo que paso.\n\nPor ejemplo, es una buena manera de communicar con tu equipo de QA testing.\n
Pero la primera razon porque me gusta usarlos es porque te hacen pensar antes que escribes una linea de codigo.\n\nA veces, nosotros programmadores atacan un problemo muy rapido sin sentarse y pensar a todo los casos que pueden pasar.\n\nCuando tengo que disenar un sistema reactivo, trato primero de disenar todo el statechart antes de escribir una linea de codigo. Cuando hago eso, mis aplicaciones tienen menos bugs y desarollo mas rapido porque ya tengo todo el sistema en frente de mi.\n
Una aplicacion que usa statecharts siempre es mas estable que una que no usa statecharts.\n\nla razon es simple, si un evento pasa y no estas en un estadio que debe tener una reaccion con este evento, nada pasa. Es simple, pero es impresionante como un concepto tan simple puede hacer tu applicacion mas estable.\n\nLo que hacemos es isolar partes de nuestro codigo, a cada momento, siempre estamos usando solo una parte del codigo, el resto no se applica porque no estamos en un estado donde se puede usar.\n
Finalmente, usar statecharts es una buena manera de verificar que estas testeando todos lo que puede suceder en tu applicacion. Luego si tengo tiempo voy a demonstrar una tecnica para hacer eso.\n
\n
Ya hablamos demasiado de teoria, ahora vamos a ver codigo!\n\nEn particular vamos a aprender como usar Stativus, una libreria escrito en Javascript por Evin Grano para escribir statecharts.\n
Vamos a programar el boton que diseñamos juntos con un statechart. El codigo esta en mi cuenta de github para que los pueden ver.\n