HAWK  |
So… I guess now that the guys are all here I’ll make a formal introduction. Giovanni, Don and Mark are the team behind our very soon to be released Node.js Jump Start book (which is the first in a new series that we’re introducing). Thanks for your time this morning guys.
|
HAWK  |
I’m Community Manager at SP and I’ll be moderating the session.
|
suniled  |
whats everyone experience with node?
|
HAWK  |
If you haven’t taken part in one of these sessions before, it’s a bit of a free for all. Jump in with a question at any time & I’ll make sure that I stay on top of any that might get lost in the noise.
|
JerryE  |
What IS node?
|
dmon  |
@suniled none as yet but seen on some job postings so wanting to learn more
|
suniled  |
|
mb4  |
What apps have you guys built that are in production?
|
stefano….  |
freshman here (haven’t even made a hello world yet)
|
TJKoury  |
I’m working on a rather large(ish) project right now…and I have a question for any expert who knows about transferring Backbone.js application state using Socket.IO.
|
DonNguye…  |
suniled, It has its idiosyncrasies but once you get used to them it’s a very pleasant programming environment
|
rettal  |
experimented only
|
DonNguye…  |
JerryE, it’s a platform for building fast and scalable network applications. It’s generally used for real time web apps
|
markdalg…  |
Node.js is a wrapper around Google’s V8 JavaScript engine
|
suniled  |
Been working on node for about 6months, love it !! building simple sites to chat boxes… nothing in production… all learning
|
suniled  |
Want to get into the real-time applications…
|
markdalg…  |
It allows you to interact with the system the way any normal application does
|
markdalg…  |
So Node.js doesn’t have to be limited to just web apps
|
TJKoury  |
@markdalgleish That’s a good point. I’ve made a few small tools that run cross platform
|
DonNguye…  |
@mb4, I was in charge of technology for HouseFix. Node.js did everything we wanted technologically but unfortunately the startup has decided to wind down for various business reasons
|
rettal  |
Ive heard a few critics of node.js, and watched a few videos on YouTube, Im sure you know the ones I mean?
|
dmon  |
I see LinkedIn are now using it. Is it a case that it’s really built for higher traffic sites rather than normal static type sites?
|
DonNguye…  |
@rettal, to which specific criticisms are you referring?
|
suniled  |
I wondering if some of the experts can talk about the future of node… like what can we expect when 1.0 comes out?
|
gvnn  |
@dmon well, you can handle more easily thousands of requests because of its async nature
|
DonNguye…  |
@dmon, it can be used for any site but its real competitive advantages shine when it comes to real time web applications
|
markdalg…  |
@dmon Node.js can be used as for static sites, but that’s not really playing to its strengths
|
rettal  |
spefically with regard to the event loop and how we as programmers are left to handle more lower level stuff whereas these problems have alreadybeen solved?
|
markdalg…  |
Where Node is really powerful is in its real-time, event-driven nature
|
DonNguye…  |
@TJKoury I imagine your question will require quite a bit of to and fro, perhaps it is one that is best for forums?
|
dmon  |
OK thanks :)
|
TJKoury  |
@DonNguyen Thanks mentioning that, I’ll take you up on it :>
Here’s a more general question: what are some strategies to reuse server-side code on the client?
|
HAWK  |
|
DonNguye…  |
@rettal, again do you have any specific examples of the ‘lower level stuff’? I know the callback style has received criticism but there are libraries available that make this read more like the traditional programming style
|
TJKoury  |
Thanks
|
markdalg…  |
I wouldn’t say that Node.js is very low level. I can see that people can struggle with the callback style
|
DonNguye…  |
TJKoury, there is a package called dnode https://github.com/substack/dnode It allows for RPC functionality and can be used to share libraries on the client and the server
|
suniled  |
the more you work on node though the callback style is not that big of a deal IMO
|
TimIgoe  |
I guess it makes a different way of thinking about working with the web? Rather tahn thinking in terms of “request in, handle, and give an answer”
|
markdalg…  |
The callback style forces you to think async from the beginning, it’s where a lot of Node’s power comes from
|
mb4  |
coding servers / http requests is lower level than most platforms.
|
TJKoury  |
@donNguyen I’ll definitely check that out, thanks
|
dmon  |
for a n00b, is it akin to a stripped down version of php+apache in one but more efficient?
|
rettal  |
I guess I mean with regard to the non-blocking nature of node.js
|
markdalg…  |
@rettal I’m not sure we understand what you’re asking
|
DonNguye…  |
mb4, that’s true. In an environment such as PHP, you have a separate web server such as Apache. In Node.js, you don’t have this decoupling. Whilst it does force you to create your own server (in under 10 lines) it also gives you full control over the http request response cycle
|
markdalg…  |
@dmon In Node, you write the server
|
markdalg…  |
There are libraries built around making a standard server easier, but you can make a server that’s much smarter
|
rettal  |
well, apache will handle that stuff for you, with node,js yours on your own thus increasing complexity but I guess callbacks help with that?
|
TJKoury  |
I’ve found that Node is more efficiently integrated with the ‘low-level’ stuff; try watching a file for changes using PHP.
(you can do it, but it will kill your CPU)
The callbacks with system hooks are a huge plus, as is having low-level control over the http server.
|
DonNguye…  |
dmon, it’s not just a stripped down version. Other big differences would be: single language between front end and back end, NoSQL as opposed to SQL, asynchronous as opposed to synchronous.
|
dmon  |
OK thanks I thnk I get it now. I had it in my head that it was ‘just’ another Apache server like Nginx in a sense, but clearly not :D
|
gvnn  |
@rettal it’s easier than you think
|
keller  |
As someone who is interested in this but has no experience in it. Where do you recommend I start? articles, sites & books?
|
dmon  |
@donNguyen OK thanks. Are ‘normal’ DBs like MySQL/Postgres available to use too out of the box or is it a case of adding in a library or ?
|
rettal  |
I think people see the famous seven ( or whatever ) line server and think WOW!, and rightly so but I think there is a lot more to it
|
suniled  |
|
DonNguye…  |
rettal, callbacks are not used for complexity management but rather asynchronous programming. Writing your own server in Node.js is not very complicated at all
|
suniled  |
|
keller  |
@suniled thanks
|
suniled  |
|
markdalg…  |
|
rettal  |
ok, thanks Don
|
DonNguye…  |
dmon, MySQL can be installed with a single command from the package system
|
suniled  |
Keep those close… bounce around… find a project… and nodeOUT
|
markdalg…  |
Personally, I learned a lot from trying to solve real problems using Node, throwing myself in the deep end
|
TJKoury  |
@rettal I think you’ll find that most of that ‘complexity’ that you’re missing from Apache or whatnot is unnecessary to whatever you’re working on, so you don’t have to manage a huge httpd.conf or whatever (most if which is copied from Apache forums…)
|
keller  |
will do!! 4 new bookmarks to read
|
TJKoury  |
you just configure what you need!
|
markdalg…  |
Also, I’d recommend visiting a local JS meetup and finding a Node.js expert to guide you through the basics
|
suniled  |
if you don’t have a good understanding on web protocols (like what http means, etc) its quite a steep climb
|
markdalg…  |
I found that to be possibly the best way to get up to speed
|
dmon  |
OK. So I’ve got an API I built for a couple of sites talking to a SAP system, using Node for something like that instead of the current apache/php/curl setup, would that be a good use? Not high traffic, but to start me out in a real-world enviro?
|
DonNguye…  |
keller, aside from the obligatory plug for Jump Start Node.js, projecteuler.net is my first resource when learning any new programming language
|
suniled  |
@markdalgleish true… but its not that easy finding one :)
|
gvnn  |
@dmon node is perfect for apis, especially if you talk json
|
DonNguye…  |
dmon, is it a REST API?
|
keller  |
thank you @DonNguyen
|
dmon  |
@donNguyen Errr… it feeds in/out text files, basically generates order files to send to SAP, gets back a reply file with successfully placed orders [in SAP], out of stock files, etc. either as .txt or .csv
|
mb4  |
It seems that most people using node for web apps use the Express framework. I haven’t found great example web apps that aren’t buggy as hell. Is it fair to say Node works well as a supporting technology for specific areas it’s well suited to but still doesn’t have a mature web app framework for building the whole thing in Node?
|
gvnn  |
@mb4 I don’t think that build a complete web framework like rail is the objective of node
|
markdalg…  |
@mb4 Trello is a great example of a large scale, high traffic site built with Node.js
|
DonNguye…  |
dmon, Node.js will serve your purpose perfectly well but that’s not the type of project where it really shines over and above PHP. As a learning project it works great
|
gvnn  |
@mb4 node is build for fast and non-blocking application (can be web or not)
|
mb4  |
oh, I didn’t know Trello is completely in Node. gvvn, that’s my impression too.
|
markdalg…  |
|
mb4  |
|
TJKoury  |
@mb4 I think it really matters what you’re trying to do. If you’re rendering pages on the server for SEO or whatever, you probably want to use something else. For me, since I use Backbone.js for everything and render views on the client, it works great as a data aggregator/cache/validator.
|
gvnn  |
@mb4 geeklist is a node app too. Node gie you the building blocks and the you can build your app as you like
|
mb4  |
Pulling in data from the Kinect and displaying visualisations. It seems like people are using Node for new things which is kinda cool.
|
suniled  |
|
DonNguye…  |
mb4, Express.js is an extremely well tested framework. Designed more to be like Sinatra rather than Rails. I imagine the bugs are more due to the programmer rather than the environment :-) In Jump Start Node.js, we spend quite a bit of time going through test driven design.
|
gvnn  |
@mb4 that’s is great if you want to build a fast and scaling application, instead of a monolithic app with rails (or other frameworks)
|
suniled  |
|
gvnn  |
|
dmon  |
@donNguyen ok thanks understood
|
markdalg…  |
@mb4 My experience with Express has been great. The only real issue I’ve had is with a module that had a memory leak, not with the web framework.
|
suniled  |
|
mb4  |
@gvnn, I’d never built a monolithic anything, just multiple small apps.
Thanks for the thoughts on frameworks, keen to check out your book when it’s released.
|
gvnn  |
@mb4 well then node can be a good option… I certainly suggest node for APIs and process of stream of data
|
markdalg…  |
Node is great for making lightweight but powerful apps
|
suniled  |
|
mb4  |
What are the best packages to use to build a JSON API backed by Postgres?
|
DonNguye…  |
mb4, for small apps have a look at meteor.com. One of the newer frameworks sitting on top of Node.js. Have a look at the screen cast for the party application. Your jaw will drop.
|
mb4  |
@DonNguyen I’ll check it out
|
markdalg…  |
Meteor is amazing, although I would treat it as a separate entity to Node
it’s built on top of Node, but abstracts it away from you
|
markdalg…  |
i.e. you can’t install arbitrary packages from npm
|
DonNguye…  |
markdalgesh, agreed. However for smaller single page web applications, I believe Meteor really shines. It is as you say somewhat of a different animal
|
suniled  |
Meteor has its own package manager, i think
|
markdalg…  |
@DonNguyen It is pretty amazing, I built a tool at work using Meteor for real-time communication between offices
|
DonNguye…  |
|
markdalg…  |
@suniled Yeah, it has “Smart Packages”
|
Nokrosis  |
Does anyone have Node.js vs. Other web server performance test? How can Node.js serve under heavy traffic for an app?
|
gvnn  |
but it’s not a “REAL” benchmark, it’s just a fibonacci calculation
but it gives you an idea… and php is surprisingly fast
|
mb4  |
What would you guys like Node to support that it doesn’t at the moment? What are the pain points?
|
suniled  |
|
markdalg…  |
I think it’s worth mentioning that a choice for or against Node should be based on what you’re trying to achieve, not so much its performance
|
DonNguye…  |
Nokrosis, benchmarking is a very tricky topic and it very much depends on the exact test you’re doing. However as a very broad generalization, it generally benchmarks favorably compared to other platforms. Performance is one of its core goals.
|
markdalg…  |
That’s not to say that it’s not fast (it is), but for certain kinds of apps it’s a much better solution
If I want to write a real-time web app, Node.js is an obvious choice
|
dmon  |
I think that’s what I couldn’t get my head round initially. It’s suitable for some apps, not others.
|
suniled  |
|
DonNguye…  |
Nokrosis, in addition to what markdalgesh said, it is generally better suited for anything IO intensive (database, network, disk)
|
TJKoury  |
Anybody a fan of Meteor/Derby?
|
markdalg…  |
I’m a big fan of Meteor
|
DonNguye…  |
suniled, that’s a fairly controversial benchmark I would recommend reading all of the responses as well in particular anything by Isaac Schlueter
|
markdalg…  |
I think there’s a bright future for the kind of approach that Meteor takes
|
suniled  |
yep… agreed
|
Nokrosis  |
@DonNguyen I’m running a media site with heavy traffic, i’m saving posts as static html files and including them with php into the page layout. Can i use Node.js to run this faster with fewer server resources?
|
DonNguye…  |
mb4, the package system is pretty amazing it supports a lot of esoteric software and platforms. One of the pain points is the immaturity of the package system. Because anybody can release a package you’re never sure what you’re getting in terms of quality.
|
TJKoury  |
@markdalgleish what would you say are the top two reasons you like it?
|
markdalg…  |
@TJKoury First, how easy it makes it to write a single page app with automatic data binding to the server. Nothing else comes close.
@TJKoury Secondly, how it shares code between server and client by default, something that normally requires a bit of work
|
gvnn  |
@mb4 i guess that the best practise is always to choose packages that are constantly maintained… a package that its last push was 1 year ago probably is not the right choice
|
DonNguye…  |
Nokrosis, yes but I would say this is more an architectural thing rather than a platform thing. Without knowing the specifics, at a first pass I would say that using an indexed database would be much faster than saving as static HTML files
|
TJKoury  |
@markdalgleish thanks
|
suniled  |
|
Nokrosis  |
@DonNguyen I’ll try that solution with Node.js and an indexed MongoDB
|
suniled  |
towards the middle they talk about these ‘bindings’
|
DonNguye…  |
Nokrosis, I would recommend doing a few small scale benchmarks first to help you decide whether the performance difference is worth the cost of doing a full migration across.
|
markdalg…  |
@suniled That article touches a lot on what I would say is one of Meteor’s biggest strengths and weaknesses
which is that Meteor have created their own ecosystem
They’ve made it ridiculously easy to create an app and deploy it to meteor.com
|
suniled  |
I don’t have any experience in meteor or derby but I’ve read a lot about them and some of my colleagues use meteor and others derby. It seems they both solve the same problem but with just a few tweaks that are different
|
markdalg…  |
But of course, that comes at the cost of separating itself from the Node community and all of its existing modules
|
suniled  |
but wouldn’t you say the down side is that ‘its there own ecosystem’
|
TJKoury  |
@markdalgleish Thanks again. I’ve looked at different ‘end-to-end’ solutions in the past, but always ended up writing my own b/c it seems they aren’t mature enough.
|
markdalg…  |
@suniled It depends who you are
|
suniled  |
@markdalgleish plus… i believe meteor got ridiculous amount of funding to get off the ground
|
TJKoury  |
@suniled something like 11 million
…kind of makes you wonder what their business plan is going to be…
|
suniled  |
*stack
|
TJKoury  |
I can’t imagine they’d be making bank off of hosting alone
|
DonNguye…  |
TJKoury they are going to release an enterprise product called Galaxy
|
TJKoury  |
Oh, ok.
|
suniled  |
@TJKoury hosting meteor apps
|
gvnn  |
to be honest I’m not a big fan of these frameworks, I’d rather build a set of apis and then a front end application that consumes these apis
keep the 2 layers separated gives me the chance of change the backend layer later on, keeping the same front end
|
HAWK  |
|
markdalg…  |
@gvnn Agreed
|
TJKoury  |
@gvnn hear hear
|
mb4  |
@gvnn, I don’t like all encompassing frameworks that absract the client / server divide either.
|
TJKoury  |
*here *here
|
markdalg…  |
@gvnn That said, I think things like Meteor and Derby are a sign of things to come
|
TJKoury  |
@markdalgleish I think Meteor/Derby will be the new PHP
|
mb4  |
What are your twitter / github handles ?
|
suniled  |
how does node.js fit into the WebRTC tech?
|
gvnn  |
@markdalgleish you are right, that is what helps a framework to be adopted by a larger audience
but, by the end of the day, all you need is HTTP :p
|
markdalg…  |
@mb4 Mine is, appropriately enough, markdalgleish
|
suniled  |
would node.js fit nicely into a browser?
|
TJKoury  |
@suniled Maybe into ChromeOS…
|
markdalg…  |
@gvnn Yeah, Meteor makes things that are normally quite tricky in Node ridiculously easy, so a lot of people will be attracted to it
As always, the downside is when you want to do something that isn’t quite the “Meteor way”
|
suniled  |
@markdalgleish i think devs are a little hesitant in getting into meteor because of the ecosystem… it maybe dead simple to get an app running but then what?
|
DonNguye…  |
mb4, my GitHub is nodeninja. Unfortunately with Twitter I’m still stuck in the 90’s
|
markdalg…  |
@suniled There are a lot of different kinds of devs out there. Some devs just want something easy and powerful, that does a lot of work for them.
Of course, that kind of power comes at a cost, which a lot of other devs don’t want
|
gvnn  |
@suniled what you can do is to build your core as a module and keep it separated as much as possible from meteor
that gives you the ability to change framework later on
|
suniled  |
@markdalgleish @gvnn interesting
|
HAWK  |
We have just over 5 minutes left in the session. Does anyone have a question that they haven’t received a satisfactory answer for?
|
muescha  |
i just have a private project in ruby/sinatra/nokogiri(mechanize): login into website, get html – and give back mobile html (iui) – can i use the backend part (login, parsing html, response like a api with json) with node? on client side then i can consume this json api with the client libraries you mentioned in the above links
|
suniled  |
|
gvnn  |
@suniled what you can do is also run your own npm server :p
|
TJKoury  |
@gvnn …using a Metor app on their server…
|
rettal  |
I have learnt a lot here and the links posted have been a great insight, thanks!
|
DonNguye…  |
muescha, that project will fit very well with Node.js. Anything relating to JSON consumption will fit like the proverbial glove
|
markdalg…  |
@muescha Yes, that kind of setup is definitely possible
|
suniled  |
@gvnn fun!
|
TJKoury  |
This has been great, thanks everyone!
|
gvnn  |
|
markdalg…  |
@TJKoury Meteor allows you to generate a tarball with everything needed to host it yourself
|
suniled  |
@gvnn thats where i’m working on getting my first ‘coming out the closet’ site !
|
TJKoury  |
@gvnn I was meta-kidding, but good suggestion
|
mb4  |
@gvnn, where can I stalk you?
|
HAWK  |
|
gvnn  |
@TJKoury everything is possible… we can run a web server in a quadcopter device flying in your room
|
HAWK  |
|
gvnn  |
@mb4 gvnnrules on twitter
|
TJKoury  |
@markdalgleish I did see that in the docs, but let’s be honest here, once you’re 6 months into a project the last thing you want to do is export all your data and re-ingest, while dealing with DNS registration
|
HAWK  |
Feel free to hang around and chat for as long as you like – I’ll leave the room open
And I’ll be posting a transcript up on both sitepoint.com and jspro.com later today
|
muescha  |
@DonNguyen @markdalgleish mhhh the html parsing makes me some headaches. or can i parse a html page like jquery oder DOMDocument with css/xpath ?
|
markdalg…  |
Thanks @HAWK :)
|
DonNguye…  |
One thing about Meteor is security. By default anyone can update anything right from their web browser. This is the default setting and you actually need to turn it off for security. One little gotcha.
|
TJKoury  |
@gvnn lol…buy me a quadcopter and I’ll mount a raspberryPI on it!
|
HAWK  |
Thanks very much to Don, Mark and Giovanni for your time this morning – esp at 7am!
|
TimIgoe  |
lol, plenty of day left for lots of node dev now then ;)
|
gvnn  |
@tjKoury there is a whole podcast on Nodeup about robots, and the node comunity is going crazy
|
TJKoury  |
@gvnn holy crap, how have I not seen this? Thanks for the tip.
|
markdalg…  |
@DonNguyen Yes, the famous Meteor demo video is only possible because security is off by default
|
gvnn  |
|
stefano….  |
Thanks for the chat, I’ve been reading posts and following links, even if I neven used node.js before..! Really interesting, I’d sure give it a try!
|
DonNguye…  |
Thanks Sarah. Thanks to everyone for tuning in and some great questions
|
stefano….  |
never*
|
dmon  |
Thanks for the chat everyone, found it very useful.
|
mb4  |
Thanks all, node is webscale.
|
keller  |
Thanks
|
DonNguye…  |
muescha, I may have misunderstood your question but there are HTML parsing libraries in the package ecosystem that make this job pretty easy
|
markdalg…  |
If you haven’t tried Node before, at least do this today:
1) Install Node.js
2) Create “helloworld.js” with 1 line: console.log(“Hello world”);
3) From the terminal, run “node helloworld”
|
muescha  |
@DonNguyen thx (parsing was only one part of it)
|
DonNguye…  |
mb4, from memory MongoDB is webscale, Node.js is rock star tech :-)
|
gvnn  |
|
DonNguye…  |
muescha, what’s the other part of your problem?
|
TJKoury  |
@gvnn I just added myself to the mailing list!
|
TJKoury  |
Thanks all, had a blast.
|
gvnn  |
all right guys, thanks to everybody… duty calls, time to go to work (the day’s just started in Melbourne)
|
markdalg…  |
Thanks everyone, hope I was at least somewhat helpful
|
suniled  |
Thanks for the tips!
|
JerryE  |
Thanks everyone!
|
markdalg…  |
If anyone wants to ask me anything else, catch me on Twitter
My handle is @markdalgleish
|
suniled  |
@gvnn time to go home here!
|
DonNguye…  |
Thanks guys. I will be around for a little bit longer in case we missed anything.
|
TimIgoe  |
certainly gives an interesting insight into node usage :)
and a lot of ideas
someone needs to work out how to double the hours available per day ;)
|
muescha  |
i think parsing is only the “problem” – (a) login to website (b) get html (c) pase html (d) reponse with json / something like an external api-proxy – add a api to a website (from extern)
|
markdalg…  |
I also wrote this blog article recently that some of you may find helpful getting started with creating Node modules:
markdalgleish.com/2012/09/test-driven-node-js-development-with-grunt/
|
muescha  |
@DonNguyen i think parsing is only the “problem” – (a) login to website (b) get html (c) pase html (d) reponse with json / something like an external api-proxy – add a api to a website (from extern)
|
markdalg…  |
Duty calls, I’m off to work now – it’s 8:06am here in Melbourne
Thanks guys
|
HAWK  |
Thanks Mark.
|
DonNguye…  |
muescha, all of those steps have been properly battle tested in Node.js you should have no problems doing all those things
|
DonNguye…  |
cheers Mark
|
muescha  |
@DonNguyen i was thinking about to move from sinatra to rails – but i think node.js can be an other idea – i like to be the response from node act as an api
|
HAWK  |
I have to head off too guys. Thanks for joining us this morning.
|
DonNguye…  |
It’s the kind of job that Node.js was meant to do
|
DonNguye…  |
thanks Sarah
|
muescha  |
@DonNguyen you have some keywords / packages which are interesting for this to look into it deeper?
|
DonNguye…  |
core http module should handle logins, Express.json for serving JSON
|
muescha  |
thx a lot :-)
|
DonNguye…  |
you’re welcome
|