

NSRails - Rails + Objective C Framework - nanijoe
http://nsrails.com/

======
LinaLauneBaer
The objective-c classes that are part of this framework are prefixed with NS
which is reserved by Apple. I am not sure why they are using this prefix.
Maybe they don't know objective-c very well or they don't care or whatever. I
would love to hear a statement from the developer of NSRails what he has to
say about that... Are you reading this?

~~~
phatbyte
I'm with you one this, I don't even know if Apple would approve apps using NS
prefix without their consent.

~~~
pkaler
Apple does not inspect your source code when an App is submitted. They only
inspect the binary and the metadata of an App.

~~~
terhechte
Not true, they scan the binary for symbols. I.e. they check for any usage of
private api's. I doubt that they will reject an app just because of their
usage of NS.. classes, but on the other hand if the NS... class accidentally
has the same name of another internal private Apple API, the app will be
rejected (Has happened to other developers already).

~~~
pkaler
You should be stripping your binary of symbols. (-strip-all, -s)

I used the word "inspect" carefully. Apple is probably looking for calls to
private APIs by looking at the addresses of functions called in your binary
with the addresses of private APIs.

They are probably looking for method swizzling of Cocoa APIs by looking at the
address passed into method_exchangeImplementations, class_replaceMethod, etc.

Looking at the symbols within a binary is probably more effort than it is
worth and probably isn't going to be very effective.

~~~
natesm
The names of all of your classes and messages can be found with `strings`
anyways, if they did want to reject based on those.

------
stephth
Looking at the screencast I was surprised to see this macro syntax being
allowed (passing an asterisk here means all properties get synced):

    
    
      NSRailsSync(*)
    

Here's what's happening. Ingenious stuff.

    
    
      //adding a # before va_args will simply make its contents a cstring
      #define _MAKE_STR(...)	NSRStringFromCString(#__VA_ARGS__)
    
      //define NSRailsSync to create a method called NSRailsSync, which returns the entire param list
      #define NSRailsSync(...) \
      + (NSString*) NSRailsSync { return _MAKE_STR(__VA_ARGS__); }

~~~
falling
Clever.

 _“Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are, by
definition, not smart enough to debug it.”_

Seeing the recent evolutions, I thought Rails people learned that magic in
code leads to debugging unhappiness.

~~~
stephth
I think that quote is about _complex_ code.

We tend to look at macros as dangerous, but this is a pretty clean usage of
macros, it's basically a function that turns the arguments into a string.
Simple and easy to debug. Don't you think?

Edit: Discussion about that quote:
[http://stackoverflow.com/questions/1103299/help-me-
understan...](http://stackoverflow.com/questions/1103299/help-me-understand-
this-brian-kernighan-quote)

~~~
falling
It’s a simple macro that makes you write code that looks like a syntax error,
and I don’t like that (<http://www.codinghorror.com/blog/2006/05/code-
smells.html>).

Especially since without the macro you’d just need to write two characters
more or, even better, a clearly named constant, like _kNSRAllProperties_.

------
sbooks
Are there any Javascript libraries that do this same thing? I know backbone.js
does, but I am not looking for a full MVC stack.

~~~
sbooks
Actually found this: <https://github.com/benpickles/js-model>

------
mtrimpe
Did you know that the Dutch rail company is called NS or is that just a
coincindence?

~~~
psylence519
NS is the NeXTSTEP class prefix in ObjC, I doubt they're doing anything more
than copying that. They shouldn't.

~~~
thought_alarm
Actually, NX is the NeXTSTEP class prefix.

The NS classes were introduced as part of OPENSTEP, which leads some people to
suggest that NS = NeXT + Sun.

~~~
nspragmatic
> The NS classes were introduced as part of OPENSTEP

This is incorrect - the NS prefix was introduced in NEXTSTEP along with EOF.

<http://i.imgur.com/MUkXk.png>

