Related
I recently began as a web designer but spend more and more time learning front end web development. I enjoy Javascript and the work. I am very interested in creating web applications unfortunately I find that Javascript frameworks change so quickly. I began learning Angular 1.3 only to find the release of 2.0 to kill my interest. I also worry that learning frameworks will not help my skill as a developer only as a framework user. It makes me want to just develop with modular Vanilla.
What recommendations do you have for creating web applications with this problem in mind? I greatly appreciate your comments.
One of the best things you can learn as a developer is to ALWAYS find a solution before creating one.
Yes, vanilla Javascript surely has it's place, for as you progress as a developer, you too will want to write your own javascript.
I recently just got into MEAN stack development, and I can definitely say if I were to try to write all of this by hand, especially if your not an expert, would be a nightmare, if not impossible/impractical.
I understand the craving / desire, we all have it. We start to code and feel like wizards when we can conjure up this neat program we build all by ourselves. But we also have to realize there is a little bit of reasoning behind utilizing frameworks, just take this into perspective, taking MEAN stack as an example,
Right now, there are a team of developers working on MongoDB, a team of developers working on Angular, Express, NodeJS etc.
Each of these frameworks is being FOCUSED on and perfected, think about that for a second. These aren't things that are just thrown together, these are strong written frameworks, and when combined together, can make an awesome toolset.
Building your own library can also be a good idea, and I would encourage it, especially for CUSTOM solutions. This can be fun and creative.
However, as for making the strongest web framework you can have, it would take more work than whats practical. Utilizing the work of others is one of the most important things you can do as a developer! Good luck.
You could resort to Google Trends to figure out which technologies last and where the trend is going. A quick research points very much to the study of jQuery (even though AngularJS trend is more impressive):
http://www.google.com/trends/explore#q=AngularJS%2C%20%2Fm%2F0268gyp%2C%20%2Fm%2F02p97&cmpt=q&tz=
Going Vanilla is always a good idea in order to strengthen your understanding of the fundamentals - learning some popular frameworks is essential to work productively and find good projects!
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
I've been reading a lot on Nodejs and its frameworks and recently finished my first full javascript frontend (using Angularjs).
I've decided that my next pet project will be a Nodejs adventure using one of these two frameworks:
Sails.js
Meteor
I've read about both, but still can't quite grasp their differences and why should I choose to use one over the other. So please put on your best salesman hat, pick a framework, and sell it me.
Some features I require for my pet project are:
Live scores
Reddit-like threads, realtime
Wikipedia-like page edition
Users/Roles
I can't speak for Meteor, but I can help provide a little background on Sails because I created it.
tldr;
Sails is not a panacea for all of the web's problems-- but I believe Node.js is. The goal of Sails is to provide a practical framework for developing complete, scalable, startup and enterprise-friendly applications built on node.js. I started Balderdash with the question "Can we use Node.js for everything?". Sails is the answer.
From our new docs:
Sails is, of course, a web framework. But take a step back. What does that mean? Sometimes, when we refer to the "web", we mean the "front-end web." We think of concepts like web standards, or HTML 5, or CSS 3; and frameworks like Backbone, or Angular, or jQuery. Sails is not "that kind" of a web framework. Sails works great with Angular and Backbone, but you would never use Sails instead of those libraries.
On the other hand, sometimes when we talk about "web frameworks", we mean the "back-end web." This evokes concepts like REST, or HTTP, or WebSockets; and is built on technologies like Java, or Ruby, or Node.js. A "back-end web" framework helps you do things like build APIs, interact with databases, serve HTML files, and handle hundreds of thousands of simultaneous users. Sails is "that kind" of web framework.
A couple of years ago, I made a commitment to use Node.js for everything- it was love at first sight. I built Sails on top of Express and Socket.io because they were (and still are) the most well-established Node modules for their respective use cases. The request-handling code in Sails is Express-compatible, with the additional advantage of implicit support for Socket.io.
Sails is designed to be compatible with whatever strategy you have for building your front-end(s) in Angular, Backbone, iOS/ObjC, Android/Java, or even just offering up a raw API to be used by another web service or your developer community. If you end up changing your approach (e.g. switching from Backbone to Angular) or building a new front-end entirely (e.g. building a Windows Phone native app), your Sails app will still work. As you may already know, some people call this approach a Service Oriented Architecture, or SOA (Joe McCann has a great deck on the subject.)
Along the same lines, Sails maintains other familiar conventions for building web servers-- a standard MVC structure, the ability to create clean APIs, and core modules which are open, configurable, extensible, and even swappable. This means that Sails can be customized to fit its users' needs, as low-level as is necessary.
In 2013, the framework experienced some tremendous growth in popularity, and our consulting business grew. The rest of the core maintainers and I broadened our focus on making backend development as quick and straightforward as possible. Related aspects of Sails like hooks (plugins), testing and docs have all come a long way over the last year thanks to the efforts of both our core team and the (ever-expanding) Sails community at large. There are plenty of roadmap items that we're still working on, but I believe Sails is the best option out there for stable, maintainable MVC development on Node today. The rest of the team and I are committed to its continued maintenance and feature development, and since we use it for all of our client projects, it's not going anywhere.
I am head-over-heels committed to making Sails the best web framework out there, but never at the expense of Node.js. The core team and I are relentlessly devoted to the enhancement of the Node ecosystem, and that means embracing NPM, leveraging existing Node technologies and best practices, etc. Not just because it makes more sense, but because we're Node.js developers. The motivation for all of our efforts is to make Node more accessible, not to supersede it. So, if, in some weird parallel universe, I was given a Faustian choice between converting Sails to some other language, or completely ditching Sails but still being able to use Node, I would pick the latter.
Additional Resources:
FAQ | Sails 101 | Original screencast | Contribution Guide | Stackoverflow
Google Group | Roadmap | IRC: #sailsjs on Freenode | Build Status
I've built a couple of projects with Meteor and haven't worked with Sails yet. So my opinion is going to be certainly biased, hopefully its helpful anyways.
Building the front-end
Meteor provides its own front-end framework called Blaze-to be included in the upcoming 0.8 release. Meteor takes care of binding data from your collections to your views. Because of this you don't have to worry about telling your views to update, they just do it.
On the other hand, Sails only provides a backend framework and you will have to bring your own front-end framework.
Unlike most Node.js frameworks Meteor is synchronous
Meteor runs in a loop and if you want to use Node.js packages you will have to do some extra work to make sure they operate properly in Meteor.
Sails seems to be a straightforward MVC Node.js framework so there shouldn't be anything too surprising when you look into it.
You should use MongoDB with Meteor
Yes you can use other databases with Meteor but they don't have anywhere near the same support as MongoDB does. Whereas with Sails, it looks like they have ORMs for a couple of databases.
Performance
For large scale applications Meteor may not perform well. There is a lot of work being done to tackle this issue and by the end of 2014 we can expect there to be scaling solutions for Meteor.
Stability
Meteor is still very fresh and has not hit 1.0 yet. You should expect some changes to be made over the next couple of releases that will break backwards compatibility. If you are getting started with it ASAP then you might want to consider using the 0.8-rc0 branch. That being said, some of the features in the pipeline are really great and will make a 1.0 version very enticing.
Final thoughts?
I like Meteor because of its idiosyncrasies. You will have to learn the Meteor way of doing things but once you start doing it, you feel like you've drunk the kool-aid. Because of the way data is bound to views the lines between the server and client are not distant. Meteor represents a paradigm shift in application architecture and if you haven't tried it yet I would recommend it.
PS Checkout the roadmap to get a feel for what is coming up.
I can only give an opinion on sails. I am an extremely experienced Javascript developer and have been building embedded set top box applications built on Javascript since the 90's.
Things that worked really well
- Getting started was great and I felt very supported by the published materials
- The learning curve was very short, and there is a healthy community behind sails
- After the initial learning it is very easy to be creative quickly
Things that could be improved
- Complex data structures are tricky to implement
- Passport.js integration was painful as there is no clean reference materials
Recommendations
- Ponzi coder has a great tutorial and It really helped me get going https://www.youtube.com/user/ponzicoder
- Knowing more about express and waterline will help when you attempt more complex data challenges
Overall I would recommend sails.
I currently use Meteor and have not used Sails.js.
Meteor has been exceedingly pleasant to work with and I think it would be an excellent choice for realtime web apps. Regarding users/roles, you can check out the integrated Accounts package and also search Atmosphere for community-contributed roles/permissions packages.
Ultimately I would recommend trying a small project with both technologies and seeing which you like better.
This question's answers are a community effort. Edit existing answers to improve this post. It is not currently accepting new answers or interactions.
I was wondering how one would go about developing a website from scratch with Node.js.
I understand how I could possibly do it, but I am interested in the best design practice.
I need this theoretical website to:
Do a lot of AJAX
Be very straightforward
Be relatively small
Connect to... let's say a MySQL server
In PHP, building a pretty small website was very straightforward - I set up PHP on Apache and a MySQL server and then do something like:
includes/db/ which has connect.php for connecting to the db, a file with common db related functions and so on
includes/layout/ which had stuff like footer.php, header.php, and other layout related stuff
includes/users/ to handle user related actions
Then PHP just let you build pages and include these files together to form a website - I could go something like:
<?php
require_once('inclues/users/user_session.php');
require_once('inclues/db/connect.php');
require_once('inclues/design/header.php')
?>
// Other php or html or related content relating to the page
<?php
require_once('inclues/.../footer.php');
?>
I was wondering what might be similar in Node.js - I am looking for a way to accomplish this which is as simple, fast and straightforward as possible.
If the answer is not simple, I would love a book recommendation, I don't mind reading.
I love event based programming, I really love JavaScript's abilities and I'm really excited about Node.js. I want to learn how to develop this sort of stuff with it the right way from the start.
To start with the bad news: As Node.js is a pretty young technique, I think you'll find that the proces of creating a full fledged website and maintaining/operating it will be very different than what you're currently used to.
Josh3736 adds: Once you figure out how Node.js and its various packages (Connect, Express) work, I found that you can develop new sites very quickly.
The rough edges that currently exist in Node.js, combined with the fast pace of its development and all modules involved can complicate things though, and make things less simple, fast and straightforward than you'd like.
Having that out of the way, here's the good news:
The Node Package Manager, NPM has a lot of good tools and frameworks to expand Node.js's bare bones functionality, making it suitable to create a webserver.
Most notably would be the Express Framework which contains almost everything you need to run a webserver (including cookies, sessions and path routing). Additionally Express supports partials, which take care of your header and footer includes.
Express is built on top of Sencha's Connect. Cookies and sessions are actually powered by Connect. Express is what simplifies your routing and handles views/partials. So if you don't need all bells and whistles that come with Express you could just go for Connect instead.
If you like to use templates for these partials, the Jade Template Engine can speed things up for you. Though Josh3736 points out that Jade is slow and whitespace-significant. A more complete overview can be found here, which includes his favourite, doT. (I personally use Node.js for socket.io based applications only, so he's a better source than me when it comes to templating).
You can connect to MySQL from Node.js using the db-mysql module, but if you don't need that because you're accessing data connected to an already present system, I'd advise to use a more... 'modern' approach, which is to use a NoSQL database as most Node.js projects seem to do. MongoDB via Mongoose is the popular way to go.
Or if it's just storing objects you're interested in, just go for Redis instead (which you're probably going to need at some point anyway).
Once your website is complete, you'll have to deploy it and make sure it keeps running. There are many ways to do so, like using built-in cluster support or use the more feature-friendly forever npm module. See this SO question of mine for more information.
Conclusion:
What I'm trying to get at is this:
Asking what the best practice for building a website in Node.js is, is about the same as asking what the best way to build a website in PHP is: 100 developers will give you 100 different answers.
NPM is blessed with a variety of excellent frameworks that greatly simplify a lot of tasks involved, but it's all based on preference which one is the way to go really.
As I've said, Node.js is still a pretty young technique, so none of the frameworks or additional tools have emerged as 'defacto standard' yet; for most things you're trying to do there are probably various alternatives, and expect your code to break when using most of them during updates, because development of Node.js itself and most modules is fast paced. You'll have to keep up.
Putting it all together:
As I've said, my main production use for Node.js is to be able to use socket.io, so I don't have any good production examples present (And as I'm about to leave on a well-deserved vacation I don't have the time to put one together either). There are some good examples though:
Setup and deployment using Express and Jade
A very complete blog example using Express, Jade and MongoDB
Combining Restify (an extension of Express), Backbone.js and Mongoose
Again, the way to go (and subsequently the example to follow) depends greatly on your ultimate goals and the techniques chosen, but luckily there are plenty of resources available for all of the choices available. Most modules use well documented GitHub repositories and include examples in combination with the most popular modules (See the /examples/ dir that seems to be present in most repositories).
(thanks to Josh3736 for rectifying my errors.)
Background:
I've been building web apps and web sites for many years, but each time I tend to start from scratch as each project has different requirements. However, this has me building my workflow from scratch as well. At this point, I'm about ready to settle on something a little more standard.
But what exactly is that standard? Being a JAVA developer by nature, I'm drawn to tools like Maven. And I've seen some work in the community for better Javascript support in Maven (javascript-maven-tools, javascript-maven-plugin, and others). But is this the best way to do it? I tried for a while to find a good WEB2.0 client/ajax-app maven-archetype to no avail.
I'm going to want to use tools in my workflow including JSLint [[http://www.jslint.com]], JSUnit [[http://jsunit.net/]] for testing, Documentation with things such as JSDoc Toolkit [[http://code.google.com/p/jsdoc-toolkit/]]. Compression and Framework inclusion would be nice too.
So, at this point, I'm even stumped at the the basic ways to start my app. What should a directory structure look like? For a pure client/frontend app (so no controllers, etc), do i just have a single webapp directory?
I guess I'm at that point where I'm questioning "my religion" with webapps. And after talking to everyone I know, I figured it was time for me to open it up to a hive-mind far smarter than my own.
Note. This is a question I also wrote
about in general on my site at
[[http://blog.jbjonesjr.com/?p=283]]
, but no one every cares about it
there.
Thanks for the help, I look forward to your thoughts.
I've started a couple of plugins (this and this) on Codehaus that facilitate the use of Maven for building JavaScript applications following Maven's goal oriented approach. I want to do more of this including the provision of a Surefire-compatible unit testing plugin and a minification plugin that leverages assembles. Take a look at what I've done so far and feel free to help out!
I'm also considering providing a JavaScript DSL for Maven using Polyglot Maven. A colleague kindly pointed out that JavaScript programmers will probably want to express their poms using JavaScript, not XML. In addition they probably won't want the learning curve of Maven. A JavaScript DSL could facilitate that.
I have 6 years of C# programming experience and I'm looking to broaden my horizons. I'm going to build a simple web app to demonstrate knowledge of Ruby on Rails so I can get my foot in a place that might want a Rails programmer. It's the hot new thing, so I want to be marketable.
Anyway, I have been playing around with solr and tomcat and I want to use solr as a search engine for a products database. This means that I will be using some java (tomcat and solr) and for the web app I will be using MSSQL because I'm using Windows. A friend suggested that I look into jRuby because if I'm going to be working with tomcat, it makes sense to put it all on one webserver. I want to use Eclipse as my editor. I hear that rails programmers typically use prototype as their java selector tool but I really like jQuery (or even mootools). I have also heard that jRails is something that ties jQuery to my ruby application.
Given that I use tomcat in conjunction with jRuby using Eclipse as the IDE, what would you suggest I use for handling javascript/ajax and what are some useful plug-ins, software, or tips you have for me that can help me get started on the right foot with ruby on rails?
I would stick with jQuery for your JS/ajax. My perception is that the RJS/Prototype is falling out of favor to jQuery but that could be just me. Where jRails would fit in is if you want to use RJS to generate JavaScript from Ruby code. My personal preference is to keep all of my JavaScript in application.js and keep it unobtrusive.
Some plugins I like are Authlogic, Nifty Generators, Paperclip, ssl_requirement, subdomain-fu, and QueryTrace.
A couple good resources for starting out are Rails Guides and Railscasts. I think it's a good idea to learn the language itself before learning the framework, but I'm sure it's possible to develop a simple Rails application with minimal Ruby knowledge.
As for your application stack, I would recommend reconsidering deploying a Rails app to Windows. Even developing a Rails app on Windows will likely be painful. If you can, I'd get a VM (or old machine) running with Ubuntu and use MySQL. If you're looking for a full text search on Rails you could use Thinking Sphinx - here's a Railscast if you're interested. I'd also give a gentle nudge into trying a Text Editor instead a full blown IDE - I like TextMate on OS X and gedit on Linux.
I also had a Microsoft background when I decided to learn Rails. There was a lot for me to take in - Not having the framework pretend the web is stateful (asp.net), learning a new language, learning a new framework, getting stronger css/html/javascript skills, new OSes (OS X and Linux for me), learning new databases. Overall I'm very happy I did. I'm a better developer for it.
If you want to be marketable, I'd start with learning the lowest common denominator, the default Rails stack, to get broad appeal. Then maybe consider acquiring some more niche skills to raise your value to a subset of potential clients/employers.
That pretty much means targeting MRI 1.8.6/7, Rails 2.3.4 (consider learning at least HAML and rspec in addition to erb and test/unit) and MySQL in an Apache *nix world.
I wouldn't recommend learning much about deploying to a Windows stack - the target for servers is overwhelmingly Linux or perhaps some other *nix flavour. For development web server purposes, Mongrel works fine on Windows.
Build on Windows by all means - I do, without too much pain - but be aware that the visible part of the Ruby/Rails community (the people who mostly develop the libraries and frameworks and most of those who write about it online) are predominantly OSX or Linux users, so there's often a delay in the trickle-down to Windows users, especially where OS interaction is called for or where there are compiled elements to libraries. Also, I'm reliably informed that Rails startup is much slower on Windows. I don't want to confirm it personally - I might get upset.
MSSQL works fine with Rails, but I'd be cautious about using any platform-specific features for reasons mentioned above: you're unlikely to find a site that will be happy to deploy to a mixed Win-*nix environment. The MSSQL ActiveRecord code may also not be quite as hardened as MySQL or SQLite - the one bug I ever found in any version of any Rails-related code was in there. That said, if you don't use any MS-specific features you'll find porting easy. But then if you don't use any extra stuff, why not skip it completely? There are enough differences (the query "optimizer" in MySQL for one takes some getting used to) that you're probably better off learning the platform you're most likely to be targeting.
As for Eclipse, it's obviously a mature development environment but I'm not sure how good the Rails plugins are (and as a hostage to Lotus Notes I'm allergic to using Eclipse any more than absolutely necessary). If you can't live without an IDE (and I'd recommend that you try - you'll learn more) then there are several SO questions that cover the alternatives.
Using Solr in your project doesn't require that you have a Java stack for running the actual Rails app. There are quite a few Ruby libraries out there that would help you easily interface with the Solr backend. A few to look at:
solr-ruby – This is the official client library included with the Solr distribution. It's lower-level than some of the other alternatives, but gives you some good flexibility in accomplishing what you need to.
rsolr – Another lower-level library that looks like a replacement to solr-ruby. At first glance it appears to be more frequently updated.
sunspot – I have not used this, but it looks like it's currently the most popular Solr => Ruby object mapping library. The acts_as_solr library was once an option, but I think that it has since fallen out of favor.
I agree with the other posters that you would want to target a C Ruby / *NIX environment, but if using Tomcat/JRuby helps you learn this faster, go for it.