Author | Message |
---|---|
rabbott
Posts: 1649
|
Posted 20:53 Nov 15, 2013 |
I just watched the Week 2 videos for the Reactive Programming class. Odersky says that functional programming is not the correct tool for some classes of problems. (And reactive programming is going to be one of those classes of problems.) Most of the videos were quite elementary. He reviewed mutable elements that change with assignment, and he reviewed loops. (Interestingly mutability was defined as the condition that the state of an object depends on its history.) The second half of the videos developed a basic discrete event simulation framework. The underlying model consisted of objects that respond to events. Although he didn't put it that way, this is essentially the reactive programming model. So this is presumably a simple example of reactive programming. The specific discrete event simulation he developed was one for boolean circuits. He developed a number of basic classes like Wire, And, Or, etc., linked them up into a half adder (and a full adder), and then turned on the simulator. Once it was running he could put signals on the input wires and see the results appear on the output wires. All very neat -- and not very difficult. This is definitely not functional programming since the model being simulated changes as its inputs change. But it makes very nice use of Scala's higher level language capabilities. I haven't looked at the homework yet, but I recommend the videos to those of you who may be interested. Last edited by rabbott at
21:06 Nov 15, 2013.
|
rabbott
Posts: 1649
|
Posted 15:24 Nov 16, 2013 |
I did the first half of the Reactive Programming assignment for Week 2. It requires a very different way of thinking. The hard part was building the demultiplexer. It's really a matter of constructing something rather than computing something. More like playing with lego blocks than evaluating expressions. The assignment doesn't require a sophisticated knowledge of Scala, but it does require a certain amount of intellectual flexibility. As I said, it's not like traditional functional programming. The challenge in the demux problem is that you have to generate the lego blocks as you go. So you build a structure out of pieces that you generate dynamically. I hope some of you work on this. I'd like to compare my solution to yours. Last edited by rabbott at
15:25 Nov 16, 2013.
|
rabbott
Posts: 1649
|
Posted 21:30 Nov 18, 2013 |
I decided not to do the second half of the assignment. It was to build a simulation of disease propagation. I believe that I understand the general idea of how this sort of simulation works in this framework, but it looked like a lot of work to complete the assignment. So I'm not doing it. |