people say: don't reinvent the wheel, let's look what's already out there, let's use some framework (or some libraries), or if you have a bad case of the not-invented-here syndrom in your company, you are going to develop your own
web application is that some server code serves some html (and maybe some apis) to the browser, in the browser there is some (or a lot of) javascript that manipulates the DOM
pages served by the server or does ajax requests back to the server. this concept is mostly true for either traditional apps as well as single page applications
duplication code duplication code duplication code duplication code duplication code duplication code duplication code duplication code duplication code duplicatio code duplicat code duplic code dup code du code cod co co which leads to lot of code duplication in templates, validation logic, models and lots of boiler plate code for communication between server and client
throughout this talk, if you don't understand something, just raise your hand and ask. probably my fault anyways since i spoke to quickly or my accent was too bad
between server and client. but they are still very alpha, good for prototyping, writing small apps, trying things out, but personally I wouldn't create a big million lines of code web application with 40+ developers yet
existing application better and connect your backend with your frontend code is incremental refactoring, since you hopefully can't afford to sit down, stop development for 6 months and rewrite everything
these totally different applications and totally different use cases and totally different technologies, that the underlying concepts people come up with are strikingly similar. basically it's thinking about your app in small components, that are as independent as possible. this may even make it directly into browsers: if you haven't heard about it yet, check out the proposed web components standard.
it's own url, and for seo reasons can just be included in a page rendered to a browser by the server or can be fetched separately or nested within other components by the apps javascript, where we only wanted to transport the data to the client and render it into html there
backbone we decided against having dedicated models in the frontend where views could subscribe on because of legacy reasons. so the data is coupled to the component, and if needed events synchronize data between components, a bit overhead, a bit duplication of data, but made development for us much faster, also we have a lot of different entities, so for us taking this route worked out very well. "
we see, that it's actually kind of a tree structure, for the sake of this presentation i simplified it slightly, actually our profile consists of over 200 components
Account Account Account Account Account Publication1 Publication2 Publication3 if we take our simplified example, a lot of components need the account of the user that's displayed, while that could be solved with in memory caching, a list of publications each need the publication entity, if we display 20 publications, that would mean 20 database queries, doing it in one query would be much faster though, and you have lot's of stuff like this
Connector Implementations Batch requirements and pass them to resolvers it batches them together as intelligently as possible, passes the requirements to resolvers
Connector Implementations Call Services as effective as possible (Multi-GET,...) which call the services/storages/etc as effective as possible, or just execute some service class methods
Connector Implementations Attach fetched data to Requirements and pass them back to the preparer the fetched data is attached to the requirements, passed back to the preparer
CALLBACK CALLBACK CALLBACK so in the first iteration the profile widget returns its requirements as well as a callback function that should be executed once all the requirements have been fullfilled
CALLBACK CALLBACK CALLBACK after the first iteration this callback is then executed while collecting all the requirements of the new subwidgets. the callback can then return further requirments as well as also further callbacks
CALLBACK CALLBACK CALLBACK and so on, this iterative process is done as long as there are components or callbacks available that return new requirements
array('accountId' => $this->requestContext->getAccountId()) ), ); yield array( new ServiceRequirement( 'scienceDisciplines', AccountService::class, 'getScienceDisciplines', array('account' => $this->account) ) ); } because then you can write it like this:
e.g. for a list of publications that you got from a solr search, you may not want to go to the database again to fetch each publication in each list item, but since a list item is supposed to be renderable separately as well, it needs this logic in there
takes a bit of time to get used to program this way, but everyone who joined our company in the last few months since we are doing it says after a week or so, that they actually can't imagine working any other way again (i'll talk more about the benefits later)
a bit of effort to make it as transparent as possible to see what happens in your application (which is a very good thing anyways). we have a debug toolbar that shows all the component on the page
php extension that makes the v8 js library available on the server. so we are executing the same code on the server and on the client to render the same templates. suprise: it's acutally really really fast
so experiments with sometimes over 20 variants running. the way we can do this quickly and easily is by just switching components for the different variants
<esi:include src="..." /> because every component has it's own url you can just render out a esi placeholder instead of the widget to tell varnish to fetch it separately and provided it has caching headers, get it out of the cache
<div id="placeholder"></div> <script>loadWidget('/aboutMe', function(w) { w.render({ replace : '#placeholder' }); })</script> so instead of rendering the widget you render a placeholder dom element and a script tag that loads the widget with an ajax request and then renders it on the client side
and render the important parts of the page, like the top menu and the profile header as well as the rest of the layout, for the left column and right column which are expensive to compute you just render placeholders and then flush the content to the client so that the browser already renders this
data for the left column and render out some javascript that takes this data and renders it into the components template client side and then replaces the placeholder with the rendered template