Rails Is Not For Beginners
horsesaysinternet.com
horsesaysinternet.com
If you on the other hand optimize for usability, for making things simple and easy to use for someone who understands the basics, you'll often end up with something that has great learnability as well. Maybe not as much as could be achieved as if that was your only goal, but plenty still.
The other aspect is whether you as a framework designer are designing something for yourself and your peers or if you're trying to dumb things down on behalf of beginners. In other words, designing for what you think beginners might find easy in their learning phase. That's really hard to do. Most technology I've seen designed in such a master/apprentice fashion sucks.
Finally, when you're comparing complexity, it's generally more helpful to look at the complexity involved with completing an entire task. Comparing complexity of "hello world" tells you little about what the complexity is going to be like developing a complete, modern web application from database migrations to XSS/CRSF protection.
That's where learnability and usability are again in conflict. Yes, it's harder to learn a framework that has answers for things like "how do I migrate a database once I have data I care about", or whatever feature you want to focus on, but once you hit that problem, you'll be glad that it's there and find the solution less complex than stringing something together from tons of separate parts yourself.
All that being said, I think Sinatra is wonderful. So what if it's not a fit for building a whole Basecamp or Github? It's great for teaching someone the basics of how HTTP works and it's great for smaller surface apps or for smaller, isolated parts of bigger apps.
Naturally, there's some selection bias there (most people who give up are unlikely to write), but that doesn't change the joy for the people who did have a great and easy time.
I've been using RailsTutorial, and while it's packed with info, I feel like I would benefit from a more solid understanding of many of the basics.
I've found this to be an AWESOME resource:
http://openclassroom.stanford.edu/MainFolder/CoursePage.php?...
It's a full Stanford class of lecture videos. It really solidified my understanding of the concepts I learned from Hartl's tutorial.
For example, in cakephp we have this cook book http://book.cakephp.org which the quality of the content surpasses every cakephp book on amazon.
So, like apps "simple & feature rich" can get along together like "learnability & usability" can get along too. It just needs more work.
>There are plenty of cases where learnability and usability are in conflict
>That's where learnability and usability are again in conflict
But it is hard to work on both so you may need to work on usabilitiy first then work twice as hard for learnability.
That was a decision I regretted many times. The hoops I had to jump through to deal with complex database queries were ridiculous. The difference in quality and robustness between ActiveRecord and cakePHP's ORM (at that time, anyway) were pronounced, with AR coming out way, way ahead.
There's no doubt, in my mind, that if you are going to take on a large, ambitious web application project, you'll be better served by Rails.
You'll also have to note that both frameworks have progressed significantly in the last few years - CakePHP actually just released a new major version, as did Rails a few months ago - so your experience a few years ago - was this in the 1.1 era - would just be indicative of the framework's beginnings, not where it currently is.
Feel free to message me with your thoughts if they still conflict; I'd love to hear the other side of the story since improving CakePHP as a framework helps not just my ego, but other developers who are using CakePHP to make a living :)
- In my very humble opinion, only one - English! I can't comment on the international community - book has been any good (That by Mariano Iglesias) and they all tend to either have outdated information or just bad code samples. So no, they do not surpass the quality of the framework. - Hard stuff is always hard, regardless of the framework. At a certain point, you start butting heads with limitations in the language, at which point no framework will help. I've also found "hard stuff" to be fairly easy in CakePHP due to the large plugin base I can reach into - only Django and Ruby Gems really solve this sort of problem - so no, the hard stuff doesn't get harder.
Regardless, I'd be more than happy to get your feedback on this though. Send me a message :)
That's why many people have started to use CoffeeScript and/or Backbone.js to write more maintainable JavaScript. But the CoffeeScript/Backbone.js route is harder for beginners but in the long run it's a much better choice.
> But the CoffeeScript/Backbone.js route is harder for
> beginners but in the long run it's a much better choice.
What you say makes no sense. Ok it makes sense, but does not make sense in context of jQuery. jQuery was never intended to be a framework or tool to organize your code. It is just a DOM/events/Ajax library, that's it. Its purpose is completely orthogonal to what Backbone does and even more so to what Coffeescript does. You don't manipulate DOM with Coffeescript or Backbone, but you may use Coffeescript to write your DOM manipulation code and you may use Backbone to organize your code.This is how I see it:
Pure JavaScript + JQuery = Very easy to get started but very hard to maintain when the code base grows if you don't know JavaScript very well.
CoffeeScript + JQuery + Backbone.js = Harder to get started but the code becomes easier to maintain when the codebase is big.
I know that JQuery is not about organizing code.
We should strive to make the learning curve more enjoyable rather than making it beginner friendly, The only way i know of doing that is to show evolution of technologies, there merits and de-merits and why or how we have reached where we have reached and why we took the technological decisions that we took. How we reached to rails from PHP or cgi. How treacherous the journey was.
Rails just has too much magic and higher level of abstraction built in that it easier for beginners, But when you want to do something really great you need to look under the hood. That is RUBY, Rack and HTTP.
Because sooner or later you will realize that a web app is nothing more than HTML/CSS/Javascript so you know the nuts and bolts of the underlying infrastructure the better.
I think learning something as basic as sinatra is much better than learning rails , so that you have some idea of the underlying stuff and then when you move to rails you can learn more of rails by just looking at its code.
Personally i learnt a great deal from looking at rails source than looking at a tutorial. But surely it would be a daunting task for a noob. Also learning Rack comes naturally with sinatra. and as you look at Rack, sooner or later you would figure out how to write a cgi adapter for your rack app.
Then Comes rails which saves you from all the mundane task you were doing developing in sinatra and much more.
This way you would have a better understanding and appreciation for rails and all the stuff that you don't have to do or write in rails.
At the same time you will have a better understanding of how a particular feature is working in rails. This improves your debugging skills because you know where to look for when something goes wrong.
Finally Ruby is the elephant in the room so you need to be better at ruby to become excellent at rails, Which often is shadowed by the magic that rails provides, so learning RUBY first is more important than rails, sinatra or anything.
You can't really call a framework a language.
Sinatra is actually a great foundation for big things, although it doesn't give you the whole stack, but only the way how to build your stack.
I've been developing on Padrino (which builds on Sinatra) for 2 years now and I am still surprised by how easy adding features/plugins to Sinatra (and by that, Padrino) is, especially as the most useful Rails plugins now also come with a "pure rack" variant.
On the other side, I often ran into problems with the huge stack that Rails has, so that I had to tackle issues far before I actually needed a feature.
A MD is not for beginners either. Policing is not for beginners either. Even cooking is not for beginners.
I had my first son 9 month ago before I learned how to change a diaper. Being a Dad is definitely not for beginners.
Life is not easy, nothing is for beginners.
People just learn along the way if they think this is the skill they need to learn and they have a strong will.
The most important thing is to BEGIN.
Excel is a great example of something that can get beginners involved in computing. Huge code base, but lots of tutorials, and solves problems people have.
If people's problems were along the lines of needing a website that can say "hello world" then Sinatra would be perfect, if their needs are more along the lines of CRUD app with web and iphone front ends then rails will likely serve them better.
I've been dealing recently with a guy who asked me for some tutorials on XCode, although he absolutely cannot code with Storyboards and Interface Builder he's fully mocked out apps that he wants developed. It's that kind of thing that gets people coding.
Until the docs and tutorials fall short, or something unexpected happens, or they want to see why something behaves the way it does.
First, it's the absolutely fragmented ecosystem, made up of everyone who has opinions on the best way to do Rails development. "You need this gem, and this gem, and ZOMG you're using that library? So last week! Use this one!"
Sure, it's funny to exaggerate that, but if you joined a community, you'd probably look around. A person who does daily work in Rails is going to have a preferred development stack. They may write tests with Rspec, they may use Cucumber. They may even use CoffeeScript. And they'll tell a newbie that they should too.
But a wide-eyed developer who thinks Rails will solve all his or her problems will get freaked out at all of the options available.
When I teach beginners, I don't teach RSpec or Cucumber, and I try to even avoid talking about Bundler. I stick with the core components of Rails. I stay on the happy path. Rails has all these hooks for experts that you can unravel after a few months (or years) of daily work. But a beginner can understand ActiveRecord, controllers, and views easily.
I love the Dreyfus Model. It basically says newbies don't need choices in the beginning. They need clear instruction, clear tutorials. Once they master those, they can move on to reading the docs, exploring the options, etc.
I've been pretty successful teaching Rails to folks who know how to program.
Where Rails falls flat on its face for the beginner is when the beginner doesn't know SQL or HTML. That's a whole different ballgame. Then something like Sinatra is a nice slow introduction.
Sinatra seems to be better for the former, Rails is better for the latter.
I'm partial to thinking that the former goal is the more noble. But I'm also immensely proud to work in a field that allows anyone with little more than motivation and patience to apply the immense power of computing to whatever itch they need scratched.
One of my favourite consulting jobs of all times was when a friend of a friend asked me to come in: They knew just enough of a certain PHP CMS to build an online history textbook, which they'd then gone on to sell to, oh, well, every school in the country. The traffic was strangling them and only just knew enough that they knew they didn't have a clue what to do. A week and change later, upgraded hardware and the clumsy CMS search engine replace by Solr, they were flying.
If they'd started out with the equivalent of Sinatra (essentially plain PHP), I'm not sure they'd have launched at all.
But: Sinatra ain't beginner-friendly either, I also don't think thats the goal. Sinatra is basically a minimal base framework for matching HTTP requests, generating responses and building a Rack stack around the base class. But it doesn't give you a lot beyond that. As such, it requires deep knowledge of how to use HTTP and Rack to do more fancy stuff.
I also don't think that there are "beginner-friendly" frameworks beyond the most simple ones. The problem is that each feature that a framework encodes also requires the user to learn how it works. Most beginners don't even understand the benefits, drawbacks and best practices when it comes to HTTP - how would they understand all the things that Rails has amassed over the years?[1]
If any, I would recommend pure Rack: its a one page specification that can be read and understood in an hour.
As a shameless plug: if you consider Rails too feature-laden, consider Padrino - it is definitely worth a look. (Disclaimer: i have commit access to the Padrino repository and sometimes use it)
[1] I don't consider users coming from other frameworks (even in other languages) as "beginners" - usually, they already know the domain language - for example what CSRF is and what Rails does against it.
Also, if you're using Rails library, you'll notice the hipster aspect of the Ruby/Rails community, which is to say many libraries are active for 1 or 2 years before the developer gets bored and someone else comes up with a hotter alternative. That's cool, it's quick evolution, but it also means real-world Rails developers have to spend a fair amount of time dealing with libraries that are either no longer maintained or are not yet mature.
I've built many real world applications. Very complicated ones and not just your average CRUD apps. I never had to do exotic configurations or metaprogramming craziness.
If a popular gem is replaced, I see many times, that the API of the gem, mimicks the old one, or detailed migration tutorials will be delivered. So a new gem is often similar to a major version bump.
Personally I think this is a small price to pay for a framework that stays up to date and still releases forward-thinking features on a regular basis (Rails modularization in 3.0 and the asset pipeline in 3.1 are amazing features that an emphasis on backwards compatibility could have made more difficult), but let's acknowledge that it is not an unmitigated win in all aspects.
Rails - > great for intermediate people who see benefits it brings. Great for pretty straight forward projects for beginners that can follow a book.
Sinatra -> Great for beginners to "just get something working". Not great if someone needs everything decided for them. Awesome for advanced people. Awesome for non-standard projects.
Padrino (Why don't we hear about this more?) -> kind of the sweet spot between the two. I honestly think that Padrino should rightfully start taking mindshare. I don't know why it hasn't.
Once a beginner gets past the trivial usage of Sinatra, where does he go next? Rails already has everything set up for you. If you want to implement something, you can just google it or find a tutorial or Railscast that can scoot you along. Or a free online tutorial that shows you how to test and implement a nontrivial application from scratch including testing. Or just dive into the massive community.
The fact that Rails has a ton more features that will take longer to understand than Sinatra is neither here nor there. If you don't need those features than Sinatra is the obvious choice, if you do need them then Rails is the obvious choice. This is orthogonal to the user's experience level.
(Which is what most PHP people seem to want initially - you know, before that magic thing happens where they realize that real applications need structure.)
Still, Sinatra is great for a lot of small web projects.
Sinatra is great for small things and beginners.
However, if you're going to spend all day writing web-app code, learning rails pays off HUGELY. It's the full package for modern web-app development, with massive productivity bonuses at the expense of a higher upfront.
If you don't understand how to prevent sql injection attacks, cross site scripting, why SSL by default for web apps is needed, and whole host of things, you should probably stay away from anything more serious than flat html.
I do not get excited about the sudden ability to make things because I have been making things (not webapps) for some time.
I have had much more success learning Sinatra. While the tutorials are similarly designed, the reduced reliance of magic makes it easier for me understand the purpose of the commands given. There are no files that are generated for me in places that I have to go looking for that do something important that I don't have to think about (but I do have to understand.) In fact, Sinatra has helped me to understand Rails in hindsight.
I think the issue is that the tutorials I have looked at tend to be trying to sell Rails as an awesome tool to make things. This has emphasized ease of use over understanding of concepts. You can contrast these tutorials with books or tutorials for any programming language. Books on programming languages tend to be more abstract and while they limit one's power at first, they enhance one's awareness in the end. Tutorials on Rails do the opposite for me.
Maybe I should have just bought a book on Rails (like the tutorials said.)
Some of these higher level frameworks dispense with get and post. This means that to an old timer, there is suddenly nothing left to build on, and this is why the learning curve appears high again.
However, the question is: Is it harder to understand the subset of rails that does what sinatra does, than it is to understand sinatra as a result?
Also, the biggest problem with learning Rails is the Ruby language. After you learn the language, switching from Sinatra to Rails and back is not problematic.
I tried to learn COM once but gave up essentially because I could not find any docs not falling back on IDE code generation (and that code was huge and absolutely opaque).
I always loved tools which let you to type in a small program from the scratch and run it. So, perhaps, sinatra is the way to go for beginners.
I'm fairly certain that's not all of them, but I don't even know what those things are called to look for them. Those 3 are covered in a lot of tutorials without really explaining the full list of stuff Rails does for you automatically.
I have always preferred to start simple and localized and add complexity as the project goes. Especially when I am learning something new.
I also taught, being a total noob myself, my best friend how to code Rails in 2 months. He doesn't even know HTML, or how to make/compile something. But he can code Ruby/Rails. And I mean Ruby, not just plug together a scaffolded app.
So yeah, I'm not so sure I agree with this.
In the end, you get a bunch of developers that are both comfortable with a modern framework, have some understanding of the growing pains of new, complicated systems, and are ready to bring fresh ideas to more mature parts of the industry.
The contrasting mentality of sticking to what we already know is "good enough" leaves developers dull and uninspired, less equipped to think outside the "rules" inherited from previous generations that came from solving problems that look a lot different when you examine them 10 years later.
All of which is to say, Rails probably isn't for beginners anymore, and it shouldn't be, but I don't think trying to substitute a simple framework that explicitly avoids becoming complicated is necessarily what the doctor ordered...