Reactive Android Development

Slides:



Advertisements
Similar presentations
Introduction to Macromedia Director 8.5 – Lingo
Advertisements

Written by: Dr. JJ Shepherd
Chapter 8Java: an Introduction to Computer Science & Programming - Walter Savitch 1 Chapter 8 l Basic Exception Handling »the mechanics of exceptions l.
Slides prepared by Rose Williams, Binghamton University Chapter 17 Swing I.
A CHAT CLIENT-SERVER MODULE IN JAVA BY MAHTAB M HUSSAIN MAYANK MOHAN ISE 582 FALL 2003 PROJECT.
Fall 2007CS 2251 Enum Types from Java Software Solutions Foundations of Program Design Sixth Edition by Lewis & Loftus.
Chapter 6. 2 Objectives You should be able to describe: Function and Parameter Declarations Returning a Single Value Pass by Reference Variable Scope.
Chapter 1 Program Design
Week 14 - Monday.  What did we talk about last time?  Image manipulation  Inheritance.
1 Debugging and Testing Overview Defensive Programming The goal is to prevent failures Debugging The goal is to find cause of failures and fix it Testing.
A First Book of C++: From Here To There, Third Edition2 Objectives You should be able to describe: Function and Parameter Declarations Returning a Single.
Java Threads. What is a Thread? A thread can be loosely defined as a separate stream of execution that takes place simultaneously with and independently.
A First Book of ANSI C, Fourth Edition1 Functions for Modularity 04/24/15.
CSC1401 Classes - 2. Learning Goals Computing concepts Adding a method To show the pictures in the slide show Creating accessors and modifiers That protect.
Grade Book Database Presentation Jeanne Winstead CINS 137.
Computer Programming with JAVA Chapter 8. Exception Handling Basic Exception Handling the mechanics of exceptions Defining and Using Exceptions some "simple"
JavaScript, Fourth Edition
Fall 2002CS 150: Intro. to Computing1 Streams and File I/O (That is, Input/Output) OR How you read data from files and write data to files.
Chapter 10: Introduction to Inheritance. Objectives Learn about the concept of inheritance Extend classes Override superclass methods Call constructors.
A FIRST BOOK OF C++ CHAPTER 6 MODULARITY USING FUNCTIONS.
CSCI1600: Embedded and Real Time Software Lecture 16: Advanced Programming with I/O Steven Reiss, Fall 2015.
Written by: Dr. JJ Shepherd
CISC105 – General Computer Science Class 4 – 06/14/2006.
Program Design. Simple Program Design, Fourth Edition Chapter 1 2 Objectives In this chapter you will be able to: Describe the steps in the program development.
Introduction to Exceptions in Java CS201, SW Development Methods.
Functional Processing of Collections (Advanced) 6.0.
Variable Scope. When you declare a variable, that name and value is only “alive” for some parts of the program  We must declare variables before we use.
Paul Ammann & Jeff Offutt
The Object-Oriented Thought Process Chapter 14
Lecture 14 Throwing Custom Exceptions
Reactive Android Development
Review What is an object? What is a class?
Chapter 2 Scanning – Part 1 June 10, 2018 Prof. Abdelaziz Khamis.
Paul Ammann & Jeff Offutt
C++ coding standard suggestion… Separate reasoning from action, in every block. Hi, this talk is to suggest a rule (or guideline) to simplify C++ code.
CS 1321.
Functional Processing of Collections (Advanced)
Chapter 19 Java Never Ends
Algorithm and Ambiguity
CMPE212 – Stuff… Exercises 4, 5 and 6 are all fair game now.
CSCI1600: Embedded and Real Time Software
Writing Functions( ) (Part 5)
Reactive Android Development
Android Programming Lecture 8
PROGRAMMING IN HASKELL
“eff” of x Friday, 23 November 2018.
Fundamental Error Handling
VHDL Discussion Subprograms
Fundamentals of Data Structures
Constructors and Other Tools
CS 1111 Introduction to Programming Fall 2018
Coding Concepts (Basics)
Multithreaded Programming
Algorithm and Ambiguity
Reactive Android Development
VHDL Discussion Subprograms
Review for Test2.
CS210- Lecture 5 Jun 9, 2005 Agenda Queues
Fall 2018 CISC124 2/24/2019 CISC124 Quiz 1 marking is complete. Quiz average was about 40/60 or 67%. TAs are still grading assn 1. Assn 2 due this Friday,
For loops Taken from notes by Dr. Neil Moore
Riding the bus.
CMPE212 – Reminders Quiz 1 marking done. Assignment 2 due next Friday.
Exceptions 10-May-19.
Event loops.
LCC 6310 Computation as an Expressive Medium
CMPE212 – Reminders Assignment 2 due next Friday.
CMSC 202 Exceptions 2nd Lecture.
Exception Handling and Event Handling
CMSC 202 Exceptions.
Exceptions and networking
Presentation transcript:

Reactive Android Development CS 4593-02T & CS 5463-01T Summer 2016 More Sodium FRP

More about merge Simultaneous Events! For streams S1 and S2 S1.orEsle(S2) S1 takes precedence if S1 and S2 are simultaneous S1.merge(s2,combining_function) The stream produces an event with value combining_function(S1,S2)

Value Loops Sometimes a Value must be defined in terms of itself An accumulator is a simple example For(Integer change : changes) { acc += change; }

Value Loops This is a bit of a problem for Sodium (at least for reactive graphs built in Java) Sodium Cells and Streams can only be defined once, but you need the before the definition in order to create the definition.

Value Loops To get around this, Sodium provides two 'placeholders' CellLoop StreamLoop The constructor for each is just empty It's just a promise that the loop will be closed in the future The CellLoop or StreamLoop can then be used as an input to map, lift, snapshot, and merge as usual. The final definition takes place in <ValueLoopVar>.loop( <definition>)

Value Loop Between the time that you start using the loop and the call to <Var>.loop(…) the reactive graph is in a precarious state. The connections haven't really been made properly yet To protect against this, all of those operations must take place within a single transaction Sodium will throw an exception if you try to do otherwise.

Transaction Every change to a sodium value (Cell or Stream) takes place within a transaction Most of the time it is created automatically Snapshots of Cells yield the value before the transaction.

Switch One of the advantages that I claimed about FRP is that each cell or stream is declared only once. This can greatly improve the clarity of the design. My Claim: Once you are used to reading FRP code, understanding the behavior of someone else's code is simpler with FRP than is usually the case.

Switch However, this limits your program to having a fixed structure Number of "objects" Number of inputs Etc.

Switch Provides a compromise The definition of a cell can be changed by defining it as a switch on an input made up of cells The cell is still defined only once and it is clear that its meaning can change The code that can change its meaning is limited to that used in its definition

Inputs and Outputs The FRP book waits until chapter eight to tell you how to send input into your sodium graph This is because the author wants the reader to think declaratively But interacting with the outside world requires us to lose some of that purity.

StreamSink/CellSink Provide a way for imperative code to send events or values into the reactive graph. Can not be called from within a transaction! NO CHEATING!

Listen Cells and Streams can be "listened to" You provide a handler and update the rest of your program with the results of your sodium calculation.