How not to serve an AngularJs application from Pharo

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
15 messages Options
Reply | Threaded
Open this post in threaded view
|

How not to serve an AngularJs application from Pharo

Stephan Eggermont-3
A small experiment in serving an AngularJs application from Pharo.

Gofer it
    smalltalkhubUser: 'StephanEggermont' project: 'OpenSpace';
    configuration;
    loadDevelopment.
 
OpenSpace new start.

Start a browser and open it on

Uses Teapot. 



Reply | Threaded
Open this post in threaded view
|

Re: How not to serve an AngularJs application from Pharo

kilon.alios
Very interesting , I always wonder how you can combine those two together. 

Really nice I now see the teapot stuff, for example this

GET: 'demo/common/style.css' -> [ self styleCss ];

is really flexible meaning you can interpret http addresses and map them to pharo methods. This a really cool idea indeed, I see now why people are excited about teapot. Excuse my ignorance about web development but html/css and js always scared me away :D

If its that simple I am definetly going to use this for my website with pharo as backend as you did with this example.

Loads of potential here. Thanks for this tutorial. 

On Mon, Oct 27, 2014 at 7:11 PM, Stephan Eggermont <[hidden email]> wrote:
A small experiment in serving an AngularJs application from Pharo.

Gofer it
    smalltalkhubUser: 'StephanEggermont' project: 'OpenSpace';
    configuration;
    loadDevelopment.
 
OpenSpace new start.

Start a browser and open it on

Uses Teapot. 




Reply | Threaded
Open this post in threaded view
|

Re: How not to serve an AngularJs application from Pharo

Stephan Eggermont-3
In reply to this post by Stephan Eggermont-3
Kilon wrote
>Really nice I now see the teapot stuff, for example this
>
>GET: 'demo/common/style.css' -> [ self styleCss ];
>
>is really flexible meaning you can interpret http addresses and map them to pharo methods. This a really cool idea indeed, I see now why people are excited about teapot. Excuse my ignorance about web >development but html/css and js always scared me away :D

I found it a very easy way to get some existing javascript app delivered fast from Pharo.
It needs a lot of refactoring and cleaning up to become maintainable though. Separate classes
for the angular components, and the canvas from Seaside to structure the html.

A more difficult aspect is how to create the javascript. For (qc)magritte applications it
looks like a builder should be able to generate form components and a json data binding.
With GT it should even be possible to integrate javascript development directly in the
pharo image.

And it might be better to use React or Amber or SqueakJS

Stephan
Reply | Threaded
Open this post in threaded view
|

Re: How not to serve an AngularJs application from Pharo

kilon.alios
would it not be better to have the html / css and js code outside the image ? so instead to load files instead of return strings ? 

this would make it easier to edit the code for html/css/js . GT js integration no idea how that works, does GT has for example syntax highlighting or other js specific features ? 

Even though I always have been a supporter of Amber the IDE has still a very long way to go. Dont know about Seaside, but I assume for Seaside js code will still be something foreign. I think in practice would be better to use the IDE tools offered by firefox and chrome, though its still possible to use both amber and these tools, amber does not produce readable js code. No clue about React and SqueakJS. I am very new to web dev so probably I miss a lot, but frankly I found the fragmentation so shocking and so many negative opinions about the whole workflow that I have been reluctant to invest as much time as I have invested in Pharo. But then the things I do are not so web orientated as other people. But still I am very interested into this.

SqueakJS looks definitely  very interesting. 

On Mon, Oct 27, 2014 at 10:05 PM, Stephan Eggermont <[hidden email]> wrote:
Kilon wrote
>Really nice I now see the teapot stuff, for example this
>
>GET: 'demo/common/style.css' -> [ self styleCss ];
>
>is really flexible meaning you can interpret http addresses and map them to pharo methods. This a really cool idea indeed, I see now why people are excited about teapot. Excuse my ignorance about web >development but html/css and js always scared me away :D

I found it a very easy way to get some existing javascript app delivered fast from Pharo.
It needs a lot of refactoring and cleaning up to become maintainable though. Separate classes
for the angular components, and the canvas from Seaside to structure the html.

A more difficult aspect is how to create the javascript. For (qc)magritte applications it
looks like a builder should be able to generate form components and a json data binding.
With GT it should even be possible to integrate javascript development directly in the
pharo image.

And it might be better to use React or Amber or SqueakJS

Stephan

Reply | Threaded
Open this post in threaded view
|

Re: How not to serve an AngularJs application from Pharo

S Krish

"would it not be better to have the html / css and js code outside the image ? so instead to load files instead of return strings ? "

GET: '/index.html' -> [ self openspaceHtml ]; 

can be modified to:

GET: '/index.html' -> [ self  fetch: 'html/openspace.html' ]; 

and the fetch: method can be coded to return the file statically stored..   ( increase efficiency by using a cache with change detection on say filesize / timestamp )



On Tue, Oct 28, 2014 at 1:51 AM, kilon alios <[hidden email]> wrote:
would it not be better to have the html / css and js code outside the image ? so instead to load files instead of return strings ? 

this would make it easier to edit the code for html/css/js . GT js integration no idea how that works, does GT has for example syntax highlighting or other js specific features ? 

Even though I always have been a supporter of Amber the IDE has still a very long way to go. Dont know about Seaside, but I assume for Seaside js code will still be something foreign. I think in practice would be better to use the IDE tools offered by firefox and chrome, though its still possible to use both amber and these tools, amber does not produce readable js code. No clue about React and SqueakJS. I am very new to web dev so probably I miss a lot, but frankly I found the fragmentation so shocking and so many negative opinions about the whole workflow that I have been reluctant to invest as much time as I have invested in Pharo. But then the things I do are not so web orientated as other people. But still I am very interested into this.

SqueakJS looks definitely  very interesting. 

On Mon, Oct 27, 2014 at 10:05 PM, Stephan Eggermont <[hidden email]> wrote:
Kilon wrote
>Really nice I now see the teapot stuff, for example this
>
>GET: 'demo/common/style.css' -> [ self styleCss ];
>
>is really flexible meaning you can interpret http addresses and map them to pharo methods. This a really cool idea indeed, I see now why people are excited about teapot. Excuse my ignorance about web >development but html/css and js always scared me away :D

I found it a very easy way to get some existing javascript app delivered fast from Pharo.
It needs a lot of refactoring and cleaning up to become maintainable though. Separate classes
for the angular components, and the canvas from Seaside to structure the html.

A more difficult aspect is how to create the javascript. For (qc)magritte applications it
looks like a builder should be able to generate form components and a json data binding.
With GT it should even be possible to integrate javascript development directly in the
pharo image.

And it might be better to use React or Amber or SqueakJS

Stephan


Reply | Threaded
Open this post in threaded view
|

Re: How not to serve an AngularJs application from Pharo

kilon.alios
oh brilliant, I really like this design very much. Definitely will look a bit deeper into this . 

I guess it makes sense to pass the source files as string when the web app is finished to speed up loading times. 

I really like this workflow for creating web apps. Well done guys. 

On Wed, Oct 29, 2014 at 9:31 AM, S Krish <[hidden email]> wrote:

"would it not be better to have the html / css and js code outside the image ? so instead to load files instead of return strings ? "

GET: '/index.html' -> [ self openspaceHtml ]; 

can be modified to:

GET: '/index.html' -> [ self  fetch: 'html/openspace.html' ]; 

and the fetch: method can be coded to return the file statically stored..   ( increase efficiency by using a cache with change detection on say filesize / timestamp )



On Tue, Oct 28, 2014 at 1:51 AM, kilon alios <[hidden email]> wrote:
would it not be better to have the html / css and js code outside the image ? so instead to load files instead of return strings ? 

this would make it easier to edit the code for html/css/js . GT js integration no idea how that works, does GT has for example syntax highlighting or other js specific features ? 

Even though I always have been a supporter of Amber the IDE has still a very long way to go. Dont know about Seaside, but I assume for Seaside js code will still be something foreign. I think in practice would be better to use the IDE tools offered by firefox and chrome, though its still possible to use both amber and these tools, amber does not produce readable js code. No clue about React and SqueakJS. I am very new to web dev so probably I miss a lot, but frankly I found the fragmentation so shocking and so many negative opinions about the whole workflow that I have been reluctant to invest as much time as I have invested in Pharo. But then the things I do are not so web orientated as other people. But still I am very interested into this.

SqueakJS looks definitely  very interesting. 

On Mon, Oct 27, 2014 at 10:05 PM, Stephan Eggermont <[hidden email]> wrote:
Kilon wrote
>Really nice I now see the teapot stuff, for example this
>
>GET: 'demo/common/style.css' -> [ self styleCss ];
>
>is really flexible meaning you can interpret http addresses and map them to pharo methods. This a really cool idea indeed, I see now why people are excited about teapot. Excuse my ignorance about web >development but html/css and js always scared me away :D

I found it a very easy way to get some existing javascript app delivered fast from Pharo.
It needs a lot of refactoring and cleaning up to become maintainable though. Separate classes
for the angular components, and the canvas from Seaside to structure the html.

A more difficult aspect is how to create the javascript. For (qc)magritte applications it
looks like a builder should be able to generate form components and a json data binding.
With GT it should even be possible to integrate javascript development directly in the
pharo image.

And it might be better to use React or Amber or SqueakJS

Stephan



Reply | Threaded
Open this post in threaded view
|

Re: How not to serve an AngularJs application from Pharo

Stephan Eggermont-3
In reply to this post by Stephan Eggermont-3
Kilon wrote:
>would it not be better to have the html / css and js code outside the image ? so instead to load files instead of return strings ?

Only for the things that are really static. All other parts should be in the image, and be generated,
just like the seaside canvas does for html. Working with files just kills my productivity, especially if I have
to switch out of Pharo.

For deployment, you can generate files, but then you don't serve them with Pharo.

Of course, if you start out with files like in this example, it takes some time to refactor
towards a sensible model.

Stephan
Reply | Threaded
Open this post in threaded view
|

Re: How not to serve an AngularJs application from Pharo

Attila Magyar
In reply to this post by S Krish
Also, there is a

 serveStatic: '/statics' from: '/var/www/htdocs'

if someone wants to store something outside the image.
Reply | Threaded
Open this post in threaded view
|

Re: How not to serve an AngularJs application from Pharo

Pierce Ng-3
In reply to this post by kilon.alios
On Mon, Oct 27, 2014 at 10:21:18PM +0200, kilon alios wrote:
> Even though I always have been a supporter of Amber the IDE has still a
> very long way to go.

I've been meaning to build a code browser for Amber (and GST) in Pharo with
Omnibrowser using the Shampoo protocol[1], once I get some copious spare time.

[1] http://dmitrymatveev.co.uk/shampoo

Pierce

Reply | Threaded
Open this post in threaded view
|

Re: How not to serve an AngularJs application from Pharo

stepharo
I'm really interested to see how we could develop amber inside pharo and
generate JS/amber code.
May be you should look at spec instead of OB.

On 4/11/14 03:55, Pierce Ng wrote:

> On Mon, Oct 27, 2014 at 10:21:18PM +0200, kilon alios wrote:
>> Even though I always have been a supporter of Amber the IDE has still a
>> very long way to go.
> I've been meaning to build a code browser for Amber (and GST) in Pharo with
> Omnibrowser using the Shampoo protocol[1], once I get some copious spare time.
>
> [1] http://dmitrymatveev.co.uk/shampoo
>
> Pierce
>
>


Reply | Threaded
Open this post in threaded view
|

Re: How not to serve an AngularJs application from Pharo

kilon.alios
In reply to this post by Pierce Ng-3
I have welcomed Amber with open arms, but I have failed miserably to wrap my head around it. 

Is ironic if you think about, Pharo really lacks documentation even in basic areas, libraries are nowhere near as powerful as those offered by javascript yet I have found Pharo way easier to use. Web development looks to me like a big pile of unnecessary mess. Actually Amber is the best part of it :D

So the problem for me is not so much the System Browser , but the steep learning curve . Or maybe its just the fact that I dont like many of the web frameworkds, including html / js / css etc. 

I wish I could make something in pharo and click a button to deploy it as a website but alas thats just a dream. I think however that for the amount of developers Amber has been making some amazing progress. 



On Tue, Nov 4, 2014 at 4:55 AM, Pierce Ng <[hidden email]> wrote:
On Mon, Oct 27, 2014 at 10:21:18PM +0200, kilon alios wrote:
> Even though I always have been a supporter of Amber the IDE has still a
> very long way to go.

I've been meaning to build a code browser for Amber (and GST) in Pharo with
Omnibrowser using the Shampoo protocol[1], once I get some copious spare time.

[1] http://dmitrymatveev.co.uk/shampoo

Pierce


Reply | Threaded
Open this post in threaded view
|

Re: How not to serve an AngularJs application from Pharo

stepharo

On 4/11/14 13:53, kilon alios wrote:
I have welcomed Amber with open arms, but I have failed miserably to wrap my head around it. 

Is ironic if you think about, Pharo really lacks documentation even in basic areas,
Are you joking? I spend my time writing books and chapters and their quality is quite good.
libraries are nowhere near as powerful as those offered by javascript yet I have found Pharo way easier to use. Web development looks to me like a big pile of unnecessary mess. Actually Amber is the best part of it :D

So the problem for me is not so much the System Browser , but the steep learning curve . Or maybe its just the fact that I dont like many of the web frameworkds, including html / js / css etc. 

I wish I could make something in pharo and click a button to deploy it as a website but alas thats just a dream.

I would like to have a solution for that without having a smalltalk compiler in JS as amber is doing.
I think however that for the amount of developers Amber has been making some amazing progress. 



On Tue, Nov 4, 2014 at 4:55 AM, Pierce Ng <[hidden email]> wrote:
On Mon, Oct 27, 2014 at 10:21:18PM +0200, kilon alios wrote:
> Even though I always have been a supporter of Amber the IDE has still a
> very long way to go.

I've been meaning to build a code browser for Amber (and GST) in Pharo with
Omnibrowser using the Shampoo protocol[1], once I get some copious spare time.

[1] http://dmitrymatveev.co.uk/shampoo

Pierce



Reply | Threaded
Open this post in threaded view
|

Re: How not to serve an AngularJs application from Pharo

kilon.alios
Stef I did not meant it as offence, of course you do great amount of work for documentation. But I cannot ignore the fact that PBE is still stuck to 1.4, that there is no documentation for Pharo Morphic and most libraries if not all are partly documented."lacks documentation" does not mean that there is no documentation. I meant exactly what I typed. 

Stef you guys do an amazing job and I am proud to be a member of the Pharo community and make my own small contributions to make Pharo more popular and better. 

On Fri, Nov 7, 2014 at 2:27 PM, stepharo <[hidden email]> wrote:

On 4/11/14 13:53, kilon alios wrote:
I have welcomed Amber with open arms, but I have failed miserably to wrap my head around it. 

Is ironic if you think about, Pharo really lacks documentation even in basic areas,
Are you joking? I spend my time writing books and chapters and their quality is quite good.
libraries are nowhere near as powerful as those offered by javascript yet I have found Pharo way easier to use. Web development looks to me like a big pile of unnecessary mess. Actually Amber is the best part of it :D

So the problem for me is not so much the System Browser , but the steep learning curve . Or maybe its just the fact that I dont like many of the web frameworkds, including html / js / css etc. 

I wish I could make something in pharo and click a button to deploy it as a website but alas thats just a dream.

I would like to have a solution for that without having a smalltalk compiler in JS as amber is doing.
I think however that for the amount of developers Amber has been making some amazing progress. 



On Tue, Nov 4, 2014 at 4:55 AM, Pierce Ng <[hidden email]> wrote:
On Mon, Oct 27, 2014 at 10:21:18PM +0200, kilon alios wrote:
> Even though I always have been a supporter of Amber the IDE has still a
> very long way to go.

I've been meaning to build a code browser for Amber (and GST) in Pharo with
Omnibrowser using the Shampoo protocol[1], once I get some copious spare time.

[1] http://dmitrymatveev.co.uk/shampoo

Pierce




Reply | Threaded
Open this post in threaded view
|

Re: How not to serve an AngularJs application from Pharo

Sven Van Caekenberghe-2
Kilon,

You did start with converting PBE, right ? What is the current status ? I kind of liked the git book. And it is badly needed, indeed.

Sven

> On 07 Nov 2014, at 13:56, kilon alios <[hidden email]> wrote:
>
> Stef I did not meant it as offence, of course you do great amount of work for documentation. But I cannot ignore the fact that PBE is still stuck to 1.4, that there is no documentation for Pharo Morphic and most libraries if not all are partly documented."lacks documentation" does not mean that there is no documentation. I meant exactly what I typed.
>
> Stef you guys do an amazing job and I am proud to be a member of the Pharo community and make my own small contributions to make Pharo more popular and better.
>
> On Fri, Nov 7, 2014 at 2:27 PM, stepharo <[hidden email]> wrote:
>
> On 4/11/14 13:53, kilon alios wrote:
>> I have welcomed Amber with open arms, but I have failed miserably to wrap my head around it.
>>
>> Is ironic if you think about, Pharo really lacks documentation even in basic areas,
> Are you joking? I spend my time writing books and chapters and their quality is quite good.
>> libraries are nowhere near as powerful as those offered by javascript yet I have found Pharo way easier to use. Web development looks to me like a big pile of unnecessary mess. Actually Amber is the best part of it :D
>>
>> So the problem for me is not so much the System Browser , but the steep learning curve . Or maybe its just the fact that I dont like many of the web frameworkds, including html / js / css etc.
>>
>> I wish I could make something in pharo and click a button to deploy it as a website but alas thats just a dream.
>
> I would like to have a solution for that without having a smalltalk compiler in JS as amber is doing.
>> I think however that for the amount of developers Amber has been making some amazing progress.
>>
>>
>>
>> On Tue, Nov 4, 2014 at 4:55 AM, Pierce Ng <[hidden email]> wrote:
>> On Mon, Oct 27, 2014 at 10:21:18PM +0200, kilon alios wrote:
>> > Even though I always have been a supporter of Amber the IDE has still a
>> > very long way to go.
>>
>> I've been meaning to build a code browser for Amber (and GST) in Pharo with
>> Omnibrowser using the Shampoo protocol[1], once I get some copious spare time.
>>
>> [1] http://dmitrymatveev.co.uk/shampoo
>>
>> Pierce
>>
>>
>
>


Reply | Threaded
Open this post in threaded view
|

Re: How not to serve an AngularJs application from Pharo

wernerk
> Is ironic if you think about, Pharo really lacks documentation even in basic areas,
> Are you joking? I spend my time writing books and chapters and their quality is quite good.
Hi,
i think in the meantime the docu _is quite good. i like the deep into
pharo book, that also covered basic areas like Blocks (i liked that
chapter). btw there are a few other areas where i'd want to read
something about: refactoring, the RBSomething objects, Ring (the
RGSomething objects), AST.
werner