Slashdot Mirror


How Reactive Programming Differs From Procedural Programming

Nerval's Lobster writes "A recent post on Reactive Programming triggered discussions about what is and isn't considered Reactive Logic. In fact, many have already discovered that Reactive Programming can help improve quality and transparency, reduce programming time and decrease maintenance. But for others, it raises questions like: How does Reactive differ from conventional event-oriented programming? Isn't Reactive just another form of triggers? What kind of an improvement in coding can you expect using Reactive and why? So to help clear things up, columnist and Espresso Logic CTO Val Huber offers a real-life example that he claims will show the power and long-term advantages Reactive offers. 'In this scenario, we'll compare what it takes to implement business logic using Reactive Programming versus two different conventional procedural Programming models: Java with Hibernate and MySQL triggers,' he writes. 'In conclusion, Reactive appears to be a very promising technology for reducing delivery times, while improving system quality. And no doubt this discussion may raise other questions on extensibility and performance for Reactive Programming.' Do you agree?"

15 of 186 comments (clear)

  1. Marketing 101 by s.petry · · Score: 4, Insightful

    There really is no such thing, they just made up the term for attention. What he is describing might be called "tools" programming, but it's not new or different. I have written "Tools" in various languages for over 20 years. If they think they are going to market a few bucks with a "re-branding" program good for them. It worked for "Cloud" and I knew better then too.

    --

    -The wise argue that there are few absolutes, the fool argues that there are no probabilities.

    1. Re:Marketing 101 by Anonymous Coward · · Score: 5, Funny

      Here's a quote for your marketing:
      Q: How does reactive programming differ from procedural programming?
      A: People use procedural programming, they only talk about reactive programming.

    2. Re:Marketing 101 by sunderland56 · · Score: 4, Funny

      There really is no such thing,

      Of course there is - I've been reactive programming for years. My boss yells at me to do something, and I react.

  2. All methodologies are the same. by hamster_nz · · Score: 5, Insightful

    1) The proactive, forward looking teams adopt it first, and have great success.

    2) The "emerging trend followers" hop on board, and have reasonable results.

    3) The rest of the industry follow and have mixed results, without it being any more successful than any other methodology.

    Don't be blinded - initial results always look very promising.

    Anybody around here remember Jackson Structured Programming The initial OOP wave? The whole CASE moevement? GUI application builders that were supposed to end the need for programmers?

    The golden rule is that "whatever methodology technology you choose, half of adopters will always get sub-average results". The question you have to ask yourself Is are your team smarter than the average team?

    1. Re:All methodologies are the same. by msobkow · · Score: 4, Insightful

      Absolutely.

      The longer you spend in programming, the more you realize it's all been done in years past and it's just some "new grad" thinking they've invented something because they never looked into the history of programming techniques used over the years, or because they never happened to touch the systems that did it before.

      I've been programming for over 35 years.

      I've come to the conclusion that it's all about marketting buzz-words and bullshit to try and sucker investors into spending money, not about actually improving the way people write code or think about problems.

      --
      I do not fail; I succeed at finding out what does not work.
    2. Re:All methodologies are the same. by hibiki_r · · Score: 4, Interesting

      Like every other question about software development, we should always start with The Mythical Man Month. In this case, the relevant chapter is There Is No Silver Bullet.

      Now, the interesting thing about that chapter is that, while it was right, it was the least right of all the good predictions Brooks made. No technology is a silver bullet, but many produce noticeable improvements that, when put together, can give us an order of magnitude in productivity over older tech. It's not as if OO has been abandoned. Case tools were replaced by the far more sensible powerful IDE. GUI builders are not used a lot nowadays, but we get many of their gains by having dev environments with tighter feedback loops. And there's of course the mother of all improvements, which is the creation of large, powerful libraries. How many of the things that people did for business applications 15 years ago are, today, just replaced by libraries?

      Not that this denies your final thesis though: Hire bright programmers with people skills, and do your best to keep them. No technology will allow bad developers to make a good application.

    3. Re:All methodologies are the same. by lgw · · Score: 4, Insightful

      The nice thing is after 10-15 year or so, all problems start to look familiar to you, but not so much to the young guys or the managers. You can either rebel against the latest old thing new again and seem a Luddite, or seem a genius for immediately seeing all the pitfalls and optimizations entailed in the "new" idea.

      --
      Socialism: a lie told by totalitarians and believed by fools.
  3. Woohoo by viperidaenz · · Score: 5, Insightful

    Yet another super awesome framework/system/language/whatever to make a shopping cart in as few lines as possible.

    The someone tries to build something remotely complex and it all falls to shit and the code ends up as spaghetti.
    The guy who built it then leaves the company and they can't find anyone else with the skills to understand how it works

  4. A Day at the Country Fair by MightyMartian · · Score: 5, Funny

    Buzz words! Get your red hot buzzwords! These buzzwords are fresh folks! No one's even figured out what they mean yet! You snooze, you lose! You there, little boy, I bet you could use Web 3.0!

    --
    The world's burning. Moped Jesus spotted on I50. Details at 11.
    1. Re:A Day at the Country Fair by similar_name · · Score: 4, Funny

      I bet you could use Web 3.0!

      I'm going to wait for Web 3.11 for Workgroups.

  5. Re:History repeats by jc42 · · Score: 4, Interesting

    We used to make websites by regenerate all html pages when the database changes. It delivers really fast then.

    Yeah, that's "reactive programming" at the file level. I do it all the time, with Makefiles. Lots of people do. A nice thing about a Makefile is that you can easily control when the calculation of derivative files happens. You (re)create some sets of primary data, then use a simple "make" command to rebuild everything that depends on any of them.

    This is yet another illustration that the perps who introduced this supposedly-new concept have mostly just found a new buzzword for an approach that has been reinvented repeatedly in the past.

    One of the ongoing problems in many fields of science and technology is the constant rediscovery (or reinvention if you prefer) of concepts long known by others that just use different words for the concepts.

    Actually, mathematicians long ago realized this, and have a standard term for things that are described differently but are actually identical: They're generally called "isomorphic". A classical example that's important in computers was George Boole's "Boolean algebra", invented primarily as an exercise in pure logic. Eventually people noticed that it was isomorphic to the "propositional calculus", and then as electricity became widely available, engineers found that their new "circuit switching calculus" was another isomorphism. That's why so many programming languages have those AND, OR, XOR, NOT, etc operators.

    This crowd is merely giving us another entry in the rather long list of isomorphic systems that differ only in their terminology. This means time wasted re-developing your system from scratch, when you could have saved a lot of time if you'd only realized that others had already solved your problem for you. But we don't have a good way to discover that two systems described with different words really are the same thing.

    (Or do we? Maybe some mathematical linguists are working on the problem right now, and we don't realize this because we don't recognize their terminology.)

    --
    Those who do study history are doomed to stand helplessly by while everyone else repeats it.
  6. Spreadsheets are lousy programming models by putaro · · Score: 5, Interesting

    Their presentation makes analogies between "reactive programming" and spreadsheets and specifically references the power of "chaining" to have multiple functions firing as the result of changes.

    There are a number of issues with this kind of event chaining that you run into as you get past the toy cases.

    1) Fan-out. How many actions are being kicked off by a simple change?
    2) Latency - this is a direct corollary to the fanout. Are all of the chained functions being run synchronously? If so, what happens when someone introduces a very slow function that gets run as the result of a user input. So the user changes the price of a part and every purchase order in the system is suddenly being updated?
    3) Synchronicity - of course, as soon as you find out that your synchronously run chained functions slow things down you start running them in the background. Now, you have a problem where you don't know if something is up-to-date or not. And, in this model, it's not possible to find out if something is up-to-date.

    The examples that they gave are very poor use cases for triggers even. Most general ledger systems I've looked at, running on top of a database, would just recalculate the balance on demand. If your database is large enough that the recalculation starts to take significant time, you cache the result and invalidate it using a trigger. Most GL systems typically make entries much more frequently than they need to calculate the balance for an account. If the recalculation of the balance takes significant time, you probably don't want to do it every time an entry is made anyhow.

  7. Re:what "Reactive Programming" really is by Prien715 · · Score: 4, Funny

    from what i've read on wikipedia, "Reactive Programming" is really just function as a variable with caching.

    example:

    c = 5
    b = 4
    a = b + c
    print(a) // outputs 9
    c = 6
    print(a) // outputs 10

    this isnt rocket surgery

    c=a + b ...behold the infinite loop is born!

    --
    -- Political fascism requires a Fuhrer.
  8. Is it webscale? by Hognoxious · · Score: 4, Insightful

    You've told us what it isn't. That's as much use as telling us that strawberries are not yellow and curved.

    --
    Confucius say, "Find worm in apple - bad. Find half a worm - worse."
  9. Re:I thought that we were supposed to be pro-activ by metamarmoset · · Score: 5, Informative

    The point of new paradigms in programming languages is to make the complexity of the expression match the complexity of the idea being expressed, not the complexity of the (platform specific) implementation.

    Crappy illustration:

    C++ - Event-trigger
    vector triggers;

    void add_trigger(Trigger * t);

    void reactive_variable::modify_value(int new_value)
    {
    // event
    this.value = new_value;
    // trigger
    for (i = triggers.begin(); i != triggers.end(); i++){
    i.react(new_value);
    }
    }

    // actual code you want to get around to actually writing
    int main()
    {
    reactive_variable a;
    Trigger *b = new Trigger(COPY_VAR);
    a.add_trigger(b);
    Trigger *c = new Trigger(ADD_VAR, 1);
    a.add_trigger(c);

    a.modify_value(2);

    enter_event_loop(); // some routine that modifies a continuously

    return 0;
    }

    Incomplete, inelegant and probably buggy, but you get the picture.

    Verilog - Reactive
    assign b = a;
    assign c = a+1;

    inital a = 2;

    always @(posedge clk)
    a = count(input);

    Easy to understand whats going on and spot errors. 'b' will always equal 'a' and 'c' will always be one more.