For the best experience on desktop, install the Chrome extension to track your reading on news.ycombinator.com
Hacker Newsnew | past | comments | ask | show | jobs | submit | history | joachimhs's commentsregister

This library provides a cache store for Svelte applications that simplifies fetching, creating, updating, and deleting items from a REST API that adheres to the simple-json-api specification. It also supports side-loading of related data and automatic cache management.


I find myself implementing similar backend APIs when I develop applications. These APis are more often than not based on REST principles with JSON payloads. As a result, I have publised the start of a simple JSON API spec at http://simple-json-api.com. This specification makes it easy to write both backend and frontend code to handle the data communication between the applications in a uniform manner. This approach makes it possible to write a fairly small amount of code to get advanced functionality on the frontend-data-layer.

While some good API specifications do exist, this project attempts to provide a common middle-ground being not too complex, while broad enough to not be too specific and too complex.

While, for instance, JSON:API is a thorough specification, Simple JSON API aims to provide a much simplified data-structure leaving the server-side specifics out of the specification. At the same time, while specifications such as JSON Web Key (JWK) is too narrow.


Not a screencast, but the first (free) chapter of Ember.js in Action do have an example that uses local storage: http://manning.com/skeie/

There is also a (non free) chapter about authentication with Mozilla Persona.

You may also find these screencasts useful, though I haven't watched them myself: http://www.embercasts.com


Thanks, will check that out now.


I am currently writing Ember.js in Action (http://manning.com/skeie). This book is, of course, through a traditional publishing company. Combined with the fact that this is my first technical book, my royalty rate is pretty low (10%). This is OK, as the book will reach a wider audience that I would on my own! So far, the book is approaching 2000 units in pre-sales (MEAP - Manning Early Access Programme), which make it the 5th most sold Manning MEAP of 2013 :)

I have started work on my next book project, which will be completely free and open sourced. This book will teach JavaScript programming to kids through building a Raspberry Pi powered remote controlled car (or or other vehicle). The content for this book is not yet available online and most of it will be created through a hands on 7-part course that I am teaching during the spring of 2014. You can find a bit more information about this book here: http://www.indiegogo.com/projects/open-source-programming-bo...


The way I see it, if the content is at all going to be approachable by children aged 11 and up, then that content needs to be well designed, typeset and proofread. While writing an open source book for professionals, pointing them to a set of markdownfiles would suffice if the content is good enough.

The idea is that the design and the content should facilitate children's learning as much as possible.

I could definitely go the publisher route with this, but then the whole project will change characteristics and be less dynamic.

Its not the open source code or project that is important in this project, its really the end result which is content that is easily approachable for the target audience.


I'm sorry you read it that way, but I do not think that I have said, nor hinted, to that at all.


My perception of "Web Applications Done Right" is that it implies that any other way is "wrong".


Well, that perception assumes that there are only one correct solution, and that there are no grey areas...

Your perception is deterministic, while mine is probabilistic.


I'm just telling you what it comes across as, a perception that apparently I'm not the only one to hold (in fact, I wasn't going to mention it except that dave_sid had the same reaction).

Defend it all you want, but that's not going to change the fact that some readers will see it as an underhanded jab.


Thank you for you comments. This is one of the goals that I am trying to achieve through my book-in-progress Ember.js in Action (Manning Publications).

And I do agree. Examples of large-scale applications built with any of the MVC-based frameworks is lacking.


Book looks interesting - I'll have to dig into that. Thanks!


Ember.js is a framework for writing web applications on the client side. This experience, and the end result will be a lot different that the type of web apps that you might be used to writing from the server-side.

I've created my share of Java-based server-side generated web applications, and when it comes to writing applications that run well on the web, JavaScript MVC frameworks are the way to go.

I can't comment on how it might affect your career on either the short of long term, though. That said, I expect that the demand for these types of rich webapps will become larger as we move forward.

I'm turned 22 ten years ago myself, but I think making that statement you made is unfair.


So you think that client side JS web apps are 'the way to go'. What's wrong with server side MCV web applications?

How does Ember.js in the clients browser scale when you have a a lot of data that needs marshaling / unmarshaling or generally processing and moving around? Surely it's more performant to do this on the JVM on the server rather than relying on the clients computing power (or lack of). Ideally you wouldn't do a lot of data processing in the MVC part of an app anyway but it seems like you're telling me the whole web app needs to be client side?


So, you would do most data-processing on the server side. But the data that your client-side application needs you will server to it, most likely via JSON.

You can definately go too far and implement too much on the client side, and this is generally a bad approach.

It's like with anything else. You need to figure out the balance between what you process on the server and what you process on the client.


Most data-processing (if not all) should be done on the server-side. Your API should give your front-end app as much of a complete data-set as possible. Note that data 'appearance' is fine on the front-end for the most part.


So what's the point of making the MVC portion of the application client side when I can just use Spring MVC (or similar) and keep to the same tech stack that the rest of the project is using? Same goes for .NET projects etc?


If you write all of your code to run on the server then you need to pull down a full page from the server every time you want to update your data.

There's plenty of reasons you might want to avoid this in some cases. For example, you might want your forms to be validated without waiting for the user to push submit. You might have rich content in some markup language (like markdown) and you want the user to have a live preview on the same page as they are editing. Or you might have an app with real time data that changes frequently and you don't want the user to sit there pushing refresh constantly.


This functionality is already provided via AJAX. There's no need for me to put the whole MVC later on the client side to achieve this.

You don't need to pull a whole page down to get new data and you can do the form validation on the client side although you need to redo the validation on the server side anyway to make sure the client JS hasn't been tampered with.


Once you are doing AJAX you are going to be writing Javascript (or something that compiles to it). Ember.js can help with that. So rather than writing a bunch of code to pull down JSON from the server and manually update the DOM in ways that deal with various browser quirks you can say "here's my model, here's how I want it rendered, link it to this REST API" and it will take care of a ton of heavy lifting for you.

It's true that it doesn't give you any magical power that you didn't have before and you can do everything it can do with vanilla javascript or any of the other frameworks. However that's a bit like saying you don't see the point of rails because you can just use vanilla PHP for everything.


You're speaking as if doing AJAX and doing client-side MVC are one step apart. Moreover, you're speaking as if using server-side MVC forces the programmer to use no JavaScript at all. At best, this is naive. Either that, or you deliberately misrepresenting technologies to promote something.

The simplest way to use AJAX with a server-side MVC is by fetching blocks of pre-rendered HTML. This is commonly known as AHAH. It's dead-simple to do, powerful and trivial to use via progressive enhancement. That is what you should treat as the server-side alternative to client-side MVC.


If your app has a lot of rich client functionality, it can be a lot easier to just use JSON data with client side MVC rather than having to constantly regenerate everything on the server, especially when several parts of the page need to be updated at once and a lot more performant.


Sounds like you haven't tried making a large AJAX app. Yes, if all you need to do is validate a form this or any other framework is overkill. You'll likely have multiple forms, lots of views, dynamically updating data, filtered tables, modals, etc etc. You can manage it all yourself, but frameworks like Ember maker this a whole lot easier.


Basically, your server side doesn't change much. The difference is that instead of outputting HTML, it outputs JSON.

Instead of writing your own code to handle AJAX on top of jQuery, you write code that handles the real logic and let the framework handle the DOM manipulation. In that way, it's easier to test, easier to debug, easier to provide superior experiences.

Right now, writing AJAX in the browser is equivalent of the JSPs of yesteryear. Remember all that horrific logic that used to creep into your JSPs? That's what jQuery looks like, and this new crop of frameworks is getting us to JSTL or facelets at the minimum.


The difference is that instead of outputting HTML, it outputs JSON.

Which is non-semantic, so it cannot be progressively enhanced, does not benefit from browser updates and is pretty much not crawlable by anyone except Google.


cues Ether beat


I'm sorry to hear that. The design and operation of InfoQ is out of my hands though :)


You can click to enlarge them, or you can click the link in the figure text to be taken to the correct GitHub revision of the file :)


Why are they images in the first place though? It's just code.


Sidenote: I love how Posterous has nice github code integration. I wonder what other blogging systems have something close/similar (for when I have to move off P).


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search:

HN For You