These are chat archives for canjs/canjs

24th
Dec 2016
You would use this to talk to ur api
Mohamed Cherif Bouchelaghem
@cherifGsoul
Dec 24 2016 00:09
@gKreator yeah I just started the app
next few days will have more code
Gira Minus
@gKreator
Dec 24 2016 00:10
My bad i miss reas ur earlier message lol
Read*
Mohamed Cherif Bouchelaghem
@cherifGsoul
Dec 24 2016 00:11
@gKreator no problem, because the structure here is important
Frank Lemanschik
@frank-dspeed
Dec 24 2016 09:01
@cherifGsoul what does this PSR7 mean?
i am looking in your repo and cant find anything there :)
is this what your talking about rendering canjs serverside via php?
Mohamed Cherif Bouchelaghem
@cherifGsoul
Dec 24 2016 18:08
@frank-dspeed PSR7 is a PHP standard to abstract http request-response via middleware
Frank Lemanschik
@frank-dspeed
Dec 24 2016 18:09
i don't understand why should some one abstract a http request in php?
isnt there curl for that?
Mohamed Cherif Bouchelaghem
@cherifGsoul
Dec 24 2016 18:09
and yeah I said for this just to present how we organise the app via middlewares and how to use canjs in the UI middleware more code to come
Frank Lemanschik
@frank-dspeed
Dec 24 2016 18:10
oh my god ok :)
expected something diffrent i hate php anyway
Mohamed Cherif Bouchelaghem
@cherifGsoul
Dec 24 2016 18:10
abstract means libraries and frameworks implements the same interface
Frank Lemanschik
@frank-dspeed
Dec 24 2016 18:10
ya curls interface
its the same always on php
:D
Mohamed Cherif Bouchelaghem
@cherifGsoul
Dec 24 2016 18:11
the same?? every framework implements its own classes
Frank Lemanschik
@frank-dspeed
Dec 24 2016 18:11
classes for curl?
:D
Mohamed Cherif Bouchelaghem
@cherifGsoul
Dec 24 2016 18:11
it's similar to express
Frank Lemanschik
@frank-dspeed
Dec 24 2016 18:11
ok i am happy that i don't need to deal with that
:smile:
Mohamed Cherif Bouchelaghem
@cherifGsoul
Dec 24 2016 18:11
yes classes that abstract Request-Response
ok cool
Frank Lemanschik
@frank-dspeed
Dec 24 2016 18:12
when i code php i only do api's
my main slogan is never let a backend app render html
so no frameworks needed
:D
Mohamed Cherif Bouchelaghem
@cherifGsoul
Dec 24 2016 18:13
the UI middleware dosent render HTML just caches it
Frank Lemanschik
@frank-dspeed
Dec 24 2016 18:13
also my slogan is don't put unneded caching into applications
the result will be html so we cache on cdn level the complet result
:D
Mohamed Cherif Bouchelaghem
@cherifGsoul
Dec 24 2016 18:13
ok
Frank Lemanschik
@frank-dspeed
Dec 24 2016 18:14
always remember caching is complex don't do it all over it will get realy inconsisten
DoneJS for example :) does that often
it returns cached values that don't exist but existed befor if your new version has fails
if your app needs falues more fast implament caching on db layer
only if your backend does often complex computing it needs a own cach layer
Mohamed Cherif Bouchelaghem
@cherifGsoul
Dec 24 2016 18:16
I agree
Frank Lemanschik
@frank-dspeed
Dec 24 2016 18:16
so for example realtime data processed and rendered often as json in same time frame without updates
i see always people do overcaching
php cache in app cache then db cache then html cache then send that to external cdn cache
:D
Mohamed Cherif Bouchelaghem
@cherifGsoul
Dec 24 2016 18:18
in my case I only cache the main html file as static file
Frank Lemanschik
@frank-dspeed
Dec 24 2016 18:18
no need for that
that will your cdn do
or your varnish server wich will perform much better then php
idaly you want less hits to php it self
for example i run some sites that have over 4 mio hits per day
Mohamed Cherif Bouchelaghem
@cherifGsoul
Dec 24 2016 18:21
and middlewares looks like expressjs middlewaes
Frank Lemanschik
@frank-dspeed
Dec 24 2016 18:21
there static html and cdn caching is the only way to go
so my nodejs apps generate as often as possible static html
backends return cached json responses
ya middelware is not needed for php
as it is not async
a php middelware is include(other.php)
as it gets executed always from start again
you gain nothing via middelware
middelware could also be your php class
Mohamed Cherif Bouchelaghem
@cherifGsoul
Dec 24 2016 18:29
@frank-dspeed what you mean by async?
Frank Lemanschik
@frank-dspeed
Dec 24 2016 18:30
Javascript is always Asyncron that means it runs in a event loop
PHP is Syncron code it means the code always gets executed in a row
that means for example if you do in javascript: var foo = myFunction(); console.log(foo); // you get: undefined
in php if you do the same $foo = anyThingThatRunsLongerThenACPUTick; echo $foo // you can get the result of foo
thats because at the time as console.log(foo) gots executed it don't got the result of the function its set to
thats why javascript uses callbacks and promises
you always need to wait till execution is finished and you never know when it is that
thats why for example all jquery users know $(document).read(function(){})
Mohamed Cherif Bouchelaghem
@cherifGsoul
Dec 24 2016 18:34
I thought that event loop in nodejs environement not the browser
Frank Lemanschik
@frank-dspeed
Dec 24 2016 18:34
there you have your first meet and greet with async execution and the document ready waits for that
OH
its general in javascript :D
not related to nodejs
so also in the browser
Mohamed Cherif Bouchelaghem
@cherifGsoul
Dec 24 2016 18:35
Ok even php has callbacks
Frank Lemanschik
@frank-dspeed
Dec 24 2016 18:36
not realy
:D
but ya you can do that with php :)
but by design no call back is needed while by design in js its needed
Mohamed Cherif Bouchelaghem
@cherifGsoul
Dec 24 2016 18:37
which was the last version you used in PHP?
Frank Lemanschik
@frank-dspeed
Dec 24 2016 18:37
8.0
including hhvm
Mohamed Cherif Bouchelaghem
@cherifGsoul
Dec 24 2016 18:37
8.0?? is not released yet
Frank Lemanschik
@frank-dspeed
Dec 24 2016 18:37
i know
i am always on edge my frind
i am also on donejs 1.0 :)
its also not released
but thats don't matters
Mohamed Cherif Bouchelaghem
@cherifGsoul
Dec 24 2016 18:38
ok thank you for the infos :)
Frank Lemanschik
@frank-dspeed
Dec 24 2016 18:38
you can belive me php is not realy async
but sure you can code some functions with a async like interface
but it makes no sense as you got promis build in
you can use that if you like to code in php like in node
:D
Mohamed Cherif Bouchelaghem
@cherifGsoul
Dec 24 2016 19:06
@all happy holidays
Thomas Sieverding
@Bajix
Dec 24 2016 23:39
@phillipskevin Up for releasing canjs/can-route#57 ?