Ember data: use or not? Any better alternatives?


#1

Hello,

This is my first time using emberjs and at the moment i’m using simple ajax requests to fetch my data. Is a good idea use a persistent framework? Should i use ember data or any other?

Regards


#2

If you don’t need to do CRUD then I’d say it’s easier to remove it and use Ember Objects.


#3

If you decide not to use Ember Data I highly recommend this post and the associated video to get you started. It’s really simple to work with Ember and not use Ember Data. I found Ember easier to learn when I wasn’t trying to learn Ember Data at the same time.

http://eviltrout.com/2013/03/23/ember-without-data.html


#4

Thank tou for your answer :smile:

For learning i Had explored ember without ember data. At the time, im training a small thing with ember data.

My big concern is: what can i loose if i decide to not go with ember data? Is the cache the biggest lost?

If i decide to not go with ember data, what should return my api In this case for example:

Post {id:1, title:“teste”, author:1}

Or

Post {id:1, title:“teste”, author:{id:1, name:“name”}}

Regards and thank u all :smile:


#5

I just wrote about a different (non ember-data) approach that has worked well the last year for my team. At the bottom you still have an identity map w/ dirty tracking but you handle writing each xhr yourself.

http://toranbillups.com/blog/archive/2015/04/26/alternative-persistence-patterns-with-ember-js/

The identity map is dead simple if you just want to use it yourself. https://github.com/toranb/ember-cli-simple-store

The approach isn’t a silver bullet but if you are looking for alternatives this is a great example

edit

here is a quick ember-cli example showing this store + async + relationships for anyone interested to learn more


#6

I highly recommend ember with ember data. Yes, it’s much more difficult to start with both, but when you learn how to create reusable components, it will be easier to use ember with ember-data, instead not to…

PS. this apply only if you need CRUD


#7

I don’t use ember-data (its not even v1 yet!) and I can’t say I’m missing anything. We run JavaEE on the backend so we keep data manipulation to a minimum on the frontend. It just seems like an unnecessary abstraction to me. Note the app we use is an enterprise class application (so its huge)