r/programming • u/tsolarin • Jun 19 '18
Airbnb moving away from React Native
https://medium.com/airbnb-engineering/react-native-at-airbnb-f95aa460be1c22
u/d_rudy Jun 20 '18
I'm finishing up a React Native project right now. It's my first one in a couple years, so it was interesting to see how it's changed since the last time I used it. It's definitely come a long way, but its main drawback is still Javascript. I was on a tight deadline, and React Native helped me deliver a polished looking app in ~2 weeks to both Android and iOS. That's invaluable speed for my client, a startup with 2 full-time developers who are also CTO and CEO, and are primarily backend Java engineers. It was also invaluable because I had to make a companion web app with it and I could bundle shared code as an npm module and get consistent behavior in theory (more on that later).
However, there were a lot of stupid mistakes I made that eslint didn't catch, but a compiler would have. Also, as noted in the article, debugging is comparatively a pain in the ass with respect to web.
Also, I ran into a wonderful bug that had me up til 4am one night. The Date API isn't consistent between RN iOS and web (haven't checked Android). Date#getDate() is zero indexed on web, but not on RN iOS... or the other way around, don't remember; I wrote it in a comment next to the hack I had to write to address it. That was fun trying to figure out why my dates were off by one day in either direction after serializing for the backend. I suppose I could have used a library to deal with this, but I was trying to limit my dependencies in the common module, mostly for the web version.
In the end, I wouldn't have been able to deliver this app in this timeframe without React Native, but I can definitely see why a company with more resources might chose to go full native. Like most things of this nature, it's a wonderful tool for a lot of use-cases, but it's not a magic bullet. I also feel that its major handicap is Javascript itself.
1
u/anotherProgrammerGuy Sep 04 '18
Kind of a delayed response. But I share your thoughts in this. People seem to want to make a debate out of this and pick a side, React Native/Flutter vs Android and iOS. I think that its not really about one whipping out the other, there are a lot of things native apps can do because they're native that React Native can't. However, if you are on a small team and you want to publish an app React Native is a very valuable tool. I don't think React Native will die because of this, it has its niche and will still be used as long as people maintain it.
15
u/chrisji Jun 20 '18
My experience as a professional developer for big companies: Sooner or later they get in touch with you saying something like "We have shitty hybrid app and want a good native app now"... Thats good.
403
u/shevegen Jun 19 '18
To make matters worse, the refactors broke in production instead of at compile time and were hard to add proper static analysis for.
JavaScript is still a ghetto.
I wonder why Zed Shaw never wrote an article about JavaScript.
12
u/r0ck0 Jun 20 '18
I'm getting big into doing everything in Typescript/JS now. But this is my biggest issue with it. Even PHP is better at this seeing typehinting will throw exceptions during execution in production.
Makes me wonder if once WebAssembly becomes commonplace... will MS make their own engine that actually runs native Typescript code.
As much as I'm anti-MS in general, especially regarding vendor-lock-in... this kinda appeals to me.
9
u/ours Jun 20 '18
MS ready has a early prototype of how to handle things with Web Assembly. They actually have a lite, web assembly version of their .net framework and tooling to basically program client pages like you would program old server side pages. They call it Blazor. Still super early but sounds very cool. Who needs Typescript if you can do your front-end in C#? No transpilation required.
7
u/r0ck0 Jun 20 '18
Who needs Typescript if you can do your front-end in C#?
Lots of projects will have already been written in it. Plus regardless of how good any other language is, it's hard to compete with the JS ecosystem... react/vue/next/nuxt/electron/every other framework / 700k npm packages (many already made to work both in node + browser) etc.
For me at least, that's a big reason that I find it hard to imagine switching to another language any time soon, and it's one of the big reasons I switched from PHP. Can even run JS inside postgres.
No transpilation required.
Well it wouldn't be needed for Typescript either if they did they did what I'm talking about.
Not saying they're going to, or that it's a good idea. Just thinking of it as a possibility. I'm sure some people would be interested in having runtime type safety being brought to their existing typescript projects. ...and like you mentioned, skipping the transpilation process.
4
u/Drisku11 Jun 20 '18
700k npm packages
Obviously C# will never be able compete without high quality libraries like isOdd, isEven, isNumber, and of course leftPad...
→ More replies (2)2
u/compubomb Jun 20 '18 edited Jun 20 '18
Ironic that now php7.2 with a very strong typing system, and due to the capabilities of the syntax, refactoring php is on par with refactoring java. With type hinting on php, you can be incredibly strict with return types,
function funcName(int $value): bool { return $value > 0; }Next version of php will have a JIT, then we'll see another major leap in performance, as with async w/ swoole / AMP is already at the same speed or faster than nodejs event-based serving. But has a better native syntax or numerous things. classes, abstract classes, interfaces, traits, anonymous functions , anonymous classes & anonymous class implements <interfaces>. No other scripting / interpreted language is as powerful, typescript doesn't count since it's transpiled. Same with dart, its mostly used as a transpiled language too. Dart to my knowledge was never integrated into chrome.
→ More replies (1)3
u/Drisku11 Jun 20 '18
php7.2 with a very strong typing system... With type hinting on php, you can be incredibly strict with return types
When my eyes first saw
>, I thought you were going to say you can specify something likeint > $nor at leastint > 5as a type.intandboolare about as basic as you can get. Whatever "very strong" means, I probably wouldn't use that as an example.1
u/sergiuspk Jun 20 '18
They won't. Give webassbly a try now. You'll find that, by design, any performance optimisations it could benefit from, so will typed arrays in JS. Meaning an interpreter running in your browser will br just as slow even if you write it in webassembly.
→ More replies (2)51
u/bitwize Jun 19 '18
I guess he figured it wasn't worth his time.
0
Jun 20 '18
[deleted]
54
u/rooktakesqueen Jun 20 '18
Hate to break it to you, your bank likely handles your transactions by way of huge CSV files being emailed between people and/or systems.
5
4
→ More replies (6)11
41
u/speedoinfraction Jun 20 '18
The author glosses over their neglecting to start using flow or typescript. This was a mistake of giant proportions which their CTO/PM missed and they are now doing CYA by saying RN flow doesn't work (it does).
15
u/UmbrellaHuman Jun 20 '18 edited Jun 20 '18
On the flip side, as a heavy Flow user (and issues reporter) and occasional TS user, there are sooooooo many unsolved issues (check them out on Github) and you have to restrict your way of writing code for the numerous limitations of the type system.
I would not want to write code without them, but my conclusion is they are the band-aid until a better solution emerges. Which one that could be is hard to see right now so everybody keeps hacking away because the show must go on. Even worse for React Native where I have to consider the slow JS-native bridge, add additional native modules for all kinds of stuff, I cannot transfer binary data across the bridge (buffers!) unless I convert them to string (base64), and which is kind of random occasionally (things like that rebuild does not work, another rebuild with no other change does, or you have to clean everything and rebuild everything even though you only changed one file for which a regular rebuild worked thus far, etc.)
3
u/Woolbrick Jun 20 '18
you have to restrict your way of writing code for the numerous limitations of the type system.
In my experience, if you're writing code too complex to represent in TypeScript's type system, you're writing code too complex for you or a maintainer to understand 6-18 months from now.
Your first thought shouldn't be "it's too hard to write this in TypeScript", it should be "I'm designing this really badly".
→ More replies (1)2
u/acoard Jun 20 '18
I'm a heavy TS user. My experience is pretty similar to yours, though I would say I don't run into as many rough edges as you do. The big important part for me is Typescript is still clearly on the right path. I feel it won't need a replacement, just a couple more years of work.
Do you feel the same way about flow? Is it "on the right path"?
→ More replies (1)16
u/mpinnegar Jun 20 '18
They tried to use typescript but the tooling in JavaScript land is a fucking nightmare right now. You need polyfills, translators for different import styles (requires vs import). Nothing is worse than getting an obscure error in the middle of a three stage transpile and having to figure out if it's the way you configured the tooling or if it's a bug in the tooling or if what you're trying to do just isn't supported.
20
u/Gravitationsfeld Jun 20 '18
Every untyped language has this problem. It's just not scalable.
12
Jun 20 '18
[removed] — view removed comment
→ More replies (1)2
Jun 22 '18
This is always how I’ve felt about static typed languages and I’ve been railed by so many devs over it whenever I bring it up. “It’s so much more verbose!! Such a waste of time” uh yeah but now I don’t have to spend 20 years checking inputs myself or making sure some objects get instantiated/mutated correctly. I know they are just by looking at the code.
2
u/muckvix Jun 20 '18
JavaScript is still a ghetto. I wonder why Zed Shaw never wrote an article about JavaScript.
Just curious, why specifically Zed Shaw? I know he wrote a book on python but it wasn't anything too special was it? I mean, was he famous for writing good critique of languages or something?
And yes I know that lately he became kinda weird with his crusade against modern python etc, but I doubt it has anything to do with your comment.
1
u/vplatt Jun 20 '18
Well, let's say you go to a family picnic and you see your redneck cousin there. You guys drink a bit much, and you walk off calling your cousin a toothless, smelly, inbred. Now, are you going to walk up to each of his kids and his wife and accuse them of the same? No, right? Because it's redundant!
0
Jun 19 '18
[deleted]
58
u/Improvotter Jun 19 '18
In my book he took a huge hit for his stance against Python 3 and the community backlash. It just seemed to be backed by meritless facts. He was constantly referring to his sales that didn’t go down (good for him, doesn’t prove much though).
→ More replies (5)
149
u/GodGrabber Jun 19 '18
Redux is notorious for its boilerplate and has a relatively difficult learning curve. We provided generators for some common templates but it was still one of the most challenging pieces and source of confusion while working with React Native. It is worth noting that these challenges were not React Native specific.
Amen to that.
22
u/glassFractals Jun 20 '18
Has anyone used Rematch? It's an abstraction later built on top of Redux to try and account for some of its flaws. The pitch is that it's Redux (and API compatible), but with reasonable defaults and less boilerplate. I've been considering it because my interactions with Redux have been painful.
Medium article by the creator about why Redux needed improvement: https://hackernoon.com/redesigning-redux-b2baee8b8a38
1
u/gregnr Jun 20 '18
Thanks for sharing! We're investigating Kea which seems to have a similar philosophy. Do you have any thoughts between the two?
7
u/alamko1999 Jun 20 '18
One thing that confuses me was how to implement pub/sub on a component level, while connect automatically does that for you, there are some instances where i would want to fetch the network after an event. I just ended up using componentWillReceiveProps which is really ugly.
1
60
u/LyeInYourEye Jun 20 '18
I love redux. I don't see what the problem is. Take a week and learn it? It seems to make sense to me.
94
Jun 20 '18
I used redux for enough time to know that I spent way too much time typing and hopping around files for simple stuff.
54
u/aonghasan Jun 20 '18
But thanks to that it's so maintainable.
23
Jun 20 '18 edited Jun 20 '18
I fully agree, but the amount of boilerplate is why I decided to go from "full stack" to solely backend. I want to spend my time on problems, not writing glue to piece the problems together.
→ More replies (3)15
u/nirataro Jun 20 '18
VueX is the shit.
5
Jun 20 '18
Yeah I tried to learn redux just playing around a bit with React and i was like what the fuck is this, it made no sense to me.
Vuex maybe took me a day or two to wrap my head around and quickly seemed natural.
→ More replies (2)7
u/compubomb Jun 20 '18
Amen to that. I actually think Vuex makes so much more sense than redux. Redux to me always feels insanely verbose. And then how you have to tie it together feels just as strange.
3
→ More replies (2)2
u/Hidden__Troll Jun 20 '18
Sounds like an organizational problem. I've ran into this before also. Look into three ducks
10
Jun 20 '18
Redux makes complicated state possible to reason about. It does this at the cost of boilerplate, indirection and an awkward approach to async. I think I've only ever seen one Redux project actually justify these costs, and that was the article editing suite we wrote for reporters at The Guardian, back in 2015.
All the rest have been fairly trivial apps that could use React setState or possibly no client state at all.
2
u/d_rudy Jun 20 '18
That's the way I went for my most recent React apps, and only leaning on React Contexts for some stuff like user info and error handling that was needed in disparate components. I think a lot of people reach for Redux too quickly; it's definitely overkill for most projects I've seen it used in. Half the time, I'm happy to write my own state machine to do Reduxy things, just because I think Redux is over-engineering a lot of the time. That said, I won't write it off completely because I can definitely see the usecase for sufficiently complicated apps.
3
u/nomadProgrammer Jun 20 '18
Redux documentation (at least 1 year ago), was very complex and pompous. They should learn from Vue.js to give a better simpler documentation. Also it is full of boilerplate BS. Happy to no longer work with React or ReactNative Bs.
3
u/acemarke Jun 20 '18
I'm a Redux maintainer. Could you give some specific examples of what you're referring to?
I'm always happy to have people help improve our docs.
2
13
u/the_evergrowing_fool Jun 20 '18
The amount of boilerplate with no clear benefit.
I think the boiler is product of being ad-hoc and relaying too much on JS. It would be better as an DSL base on pattern matching.
14
u/JustinsWorking Jun 20 '18
There is a lot of clear benefit.
Great seams for tests, one directional data flow, rewind, and easy debugging via actions.
If you're not using any of those, I have no idea why on earth you're using Redux.
→ More replies (3)→ More replies (6)1
Jun 20 '18
I could never get over the boilerplate after having tried re-frame for clojurescript. It's more or less the same philosophy, but you get all the same benefits with much, much less boilerplate and end up with something that feels much easier to reason about / hold in your head.
→ More replies (14)2
14
u/tsingy Jun 20 '18
Finally some blog about react in exterior use level. I’ve seen a bunch companies switched to react due to this and that feature but never found one after few years. This will be a interesting blog series.
13
12
u/Ecologisto Jun 20 '18
Pretty naive question : could they have used QT ? Are there big companies using QT for cross-mobile development ?
1
u/CapoFerro Jun 21 '18
Does qt use native ui elements? That's a big driver for choosing things like react native.
1
65
u/osoese Jun 20 '18
Been tinkering with react native and was pleasantly surprised at the speed I can produce a mobile app. Having this write up is good for long term scaling and identifies for me where I might run into hurdles down the road. Great post.
51
u/kirbyfan64sos Jun 20 '18
I'm going to be the moron here and say that you should totally try Flutter, which is another cross-platform app framework, but it uses Dart instead of JS and avoids several of the pitfalls mentioned here (in particular, it compiles Dart to native code, so there's no odd platform behavior differences).
11
u/Dimasdanz Jun 20 '18
As much as I want to support Flutter and use it, it's just not ready to use on production while React Native does. There's a lot of things Flutter has to catch on, on top of my mind is native bridging. One thing that Flutter done right from start is native Navigation which React lacks of.
Also, Google tends to abandon projects, it's a risky decision.3
u/shield1123 Jun 20 '18
Google doesn't seem to be abandoning flutter any time soon. They've recently declared the newest beta is production ready, are using it to build the UI in Fuschia (which, honestly, could still be abandoned), and flutter seems to be the direction they're taking to keep Dartlang relevant since few people have adopted it for web
6
4
u/Vacation_Flu Jun 20 '18
They've recently declared the newest beta is production ready, are using it to build the UI in Fuschia (which, honestly, could still be abandoned)
Based on Google's history, that means it's due to be abandoned, or completely revamped to Flutter2, which will be incompatible with existing Flutter codebases.
Not that I want Flutter to fail. Quite the opposite. It's a pleasure to work with. But I'm only using it on side projects, and have heavily recommended against adoption for my day job. 3rd party support just isn't there yet. And despite their claims that it's "production-ready", they still haven't settled on APIs for a lot of things (animated/vector icons is a pretty important one for my current needs). Not to mention how badly I got burned with Angular.
2
u/Calam1tous Jun 20 '18
Oh interesting. Not sure why but I was under the impression Flutter was Android only - gonna check it out.
2
2
u/JavanQuesadilla Jun 20 '18
I'm not an expert on the issue (as this question will make clear) but I thought React Native also compiled to, well, native code. Or did I misread your comment?
→ More replies (1)2
u/compubomb Jun 20 '18
Not exactly. I believe react native runs on the v8 engine, and they have native system calls available in the v8 engine. It's why you can run all this JS code in React Native and have it still work. But they expose through the v8 engine ios/android system calls which behave natively to the system. That was their abstraction.
1
u/Clashofpower Jun 20 '18
I'm a total noob and my friend recommended me to start messing around with react native to make some stuff. Would it be better to start with flutter instead for the long run?
→ More replies (1)11
u/Dedustern Jun 20 '18
There are like zero Flutter jobs worldwide, but hundreds of React Native jobs.
If you're dicking around making hobby apps for the lolsies, go with Flutter. If you want to actually earn money, React native.
3
u/Clashofpower Jun 20 '18
I am pretty much dicking around, but I am studying comp sci and want to build on my dicking around and try to build some knowledge and kinda enter the programming world. Any additional advice? I know I'm kinda going between what you're saying so sorry
5
u/Dedustern Jun 20 '18
Go with React Native. There are like 2 companies using Flutter out there, and one of them is Google.
1
u/chrabeusz Jun 20 '18
Can confirm. It's probably the future, unless Google completely fucks it up.
Flutter addresses most pain points that I had when using Xamarin (which seem to be the same for RN).
2
u/rhudejo Jun 20 '18
What were your pain points with xamarin?
7
u/chrabeusz Jun 20 '18
Bugs caused by leaky abstractions: you would experience iOS bugs, Android bugs and Xamarin bugs at the same time.
Painful customizations: anything custom required Android and iOS specific code and knowledge of their frameworks.
Flutter solves that but not using native frameworks, so you can customize everything you want and it won't break on some shitty specific chinese Android. It can also run UI tests headless, on desktop without any device / simulator needed.
→ More replies (2)
45
Jun 20 '18
Meanwhile in Embedded, ANSI C good for everyone?
4
u/kwinz Jun 20 '18
I can really recommend you watch this talk: https://youtu.be/Itgwb3rn7gE?t=1978
Like the whole 45min talk. The part that I linked is just the teaser. :-)
→ More replies (3)
236
u/the_evergrowing_fool Jun 19 '18
The cost reduction from cross-platform UI toolkits is a myth. They are a limitation.
282
u/killerstorm Jun 19 '18
It kinda depends on what you're trying to achieve.
If you have a tiny team, cross-platform UI toolkit is your chance to deliver something for more than one platform. It can definitely reduce development costs.
On the other hand a bigger company might be able to afford a separate UI team for each platform. If you're trying to deliver a polished app cross-platform UI might be more of an nuisance than something advantageous.
28
u/_dban_ Jun 19 '18
At least on mobile, what I've heard is that the better strategy is to deliver native first on one platform (like iOS), and add other platforms as you have time and money. Mobile users are picky about mobile app experience, and the Apple App Store is really picky.
Of course, the cross platform technology in question was Cordova, which uses a web view. Almost like Electron for mobile. React Native uses native widgets and JS, which didn't seem as reliably cross platform as advertised.
→ More replies (2)3
Jun 20 '18
is to deliver native first on one platform (like iOS)
And alienate half your potential userbase? That's definitely not an option that would get past any half-decent PM
15
u/MesePudenda Jun 20 '18
The video game Fortnite isn't on Android yet, but has 125 million players on PC, PS4, Xbox One, Nintendo Switch, and iOS. Android hardware is more varied, and they want the game to work well across most of the available devices.
Obviously most apps aren't as complicated, so it's not comparable to most projects, but a per-platform rollout is ok for some companies.
→ More replies (1)15
u/usualshoes Jun 20 '18
Games are different, they are usually paid and iOS users generally pay. If your app is free and doesn't have IAP, you should target Android
9
u/_dban_ Jun 20 '18
Considering this is how most mobile apps are developed, there must be a lot of bad PMs.
→ More replies (2)9
u/CyanBlob Jun 20 '18
I'm currently developing an app with Flutter, which has been great so far. Going native is probably a reasonable long-term goal, but since in developing it by myself I probably would have already given up if I had to develop both apps separately
6
u/asmx85 Jun 20 '18 edited Jun 20 '18
I am also making my feet wet with Flutter. In the beginning i wanted to evaluate the current status of Flutter and under what circumstances it is possible to use Flutter against a native implementation. I must address here, that i am very opposed to non native approaches. I tried a few things in the past years (Titanium Appcelerator, Xamarin, React Native ... ) and the experience was mostly bad. Except for Xamarin i was always bitten by things that do not work properly or that are unsettling difficult to achieve. In the case of React Native there is also the documentation that is often out of sync and it is impossible to track issues because they are constantly closed (without a fix) and "cloned" by someone still having the issue. Which makes it really hard to find the "current" status of the problem that you encounter and found on the issue tracker ..
With that Background i started with Flutter with a mindset like "Ok Flutter – show me how bad you are". At the End of the day i was very impressed how well things went. Flutter was incredible easy to setup and my first setup worked in a matter of minutes. Impressed by that i started to port an app that we currently doing both native in iOS and Android – just to see how far we can push it. And we can push it really far with Flutter. It went so flawless and was done in a fraction of the time the native approach took us that we're really considering to switch to Flutter. Looking in what limited environment we could use Flutter ended up questioning why we should continue to use a native approach. We are still investigating this and really want to find ways to poke holes into Flutter but besides Webviews/Maps/Camera (that currently do not work really well but work is on the way) we can't really find arguments against Flutter. It looks really well designed with all the problems the native platforms have in mind to not recreate them. And i feel like i can already do "more" in the UI department that i am able to do in Android. Not because it is impossible to do some things in Android but because it is an order of magnitude more difficult – or let me say it that way – it needs more effort/lines of code – to achieve the same thing.
→ More replies (1)4
u/s73v3r Jun 20 '18
Most of these companies that are trying to shove everything into RN are companies that can afford separate teams, though.
0
Jun 19 '18
[deleted]
13
u/chipstastegood Jun 20 '18
You can do all that and more with native code. We have 2 iOS apps, 2 Android apps, and 1 junior iOS dev, 1 junior Android dev, plus 1 experienced iOS/Android dev. Juniors did UI-only coding for all apps in parallel while the one experienced dev built all the business logic / network / DB code. Separating coding concerns is not a new concept and works very well
24
u/beyond_alive Jun 20 '18
Huh? You can build views and components using autolayout without worrying about the plumbing in iOS pretty easily, not too sure what’s different with react?
→ More replies (1)12
u/TheBoyYdLikeToBe Jun 20 '18
This, react native it's just another solution, I like the javascript environment because of all the available technologies it comes with but this is often taken to a toxic "If you are not using the latest framework then you are not a real JS developer" which is frustrating for those who just want to use that tool that really adapts to their necessities.
5
Jun 20 '18
I am going to try my best to avoid working somewhere that short staffs on devs.
I can’t understand how companies skimp on paying for developers in 2018, when so much of their business depends on having a functional, user friendly app or website.
(Yes I’m making a generalization, it’s not true in every industry, but whatever).
→ More replies (2)15
Jun 20 '18
I am going to try my best to avoid working somewhere that short staffs on devs.
Most places short staff on devs, devs are the most expensive people to have on staff and most places devs work aren't producing packaged software, they're working on in house apps for said company. You can't avoid places that short staff on devs unless you stay at places like Google or the other big unicorns that do nothing but dev.
I can’t understand how companies skimp on paying for developers in 2018, when so much of their business depends on having a functional, user friendly app or website.
Try running a business and you'll find out quick, devs cost a fortune and are very difficult to hire unless you're also a dev.
→ More replies (2)33
u/IMovedYourCheese Jun 19 '18
After a point, yes. Something like React Native is undoubtedly very useful for a startup where a 5-person engineering team needs to get a working version of their app on 4 different platforms.
Once your are successful and have a large engineering staff, the same advantages become limitations, as detailed in their blog post.
22
37
u/ike_the_strangetamer Jun 19 '18
The article says they have 100 mobile engineers. I'm on a team of 2. Pretty sure we are making things faster in React Native than if we had to do it in two different languages in native.
9
u/AsdefGhjkl Jun 20 '18 edited Jun 30 '18
This really depends on several things, namely:
your expertise in RN / native Android / native iOS
the scale and the amount of customisations of your app
the amount of business logic your app uses
does the app delegate a large amount of work (business logic) to a custom library in your domain (which can be shared even when using native)
your performance constraints
a million other things
So it's not really trivial. For many use cases doing it in RN is actually slower and requires more resources than having two competent teams doing native.
53
u/jcelerier Jun 19 '18
I'm writing a fairly large cross-platform Qt app and I don't feel limited the slightest.
13
Jun 20 '18
What's you definition of cross-platform?
We used to use Qt but ditched it and instead just wrote native. Qt worked okay when we only targeted Windows/Linux, but when we needed to add support for macOS it ended up being a nightmare and we realized that we're just better off use each platform's native functionality.
2
26
u/the_evergrowing_fool Jun 19 '18
Maintaining a cross-platform toolkits is orders of magnitude harder than a Native SDK.
Most often than not, some of the latests features from the SDK won't be available to your CTK unless there is some kind of adhoc iteropability.
18
u/emn13 Jun 19 '18
Most often than not, some of the latests features from the SDK won't be available to your CTK unless there is some kind of adhoc iteropability.
So, the question is whether that matters. And the very success of web apps kind of shows that it can't matter all that much - and web tech is typically much, much further from native than an xplat-toolkit.
(I think in general people overrate the relevance of fancy UI)
→ More replies (4)3
0
Jun 19 '18
[deleted]
→ More replies (3)7
Jun 20 '18
What other platform than macOS did you target? Our macOS customers hated our application written in Qt because Qt basically doesn't respect macOS conventions and is mostly meant for targeting Windows/Linux, so we first had to #ifdef all the platforms to respect the user's expectations and after awhile of doing that decided to ditch Qt and write three separate applications for the platforms we support.
Honestly wasn't nearly as big of a deal as I thought it would have been. You can still reuse the overwhelming majority of your code between the three applications which you factor out into a common library and you can even write a common interface for your UIs and then implement them separately for each platform.
2
Jun 20 '18
But why write 3 apps after that? Couldn't you keep Qt for Windows & Linux and just write the Mac version separately?
→ More replies (1)5
u/Palk0 Jun 19 '18
They provide a cost reduction in the work I do, and of course there are limitations—thats the tradeoff. It's not a reason to never consider them though.
9
u/AnnanFay Jun 20 '18
For anyone interested there's a very good blog post from 2002: The Law of Leaky Abstractions.
It's not so much an argument against using abstractions but a warning for people or teams who only learn the abstraction without any understanding of how it works at a lower level.
2
u/chipstastegood Jun 20 '18
It may be worth noting that Steve Jobs was against cross platform tools on macOS/iOS because of inevitable leaky abstractions, performance, and the fact that abstract frameworks would always lag behind native
8
u/cybernd Jun 19 '18
The cost reduction from cross-platform UI toolkits is a myth.
I wonder if the same statement would be valid for ORM's or other types of abstraction layers.
2
u/Sayori_Is_Life Jun 19 '18
I'm not so familiar with ORM, could you please tell about main reasons of using it? Moving logic from the DB (like, from PL/SQL packages, or stored procedures) to the app, perhaps?
12
u/Magneon Jun 20 '18
An ORM maps an object to a relational database (object->relational mapper). So if you have a db table with id, name, email, and last_login you could say
person = Person::get(123) person.last_login = time.now(); person.save();Rather than writing SQL to do the update. It abstracts the database a bit and can be nice sometimes.
5
u/segv Jun 20 '18
Thar's just one style of ORMs.
In MyBatis for example you just define an interface you'll use in the code and the raw SQL it should use - the library takes care only of dynamic sql generation, query execution and translating the ResultSet to an object:
Person p = new Person(123, "John"); mapper.fancyShmancyInsert( p ); // inserts data to PreparedStatement fields and executes the query: // insert into clients (id,name) values ( #{input.id}, #{input.name} )This ORM is more like a library that does one thing and dosn't get in the way, rather than a framework doing some voodoo with your objects. Since you use raw sql you can take advantage of fancy features in your database.
7
u/nilamo Jun 20 '18
The main feature is not writing SQL, so your codebase is agnostic to any particular backend engine. Mostly so you can use a light database (sqlite, perhaps) while testing, and something more substantial (postgres) in prod.
8
u/RiPont Jun 20 '18
The main feature is not writing SQL, so your codebase is agnostic to any particular backend engine.
That's like marrying someone beautiful and rich who just totally seems to get you, but then after the wedding you find out they're in debt to the mafia and they only seemed to "just get you" because they were a con artist. They're still beautiful, but it doesn't really seem worth it now, does it?
Using an ORM that does all the magic for you so it can work with any backend is a complete lie that will bite you in the end. You will end up needing to optimize, only now you're optimizing a high-level abstraction to try and get it to produce an optimum low-level result with one DB while not fucking over the other DB.
An ORM is fine for prototyping or even getting a V1 with one DB, just know that there's no magic bullet that will let you be both DB-agnostic and optimized without implementing your own abstracted data layer that is tailored to your specific needs. At which point, the magic-promising ORM becomes an impediment to optimization rather than a productivity aid.
3
u/nilamo Jun 20 '18
When you get to a certain level of scale, you're using a backend service/repository to get your data. And that looks an awful lot like an ORM that you built yourself lol.
→ More replies (1)→ More replies (1)4
u/path411 Jun 20 '18
I think a good ORM's main feature is to give you the data you want as easily as possible. Want the user with id of 1? That should just be a simple function call. This does lend it to it's main purpose, which is pulling your data logic from DB to your app, which has the side effect of making your data logic semi agnostic (Although I wouldn't really say this as moving to anything other than another similar SQL backend normally isn't normally possible).
4
u/cybernd Jun 20 '18 edited Jun 20 '18
They get most often used because of different reasons:
dev likes the promised ability to be db engine agnostic
dev hates writing SQL and ORMs promise to get rid of it
dev is fine with SQL, but realizes that copying sql resultset into objects is annoying
dev hates controlling transaction boundaries
dev hates to think about what exactly they want from the db and ORMs primise automagically on demand lazy loading
A DBA usually has a different viewpoint: They hate their dev team immediately when they see the first generated ORM query. They are usually also aware of the query cascades produced by careless usage of lazy loading.
Lets pick db agnostic as example: In reality, most often exactly one db engine (like postgresql or oracle) is used. Migrating to a different database is still not possible.
Sometimes "unit tests" use a lightwight db engine like sqlite for speed purpose. But developers are not realizing that this is neigher a unit test, nor a proper integration test.
Because of the limitations of the ORM query language, developers will not leverage the featureset of their database engine. And becasue of the nature of the ORM², they don't know which queries hit their database at compiletime and need to generate queries in order to see their explain plans.
² depends on the type of ORM is used. Usually people mean hibernate style ORMs. MyBatis has different characteristics.
→ More replies (3)2
u/path411 Jun 20 '18
You are correct. As others have noted, the way it does this is by giving you easy access to your data in your app. This lets you write data logic in your app.
1
1
u/RiPont Jun 20 '18
Depends how much abstraction/magic the ORM is promising.
There are a lot of bits between C#/Java/etc. and SQL statements that a tool can make much more productive with almost no leaky abstractions.
C++-derived OOP is simply not a conceptual match to Relational models, and thus any ORM that promises to handle it all for you is a great big lie that will leak abstraction fluid all over your engineering floor.
0
u/the_evergrowing_fool Jun 20 '18 edited Jun 20 '18
It is. Any database expert knows the limitations and features of each engine and knows that an ORM could be too generic for anything interesting.
→ More replies (14)3
u/droogans Jun 19 '18
Until they aren't. I suspect webassembly will sort this out, either that or a consolidation of release targets will counter it. Maybe both!
13
u/the_evergrowing_fool Jun 19 '18
The web API is still limited and is have subpar support for any device.
3
u/ThisIs_MyName Jun 19 '18
Hence, WebGL and its successor WebGPU.
3
u/RiPont Jun 20 '18
While they can be high performance, they will never be native-feeling on all platforms. Fine for games, which basically define their own UI paradigms for each game.
However, being a native GUI application is about more than framerates. It's about matching the user's expectations of how to work with the platform. As each platform is fundamentally different in many aspects of user interaction, it is impossible for a cross-platform UI toolkit to be optimum on disparate platforms.
Windows/Linux is easy, only because both platforms are highly tolerant of a disjointed mess of UI paradigms in various apps all over the place. And I say that with love. They both have a very long history of "native" UI iterations that perfectly reflect https://xkcd.com/927/.
9
Jun 19 '18
Not sure why you are getting downvoted. It's not hard to imagine a full blown desktop application written in c#, c++, java, etc. being compiled in web assembly and running on anything that can run a browser. We are years away, but it is possible.
2
u/Akkuma Jun 20 '18
Technically, you can do a lot of this in an immature fashion in Rust with https://github.com/DenisKolodin/yew
2
u/ProFalseIdol Jun 19 '18
Eclipse is fairly successful. IntelliJ which is pure Java Swing is successful too. I can imagine they have reaped the cost reduction really well.
1
Jun 20 '18
If your application is simplistic enough to fit within the toolkit's abstractions, it works just fine.
Problems arise as soon as you reach the limits of said abstractions.
1
1
Jun 20 '18
not true. if you want to hit the market asap then it is a viable approach, but if your app gets traction it is better to rewrite for each platform.
writing a new app for every platform natively from the beginning is a nightmare
→ More replies (13)1
Jun 20 '18
While I agree, I think the real killer feature something React Native offers is the instant feedback loop.
A shoddy development tool with an instant feedback loop will let you accomplish 80-98% of the work (depending upon the tool and the target environment) far more quickly than a technically superior tool with a slower response time. That's one of the big reasons Node.js, Ruby/Rails, Python and PHP are wildly popular for web applications - writing the same web application in Java or C++ almost always involves a 10 second to 5 minute wait while your application reloads. Eventually the runtime type errors or performance considerations are likely make Java or C++ the better choice, but the team with instant feedback time to MVP was 80% shorter.
4
u/Dedustern Jun 20 '18
However, moving business logic and layout off of the main thread actually improves render performance in many cases.
What does this entail in practice? I'm not sure I get it, I thought Javascript was single-threaded; but perhaps not when compiled to native..?
4
Jun 21 '18
I think people might read something like this and easily come to the conclusion that RN is bad and we should be writing in native, without properly getting the nuance that RN is absolutely highly valuable in many contexts. It allows you to get a multiplatform app out the door incredibly quickly, and integrating it into a native app to control key complex parts of the UI in a multiplatform way has value at any company size.
I think the biggest mistakes companies of any size make with RN is:
Having a single codebase for both your Android and iOS apps.
Having zero institutional knowledge about the native side of application development, preferring to just configure that once at the beginning and forget about it.
Not properly treating RN as a shared component layer via private npm modules.
In essence: companies make the mistake of building a "React Native app", instead of the more healthy, scalable, and nuanced "apps that use React Native."
36
u/A_L_W_ Jun 19 '18
I think this article explains more.
https://medium.com/airbnb-engineering/sunsetting-react-native-1868ba28e30a
66
21
Jun 20 '18
Is there a TLDR about this? Cool to see them switching but I aint reading a fucking four part series about it.
31
u/__deinit__ Jun 20 '18
Dissonance between teams coupled with bugs and performance issues caused them to miss deadlines and ship critical bugs.
They’re reverting all portions of their apps back to native that are currently using RN and are turning support of the libraries the libraries they wrote over to the RN community.
2
3
Jun 20 '18
/u/Styrofoam--Boots wrote a nice tl;dr
tl;dr - They had to write less platform-specific code, but there were still platform-specific bugs (some unfixable) and other issues which caused major problems. JS's type system and Redux were hard to use at scale. They'll be using Swift on iOS and Kotlin on Android now. The time spent to develop one "universal" code base was close to writing separate ones due to these issues.
3
3
u/markzzy Jun 20 '18
Using frameworks like this to "code once and build anywhere" is always good until they aren't. For large companies, this approach almost never works. But my guess is that they saw the limitations and knew the risks involved, but still used it anyway.
At the risk of being downvoted, I wonder if progressive web apps were discussed as an alternative, which would eliminate having to write platform-specific code to begin with. I think this may be a good alternative to native apps ahead.
4
u/simran050590 Jun 20 '18
When you are doing platform app development that you eventually have to turn to Native development most of the time. MSFT is going React Native on their desktop apps including Office 365 but they have their on fork of RN for desktop. Such a big company can still manage to take risks. Smaller companies cannot. I am sure they will turn back to Native office 365 when RN/JS hype will fall. PWAs are the hype of 2018 and they will lose their shine in next 5-7 years. Till then enjoy them.
7
u/mrmus Jun 20 '18
Using technologies like RN for such large projects always comes with a trade-offs. There are many scenarios where RN is a good choice though. Anyway, thanks for sharing. Very refreshing and sobering article.
6
Jun 20 '18
I think the most obvious rule of thumb is that if your software is something that your users are forced to use or like something in-house, you can use anything as long as it solves the problem without much trade-offs.
When you have to attract or convince the users to use your app, it's a different story, and user experience is key. There's no substitute to native in this case.
5
u/preslavrachev Jun 20 '18
So, it turns out I wasn't alone with my criticism: https://preslav.me/2018/01/07/my-thoughts-on-react-native/
6
2
u/DeepInsidee Jun 20 '18
Does anyone know how many people are working on such a cross platform application like this? 😶
1
2
u/jonno11 Jun 20 '18
I really hope the time is ripe for a component-like view API for UIKit. Building native UIs was one of the biggest gripes I had as an iOS developer. I loved the simplicity of flexbox, and the ease of use 'CSS-like' style definitions brought to components.
8
Jun 20 '18
TOO LONG I DON'T WANT TO READ: So what will they use now?
24
u/__deinit__ Jun 20 '18
They’re going to go back to being fully native on both platforms.
→ More replies (8)→ More replies (1)2
3
3
u/IloveReddit84 Jun 20 '18
JavaScript might be easy to get in and experiment, but for production-ready software, it should be the last choice.
→ More replies (6)7
1
u/TheQueefGoblin Jun 20 '18
Why can't app developers write stuff in HTML/CSS/JS and render it using a browser engine (like Electron?
6
Jun 20 '18
You can. Mobile apps support web views. However, the performance of web views sucks compared to true native. This paradigm also makes it hard to get true native-looking UI components. In short, it's just a really bad practice that results in pretty low quality apps.
1
u/FollowSteph Jun 21 '18
I noticed almost no one commented on the fact that it’s very hard to refactor. To me this is the biggest issue because the more time passes the bigger the ability to refactor becomes. Otherwise at some point you just collapse.
RoR was very popular for a while and then it slowed down dramatically. If you pay attention you’ll notice it was around the time that projects started to get mature, people transitioned, and so on. RoR is great for quick development but the bigger the project the harder it becomes, especially if you have people changing jobs and people of different skill levels.
I suspect react is going to fall into the same group. And just RoR it’s here to stay, but as projects mature it’s hype will transition. It’s a great tool and like every tool there is an optimal place and time to use them.
1
u/Peter_Kow Aug 14 '18
I put my thought about Airbnb and Facebook in here -> https://blog.aurity.co/airbnb-sunsetting-and-facebook-sunrising-react-native-c1488525c2ef
Let me know what you think :)
1
u/AndyKos Aug 17 '18
React Native does have problems, that is the fact. Basing on the Sophie Alpert entry in the React Native blog, they do work on the architecture, namely the bridge that connects JS and the Native requests of OS. In my opinion, most Airbnb issues are not due to architecture, but because of the approach to the code base. Code sharing is the same as on the web and for Native on both platforms. And also because of the use of native components in the React Native.
1
-1
u/tonefart Jun 20 '18
Do it right the first time, what is so hard about hiring 1 developer each for Android and IOS ? If you're going to invest in multiple react native developers, you might as well invest in a small Android/IOS team.
6
u/pabloe168 Jun 20 '18
Hindsight is 20-20.
It was a bet. There's advantages to having an organization share a common language and not segregate by skill set. They were huge contributors to RN. But it just seems like in the end it didn't pay.
The upside would have been less maintainability issues, less platform specific depreciation issues, and all that jazz. Also airbnb, or any large company doesn't just have 1 dev for each platform. They wanted a flatter organization. Multiple architectures means several high skilled platform owners with different points of view. Which means more work upper management and a more traditional company structure. RN was a legitimate good bet. Not all good bets pay off. But I see what they were shooting for. A big feature power house with flatter more unified management.
JavaScript is still the Achilles heel of. Modern Software Engineers.
2
u/orthecreedence Jun 20 '18
But it just seems like in the end it didn't pay
Didn't it? It may be that it didn't pay technically but who says that going the native route wouldn't have slowed them down initially or had its own problems? It could be that it got them as far as it needed to at their size when they first created it, and now they've outgrown it.
I'd say with where AirBnB is today as a company, React Native still may have been the correct choice for their past situation.
3
u/pabloe168 Jun 20 '18
That's actually an excellent point. But we would have to ask insiders.
I remember talking to airbnb dev recruiters and asking them about react native vs native development. And it seemed to me that they always juggled advantages and disadvantages. They actually had react native devs, Android devs, and IOS devs from very early on and throughout the times they were strongest on RN. There were always little edge cases that were too difficult to solve on RN and it seems like there were always big payoffs on RN. So who knows.
0
u/therico Jun 20 '18
Their website has always sucked, it's slow as heck even on desktop (let alone mobile), poorly optimized and almost unusable in cases. Whatever they are doing, I would be tempted to take the opposite route. Classic case of having too much money and not being forced to iterate or optimize their development process.
-10
u/boot20 Jun 20 '18
Jesus fuck, was the person getting paid by the word? tl;dr anyone?
4
u/gnus-migrate Jun 20 '18
tl;dr there were a lot of benefits in using it, but not enough to justify switching to it completely especially since their mobile devs weren't used to Javascript. I highly recommend reading the full thing for the detailed analysis of why, it's a very interesting read.
0
591
u/gocard Jun 19 '18
They're experimenting next with server driven rendering. Isn't HTML server driven rendering? :P We've come full circle!