Closed newz2000 closed 5 years ago
Great starting point. Based on recent experience writing a comprehensive commercial application with Sails 0.10.5, and listening to others frequently asking the same sorts of questions, here are few extra thoughts where I found documentation thin:
A section on productionizing the deliverable would be nice. Just some ideas, MongoDB configuration with clustering for fault tolerance (slightly DB specific perhaps), SSL setup (Heroku would not require client certs etc), SailsJS fault tolerance with say forever / cluster etc, multiple environments configuration, integration with say Continuous Integration environment such as CodeShip / Travis.
A section devoted to security, from simple basic authentication with express using local strategy, to API Tokens with JSON Web Tokens (JWT).
Would like to see usage of inheritance in the Controllers and Models, example functional test suite with Mocha (before / after loading and lowering sails app), best practices for writing bootstrap fixtures with moderate amounts of data (recommended promises / async pattern etc), extending the Grunt tasks to handle JSHint, MochaTest etc. A domain model that exercises all the core association multiplicities (one to one, one to many, many to many, self-referencing table and dealing with async tree recursion both up and down the tree structure). Soft delete feature, explicitly writing CRUD operations in controllers while retaining criteria queries for get ops. Section on developer productivity - using sails console, nodemon for live reloads, how to actually inspect the SQL being generated by Waterline in MySQL etc (again db specific). Controversial: a tutorial on writing an entire SailsJS app with CoffeeScript (server / client side, including APIs, Models and Config. :)
.
Great points. Some of those definitely need to be in there. The only examples I can see at a quick glance that would probably not fit in with my line of thinking would be the SSL stuff, and probably Travis. I think your controversial point is also probably fit for a different kind of documentation. I say these because of Goal 4. SSL is important for many apps, but you don't need to understand it to learn Sails.js.
The Database points are an interesting problem. Being straightforward, I've not wrapped my head around Waterline. I've used it now with both PostgreSQL and MongoDB and in both cases it worked without me needing to do much. I didn't leverage anything advanced in either of these cases.
My inclination would be to show how to configure the database adapters but otherwise just stick to features that should work seamlessly regardless of the database. Then write additional documentation on how to do cool stuff with your database of choice. It's possible, maybe even probable, that the existing ORM documentation included in Sails would provide that.
Since Sails.js is such a comprehensive framework, my suggestion for the first round of official documentation is to ruthlessly focus on the best practices for using Sails.js's included components, except where that's not possible (sending e-mails for example).
Also note that I think Ruby on Rails has a good thing going with their guides. I would suggest that some topics need a dedicated tutorial, which would be a guide. Each guide would probably be a one-page document that walks you through an example scenario that helps someone master one of the more nuanced aspects of Sails.
Tutorial 2 feels lengthy to me, and I just realized that session support would need to be added to that, wouldn't it? It's going to have to go in there either for tutorial 2 or 3.
@newz2000 This is kind of tutorial I would like to have to become more involved in community as intermediate user. For now I am struggling to catch up with really simple tasks. One place more to get inspiration for documentation structure is cakephp cookbook. For me it was good starting point to start coding CakePHP.
I think SSL setup mentioned by @arcseldon would help, but TRAVIS for me seams to be more out of scope of Sails tutorial.
Just want to comment that this is vital. I've just given up on Sails for use in a professional, public facing project, after about 100 hrs of intense research into the docs, SO, YT, and others, reviewing source code and much trial and error. I have overcome many hurdles, but, overall the getting started 'friction' is more than I can tolerate.
For reference, I have years of Java, PHP and other experience, I've been working in Node Javascript intensively for a few months, and am tentatively comfortable with Node and Express.
This is not meant to be a complaint, downgrade or criticism, but more supporting evidence for the need of a comprehensive intermediate to advanced level tutorial as @newz2000 has outlined.
As a start, for me at least, simply having the tutorial's subject application available would have made the difference between success and failure. Perhaps as a first step, the core team could whip up this app. Having that, well commented, I think the community could handle creating and polishing the tutorial.
:+1:
One very important aspect missing from this outline is how to structure code in a modular, composable way.
This may or may not be useful to you. It's my collection of things to use when starting a web application. Among them are many courses. Mouse over the name to see a table of contents for each one. Have a look at the comparisons between them. Browse the list of features that they demonstrate. Check out the "How do I... " section. Good luck!
http://www.dancancro.com/comparison-of-angularjs-application-starters/
@gihrig +1 Definitely in favour of a comprehensive (beyond 101, hello world style) reference Sails application that showcases all the primary feature sets. To be useful to commercial development in the real world, it should address Production aspects too. Good documentation is no doubt valuable but a well written application containing the mainstream features is potentially more so. And yes, there would need to be a commitment to maintenance and ensuring it is upgraded as Sails evolves.
Thanks for sharing @gihrig !
For what its worth, I'm personally not convinced reference applications can provide as much value as a well written guide/tutorial.
Reading code to learn a framework can be frustrating because you don't know what's idiosyncratic to the example app, what's core to usage of the framework, and how important various framework features are or what their alternatives might have been.
A well written tutorial and guide can discuss several important nuances in a single sentence. Concepts are just better consumed in prose; examples are helpful but not best for giving overviews. On Oct 23, 2014 9:52 AM, "arcseldon" notifications@github.com wrote:
@gihrig https://github.com/gihrig +1 Definitely in favour of a comprehensive (beyond 101, hello world style) reference Sails application that showcases all the primary feature sets. To be useful to commercial development in the real world, it should address Production aspects too. Good documentation is no doubt valuable but a well written application containing the mainstream features is potentially more so. And yes, there would need to be a commitment to maintenance and ensuring it is upgraded as Sails evolves.
— Reply to this email directly or view it on GitHub https://github.com/balderdashy/sails-docs/issues/317#issuecomment-60182574 .
Please also refer to Sails development is outpacing documentation #2325 to get some context to where this post came from.
It may be that different developers have different views over what the tutorials audience represents. If this is beginner level, giving overviews etc and explaining the basics, then the following resources are a great starting point:
Watch the 15 mins intro on the official Sails website:
Read the SailsJS documentation:
Good intro building a simple chat app:
Irl Nathan, sails cast series:
Intro to Sails - presentation slides:
Intros on Json Web Tokens (JWT, pronounced JOT)
Once you have internalized that information, then subscribing (following) to the Github repos for sails, waterline etc, joining the google group discussion, IRC channel, youtube video postings, and searching / asking questions on SOF usually resolves other points of uncertainty.
What I really wished I had most of all in retrospect (having just released a complex commercial application) was a comprehensive reference application to compare against with regards to some configuration / layout / and code aspects. The documentation and existing samples were particularly thin regarding productionising a deliverable.
@arcseldon and @rattrayalex
Interesting and valid diversity of opinion. This shows the need for a production quality application and a comprehensive tutorial/documentation. Sails already has good start on documentation.
My thoughts on having the app first come from the feeling that given a well written app created by Sails core devs, I, and many others here could contribute meaningfully to a tutorial. But I have already failed at surmounting the learning curve to the point of creating a production quality app in the time I have available.
Requesting that the core devs create the example app to match the tutorial outline seems reasonable because they do this at Balderdash and are best qualified to meet @rattrayalex's concern over appropriate idioms of the framework, best practices, etc. Though this would demand well commented code, I think it's more reasonable to expect that from core devs than a well written tutorial.
An example app would certainly leave questions unanswered, and in fact, the questions are a critical piece to the learning puzzle. While core devs may not appreciate the subtleties of why they do things as they do, confused community members certainly will want to know why, and will ask.
I think the key to a successful learning/documentation project will be to understand the needs and who can answer them most efficiently. My feelings:
Creation of a production quality app - core devs
Creation of a comprehensive tutorial - 'writers' among the community
Needed improvements in the tutorial or app - users in the community
Rinse and repeat ;-)
In short, it's what 'community' brings to an open source project. @newz2000 made a great start, it's exciting to see the process unfolding for Sails.
@gihrig by the way, it was mentioned that there is a project to create reference applications at https://github.com/sails101. I've downloaded some of them and looked them over at a glance. Each seem to focus on a single concept, which makes the code a little easier to read.
One problem with a reference application is that any application is going to have a combination of boilerplate code and non-boilerplate code. (or in the case of Sails, code may mean configuration)
It's very easy to miss an important change to one file that causes the application to not work. In those cases a better solution may be to see a sliding diff where you could watch all the changes unfold in a step by step manner. In a sense, this is kind of what a tutorial is.
The main take away point from that previous thread that is feeding into the issue I've created here is the goal to produce more intermediate and eventually advanced users. Code examples are targeted at intermediate and advanced users who are good at reading code. My hope is that we can create something that beginners can use to rise up to the level where example code is more useful.
That sounds like how they did the Angular phonecat tutorial https://docs.angularjs.org/tutorial. It uses github. You get the code for the first step, read the guide for that step and follow along at home, then run a simple command to erase the code from that step no matter how much you messed it up and get you a clean set of files ready to go for the next step. That's the best way I've seen for doing this so far.
On Fri, Oct 24, 2014 at 8:48 PM, Matthew Nuzum notifications@github.com wrote:
@gihrig https://github.com/gihrig by the way, it was mentioned that there is a project to create reference applications at https://github.com/sails101. I've downloaded some of them and looked them over at a glance. The each seem to focus on a single concept, which makes the code a little easier to read.
One problem with a reference application is that any application is going to have a combination of boilerplate code and non-boilerplate code. (or in the case of Sails, code may mean configuration)
It's very easy to miss an important change to one file that causes the application to not work. In those cases a better solution may be to see a sliding diff where you could watch all the changes unfold in a step by step manner. In a sense, this is kind of what a tutorial is.
The main take away point from that previous thread that is feeding into the issue I've created here is the goal to produce more intermediate and eventually advanced users. Code examples are targeted at intermediate and advanced users who are good at reading code. My hope is that we can create something that beginners can use to rise up to the level where example code is more useful.
— Reply to this email directly or view it on GitHub https://github.com/balderdashy/sails-docs/issues/317#issuecomment-60432114 .
@dancancro
The Angular phonecat tutorial presentation looks really good as a learning aid. It might not be hard to replicate for someone familiar with Angular. Even a Github repo with well co-ordinated commits for each step would do as a start. Still a production quality app would be required as the stating point.
Does this answer the question: http://irlnathan.github.io/sailscasts/ @irlnathan
Thanks for posting, @newz2000. I'm a repo bot-- nice to meet you!
It has been 30 days since there have been any updates or new comments on this page. If this issue has been resolved, feel free to disregard the rest of this message. On the other hand, if you are still waiting on a patch, please:
Thanks so much for your help!
Many successful projects have more than just reference documentation, they have tutorials and helpful guides. These are both items that are missing from the official Sails docs.
Here is a possible outline. I am not qualified to write all of this but am happy to help by creating stubbed documentation and filling in holes where I can.
Story:
User is guided through the process of building a website offering daily deals, similar to Groupon. The website will be mostly server-rendered HTML with RESTful endpoints allowing the user the opportunity to use client-side MVC tools as they desire.
Goals:
Tutorial Part 1
Tutorial Part 2
Tutorial Part 3
Tutorial Part 4