News for hackers. Stuff that matters.
Re:ReactiveCocoa for a better world by notJim on Friday May 04, 2012 @02:37PM (#3929719)
For those not familiar, it looks like this is the take on ideas from Reactive Extensions (Rx): http://msdn.microsoft.com/en-us/data/gg577609. I'm not sure if Rx itself has a direct predecessor or not, but it's great to see the idea taking hold in other communities. I've long suspected that there is a lot of great stuff in the .Net world that most open-source-oriented programmers never see, simply because they don't have exposure to Microsoft technology.
Re:ReactiveCocoa for a better world by xpaulbettsx on Friday May 04, 2012 @04:31PM (#3930208)
Here's what Rx is: The idea of a list are some items in an order (a Sequence in FP-speak). On top of a Sequence you can implement all kinds of interesting operations like map/filter/reduce.

If you look at an Event like KeyUp, you'd end up with some items, in a particular order. Thus, you realize, that events and lists really are the same thing. In fact, they're not only ostensibly the same, they are mathematically provable to be the same.

Rx therefore, gives you all the operations you can do to a list, and applies it to an event (or a callback, which is just an event that only happens once).

Re:ReactiveCocoa for a better world by scarmig on Friday May 04, 2012 @04:54PM (#3930325)
I enjoyed your book! Are there any plans for an updated or expanded version?

If anyone wants a simple introduction to Rx, Paul Betts (and Jesse Liberty) wrote one last year.

http://www.amazon.com/Programming-Reactive-Extensions-Jesse-...

Re:ReactiveCocoa for a better world by xpaulbettsx on Friday May 04, 2012 @04:59PM (#3930347)
Thanks! No plans for a 2nd edition yet, but I definitely have a lot I'd like to add.
Re:ReactiveCocoa for a better world by swannodette on Friday May 04, 2012 @02:47PM (#3929759)
I believe Rx is an OOish take on some older FP ideas http://en.wikipedia.org/wiki/Reactive_programming
Re:ReactiveCocoa for a better world by untog on Friday May 04, 2012 @06:06PM (#3930540)
LINQ. Someone please bring stuff like LINQ to other languages!

Edit: it appears that the MS Reactive Extensions are LINQ-y. Not sure if ReactiveCocoa is the same.

Re:ReactiveCocoa for a better world by eblume on Friday May 04, 2012 @02:26PM (#3929657)
This sounds neat, but I want to ask others here as I am not (yet) a Cocoa developer - is all Cocoa code this ugly? In these short examples I honestly can't fathom what is happening due to the syntactic 'oddities'. Maybe my C-variant-fu is not as strong as it should be.
Re:ReactiveCocoa for a better world by stcredzero on Friday May 04, 2012 @03:20PM (#3929901)
This sounds neat, but I want to ask others here as I am not (yet) a Cocoa developer - is all Cocoa code this ugly?

I am a Cocoa developer, and I have to say that the presentation of this idea on the blog leaves something to be desired. It seems to be oriented towards people already familiar with Reactive Programming and FP, but it doesn't set up that expectation at all. At the same time, it's very confusing and a little unintentionally off-putting for devs who aren't familiar with those notions, even for those who already know Objective-C and KVO.

It still might be a good idea, though.

Re:ReactiveCocoa for a better world by joshaber on Friday May 04, 2012 @03:49PM (#3930037)
That was my fear while I was writing the post :\

The problem with Rx / RAC is there's a big learning curve, especially coming from procedural programming. It's much bigger than 1 blog post can cover. My hope at least is that it will drive at least some people to dive deeper.

Re:ReactiveCocoa for a better world by gte910h on Friday May 04, 2012 @02:32PM (#3929693)
Objective C is smalltalk on top of C. It looks extremely bad when you stick it in the super skinny columnar formats of many blogs.

At 80-300 characters per line it's fine and very readable.

Re:ReactiveCocoa for a better world by berntb on Friday May 04, 2012 @05:08PM (#3930371)
So Objective C programmers can't print code to read it? :-(
Re:ReactiveCocoa for a better world by gte910h on Friday May 04, 2012 @05:41PM (#3930467)
What? The blog is displaying the text narrower than it shows up in a source file. This makes it uglier than it is in actual practice e.g.

What

? The

blog is displaying

the text narrow-

er than it shows up in

a source file

. This

makes it

uglier than it is in

actual prac-

tice

Re:ReactiveCocoa for a better world by berntb on Saturday May 05, 2012 @04:59AM (#3931702)
I got the point, sorry if I was unclear.

My point was, it is hard to print 300 chars wide code. Ideal code width for printing is < 80 chars...

Re:ReactiveCocoa for a better world by gte910h on Saturday May 05, 2012 @10:37AM (#3932207)
I don't print code, but when I do, it's in landscape mode and wider than 80 characters. But hey, I do this for all languages.

I'm pretty sure I've never printed ObjC

Re:ReactiveCocoa for a better world by kstenerud on Saturday May 05, 2012 @09:32AM (#3932077)
Why would you print code in this day and age?
Re:ReactiveCocoa for a better world by poutine on Friday May 04, 2012 @02:29PM (#3929676)
Heh, welcome to the learning curve :)

Yeah, it can be ugly, but once you know what's going on it all reads pretty quickly.

Re:ReactiveCocoa for a better world by FuzzyDunlop on Friday May 04, 2012 @03:32PM (#3929948)
It's not so bad if you give it space to spread out a little. The wrapping in the column makes it much more difficult to follow, especially when used with Xcode's unusual indent style.
Re:ReactiveCocoa for a better world by UK-AL on Friday May 04, 2012 @02:35PM (#3929706)
Eh. You get used to it, then it looks normal. I guess it's the same 'wtf' when beginners see a bunch of meaningless code.
Re:ReactiveCocoa for a better world by irrationalfab on Friday May 04, 2012 @03:20PM (#3929904)
It appears to be personal, but for many the answer is yes... that's why RubyMotion is a big deal.
Re:ReactiveCocoa for a better world by pablasso on Friday May 04, 2012 @03:38PM (#3929982)
RubyMotions looks even uglier for me. It's just like someone stripped all the beauty of Ruby with libraries that weren't meant to pair with it.
Re:ReactiveCocoa for a better world by irrationalfab on Friday May 04, 2012 @04:10PM (#3930123)
The Objective-C syntax doesn't look strange to me, yet its verbosity make the whole picture more difficult to grasp than in Ruby in my opinion. It's somehow like difference between a document and a bullet point reppresentation of it.

However, I haven't made my mind yet about RubyMotion. There are some propositions for it and some against and a lot has to come in the next weeks. Let's see what will happen.

Note: I have been coding in Objective-C for two years and in Ruby for 1-2 months.

Re:ReactiveCocoa for a better world by wsc981 on Friday May 04, 2012 @02:58PM (#3929804)
I guess the blocks-in-blocks code can get quite unreadable at times. Personally I like to store blocks in variables in such situations and add the variable to a function that required the block parameter. Makes code so much more readable when blocks are nested.
Re:ReactiveCocoa for a better world by joshaber on Friday May 04, 2012 @03:02PM (#3929818)
Yeah, we played around with a bunch of different styles, including defining the block before its use. It looked cleaner but the code locality of defining them inline won.
Re:ReactiveCocoa for a better world by swannodette on Friday May 04, 2012 @01:41PM (#3929463)
Awesome to see GitHub getting behind Rx ideas. If you're a JS developer RxJS is definitely worthy of study: http://channel9.msdn.com/Blogs/Charles/Introducing-RxJS-Reac...
Re:ReactiveCocoa for a better world by objclxt on Saturday May 05, 2012 @10:54AM (#3932244)
I've just spent a few hours getting to know ReactiveCocoa better, and what a great framework! Props to GitHub for open sourcing it, and I'm already looking at how to integrate it into some of my apps. I blogged about my first impressions here: http://cleveryou.net/post/22447309056/rac-first-impressions
Re:ReactiveCocoa for a better world by scarmig on Friday May 04, 2012 @03:00PM (#3929812)
Stuff like this makes me want to drop the WebForms work I'm doing for rent and work on my FRP library... le sigh.
Re:ReactiveCocoa for a better world by boothead on Saturday May 05, 2012 @06:12AM (#3931808)
Which FRP library would that be?
Re:ReactiveCocoa for a better world by scarmig on Saturday May 05, 2012 @11:48AM (#3932340)
Unreleased =) The target language is JS (for now, at least), uses arrows and features dynamic switching. Yampa is a major influence.
Re:ReactiveCocoa for a better world by drudru11 on Saturday May 05, 2012 @02:43PM (#3932864)
totally agree, this idea can go further
Re:ReactiveCocoa for a better world by tablatom on Saturday May 05, 2012 @02:49AM (#3931537)
For those unfamiliar with ObjectiveC syntax, this[1] is a very nice example, in JavaScript, of how amazing this idea is.

[1] https://github.com/Reactive-Extensions/rxjs-html

Re:ReactiveCocoa for a better world by boothead on Saturday May 05, 2012 @06:16AM (#3931815)
This looks a lot like Functional Reactive Programming from the haskell world... Anyone who knows care to comment on how similar they are?
Re:ReactiveCocoa for a better world by gte910h on Friday May 04, 2012 @03:05PM (#3929830)
This makes me happy happy.

It will detangle some big apps I'm on.