Ruby on rail tips for learning

Source: Internet
Author: User

The development and version iterations of Rails are faster, and it's hard to keep track of the pace of the book. But no matter how fast Rails develops, its core framework and basic functionality have not changed much. "Web Development Agile Road" as Jolt Award-winning books are worth a look, now on the market the latest Chinese version corresponding to the Rails version is ... 3.2, if I remember correctly.

However, this is enough, especially for beginners, you don't need to grasp all the details at once, if the API usage in the book is not the same as Rails 4.1 (the latest version), look directly at the latest API manuals. You can also refer to many of the version-updated articles published by the rails community, such as the one I wrote after the release of Rails 4: "Embracing rails 4--details the new changes in Rails 4." With the Agile book, you can master at least 80% of the Rails core against these references.

In addition, I have to say, as a more cutting-edge, small community. Ruby and Rails are not as rich in books as java/c++/c#. Books are not the only way for us to gain knowledge of Rails, not even the main way. If you choose Rails, you have to integrate into the community, and many of the new and used counseling comes directly from all members of the community (such as the ruby/rails community in China). When these things come together, you are far behind. But for beginners, backwardness does not matter, chase up also quickly, the important is the basic and comprehensive, this is the focus of this answer-

Rails is a framework, not a tool

What does that mean? This means that Rails integrates almost all the trendy, cutting-edge best practices of WEB development (and, of course, keeping it streamlined, and more features can be augmented with third-party Gems), but he's not responsible for telling you what these best practices are all about. What role do they play in the entire WEB development? What are their specific uses?

These things Rails does not give you an answer directly (this is not its responsibility), so it causes a lot of beginners to listen: 15 minutes to develop a blog?! Lying trough, so simple? Come on......

It's a pity that you are wrong. With this in mind, you may have to learn to develop a blog for 15 minutes (it's almost no technical content for rails), and the problem is that you don't know what rails has done for you in 15 minutes, so you always feel like you're wandering outside the door, but you can't really walk in.

Next I'll focus on a few things, if your goal is to develop a WEB application, you want to learn to use Rails (the system's learning), then you need to add the following points of knowledge, and ultimately in tandem to form a knowledge system. When you use Rails again, you will have a presenting illegal weapons and a sense of mastery.

HTTP

This is the premise of all Web development, you do not understand HTTP, you will never be able to control WEB development, you can only follow others (such as Rails) for you to set a good way to go, but not as you like. But for starters, you don't have to pursue whatever you want, as long as you know the basic things are enough.

I am here to say one thing, before I met a girl (No sex discrimination), she is very thinking, very want to use Rails to develop her entrepreneurial project. She met with some details, and I helped her answer, and in the process I found out that she was not even sure what the most basic HTTP request/response was, but was obsessed with designing RESTful APIs and how to do front-end cool effects. I told her, slow down, you spend one months (in fact, not so long) to fill the foundation of the Web, and then the Rails, will be more effective, no thief encounter problems you do not know how, from where to solve, you can not always ask someone?

She didn't listen, until today, she was about the same as a year ago, and I can't see any progress.

Another girl, I brought the Apprentice, I taught her two months (about a day to two days a week, the rest of the time is online tutoring), I was taught from the HTTP. Two weeks ago, she interviewed for SAP success (intern, still in school), the interviewer rated her as: All the interns in the interview to Http/web Basic concept of the best one, you.

More I will not say, recommend a book to you: HTTP Developer ' s Handbook, short exquisite, concise and practical. I can read it once a day. Unfortunately, there is no Chinese version of such a good book! If you are struggling with English, you can consider the HTTP authoritative guide, but the book is tedious and lengthy. For starters, what you need to master is no different from the former.

REST

We all know that Rails has a feature called "Convention over Configuration" or "Convention over configuration". The truth is that the industry has a best practice for a series of common problems with WEB development. Best practices may not be suitable for all teams and projects, but are worth complying with for most new team new projects. These common issues, we can generally customize their solutions through a variety of configurations, but Rails is applying a set of best practices at the core of the framework with the principles of best practice, so you don't have to worry about a whole bunch of complex configuration issues if you don't have a special requirement.

REST is one of them, which is the core idea of request distribution and resource management in the Rails framework. Fortunately, after reading the above book on HTTP, you have mastered the basics of REST, so the two things are mutually dependent.

Front End and workflow

Rails is a full-stack(full stack) framework that has a complete set of solutions for the front end, embracing the latest technology and practice principles. In general, Rails development engineers are (at least half) full stack engineers, so you don't know the front end is a disadvantage. Many people for processing data, business logic, routing and so on is not a problem, but often into the front of the pit for half a day to climb out.

For starters, you have to master the basics of Html/css/javascript, this is not going to escape, otherwise you will not learn Rails. There are many basic mechanisms in Rails that are actually a Ruby implementation of front-end technology. For example turbolinks, its reference is Pjax, for example Assets Pipeline, its reference is the front-end building tools, such as:Grunt( Grunt do more, and part of the corresponding is rake, actually rake is the corresponding Grunt ,Assets Pipeline is one of the word set.

You don't have to master the details of the above tools, but you should at least know the whole process of real front-end development, what role each tool plays in it, so that you can understand why there are turbolinks,Assets Pipeline ...... And so on, you just know where to start to think, to find out the information, to solve the problem.

Give you a list that doesn't require you to learn the details of them, but you need to know what they are, what they solve and how they work, what roles they play in WEB development, and so on. In other words, people ask you what this is, and you should use one or two words to understand what they are:

    • Html/haml/slim/erb
    • Css/sass/compass
    • Javascript/ajax/coffeescript/turbolinks
    • Json/yaml/xml (this is generic, not only front-end related)
    • Rake/grunt/assets Pipeline

There are some things that you can not integrate with Rails (such as Grunt), but you can look at them because you can see them in the rails world. If there is a comparison, there will be understanding.

Object-oriented design

In the final analysis, Rails is an object-oriented MVC framework, so you need to understand what kind of design is based on object-oriented, MVC-style layered design. But frankly, it's a big hole, and it's hard for beginners to get some quick gains. But it is also critical because it often answers the following types of questions:

    • How many models do I need for the app/feature I want to develop? What should be the corresponding data structure?
    • How should these applications/features be distributed in controllers? How do they communicate with each other? How do I pass data?
    • How do I extract/construct/decorate the data or data collection for the rendering required by the views?
    • What kind of case can be split/combined/...?
    • ...... Wait, wait.

A very real problem is that you can easily understand why you have these models/controllers/views/routes and so on, but it's your turn to solve the actual problem/demand, you don't know how to do it at all! This is not a problem with rails, but you don't know how to use rails to describe your problem.

So, when you read the tutorial, you must not just follow it (the first time you can do without brains), but to think, why the author so design? Re-design a scheme with my ideas, okay? Is there a better plan?

Every time you do an application, the application of all data entities should be like your hands, feet, eyes, mouth, heart as part of your body, the communication and data flow between them as if the blood vessels in the body, seemingly chaotic, but there is always a trace, well-structured , and your brain controls a whole set of nervous systems to issue instructions to the individual components, as if the dispatch was made after the request was received.

Can you tell a little bit about what you're doing, in a layer? If you can do it, don't say Rails, any MVC framework in the world is nothing more than that.

The knowledge in this field is not specific to Rails, it is also the advanced part you want to know.

About Ruby

Learn the Rails before you learn Ruby?

    • If you've had a solid foundation for object-oriented language before, like Python,javascript,java, then you don't have to learn Ruby first, and you certainly know how to target Ruby.
    • Conversely, if you have only a general study of any object-oriented language, or even did not learn other languages, you must learn Ruby first, or Rails in a lot of syntax sugar/meta programming/DSL will make you dizzy.

Just contact Rails, a lot of people feel very magical, but "magic" is equal to "unknown", you can not take the unknown things to work, this is not to find death? So the basic skills of the Ruby language are needed, and you have to be able to "see the magic as usual" in order to use Rails without hindrance. For the study of Ruby, in addition to Pickaxe book not to do other introductions, advanced words directly see Ruby meta programming.

Pickaxe book is very thick, but you have to understand that at least one-third of the standard library API is introduced, this part can be used as reference books. The remaining two-thirds, one half is the overall introduction of the Ruby language, and the other half is the language details. So the part you really need to do is more than One-third. When I first started, I took a few pages in the subway every day, and I took a one-month intensive reading.

Pickaxe Book has a Chinese version, although the version is low but no harm, the basic things did not change. After reading the Chinese version, and then find a new English version, all the changes in the book version of the place are clearly marked, you can look at these points in contrast, upgrade work is OK.

In addition, learning Ruby and learning Rails can actually be done synchronously, without delaying much time.

Time?

I think a normal IQ, there is a certain degree of self-discipline, a certain cultural basis of the people, learning what I mentioned above (in addition to OO design this big pit) according to 4 hours a day, the six months should be small effective, that is, a total of 720 hours.

What, you say slow? Come on, ~720 hours. Lay a foundation that can grow into a full-stack development engineer, which is already fast, okay? Man, have foresight!

Other

There are still some things not to say, such as testing, such as deployment, such as command line and so on, these are the daily tasks in the development of Rails, there is nothing to talk about. As long as you use Rails, you can't learn.

Conclusion

Rails is a simple, 15-minute development Blog What is the 2006 's past, and today it's development efficiency is even more heinous. But in summary, you should understand that the framework behind Rails is a powerful tool that helps you encapsulate and hide a range of cutting-edge tools, technologies, and best practices. You don't have to start from scratch to implement them (so you get high efficiency) doesn't mean you don't need to know them (you have to understand the technical details behind efficiency). Otherwise, you can always repeat what others have done for 15 minutes, and give you 15 more minutes when it's your turn.

Ruby on rail tips for learning

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.