Rails on Rails taking it to the next level - ruby-on-rails

For the past few months i've had the feeling that i reached a boundry in my knowledge of Ruby on Rails (RoR) development. I've developed large and small applications for both big/small clients and friends / hobby projects. I know how to develop these applications and it's beginning to feel a little bit tedious. I want to take my programming skills to the next level, me having a little experience with Javascript i enduldged myself in some good Javascript books and learned alot! But now i'm back stuck at the same RoR level that i've been for the past few months. and i want to get that knowledge boost i got from the Javascript books.
I really want to contribute to alot of open source projects but when i look at the source code i get the feeling that i dont know enough of the code and that i will become a irritating burdon to the main developer(s) of the project(s). This is just some uncertainty of mine but i dont want to tire/irritate other developers...
I feel stuck and i dont know what to do to up my own level. I try to read the source codes but often i get stuck with mainly the question "why are you doing this, and what are the benefits of it? And how does it work?". I know i want to up my knowledge of both ruby and rails but i dont know how to do this. In my time programming RoR it's been very difficult for me to pinpoint my "skill level" knowing i can always up my skills. So knowing this i started with some basic Ruby books: The well grounded Rubyist and Beginning Ruby. These were great books i learned some nifty little tricks but that's about it.
Do you guys recommend any resources and or books. I don't have alot of experience with other languages than Ruby / Javascript. But i really want to learn, i don't have a solid programming background because it mainly evolved from hobby to work. I want to contribute to open source projects and work and mainly learn from other great developers. I'm stuck and i don't know where to start.
Thanks in advance.

A few books:
Eloquent Ruby
Rails Anti Patterns
Crafting Rails Applications
Then, armed with knowledge, you'll be able to read code (your first and good intuition): that's a great source of inspiration.

There's a lot of good material at Railscasts which is worth looking through. You can learn a lot about current practices, something doubly important when a lot of the Rails material out there is for 2.x or 3.0 and doesn't reflect the state of the art.
The best way to improve your skill is to find new challenges to exercise yourself. You'll need to work on general Ruby and general programming as well as improving your knowledge of the Rails framework.
Set aside time to read and understand the various APIs you're being exposed to. The more you know your toolbox, the less time you'll waste trying to do something that's already implemented. APIDock is one of the many documentation aggregators out there for Ruby and Rails. As Ruby is generally quite readable, it's even educational to browse through the source for the libraries you use and see what methods are offered as well as any insight you might gain from observing how they're implemented. Often there are interesting use cases that are never fully documented but will serve you well when you need them.
There's a lot more to say, but really, it's a long journey. That's why people write things like Teach Yourself Programming in Ten Years as a counter-point to the "Teach Yourself X in 21 Days" books plague the industry.

Related

Scheduling App for Rails Beginner

I'm starting to work my way through the fantastic Rails tutorial by Michael Hartl (https://www.railstutorial.org/), and I wanted to bounce a project idea off you all to get a sense for how realistic it is for a beginner. I'd like to make a scheduling/staffing app for my company. I'm envisioning something where the rows correspond to employees, and the columns correspond to days - sort of like the "Week View" in a calendar app, but the time slots would be replaced with employee names. Eventually this could grow into something more sophisticated where you can filter and sort by various employee responsibilities.
So my question is: does this seem like a realistic project for a Rails beginner? I'm not asking for specific suggestions here. I'm just hoping to get some general guidance on whether or not this is biting off too much to chew, so to speak. I have no familiarity with Ruby or Rails, and I haven't touched HTML since I was 10 years old and making sites on Angelfire and Geocities, but I do consider myself fluent in a number of other scripting languages. Open-ended replies are encouraged. Thanks!
I think this is one of those questions that really does not have an answer.
Yes, generally, beginners should build projects that familiarize them with the ecosystem of the framework and it's constructs but it also depends on how good you are at learning things.
The project that you have described may be hard for a Rails beginner to do but at the same time, it can be very easy because a lot of skills come into account.
My approach is mostly to first read the documentation of the framework I am about to use thoroughly so that I do not re-invent the wheel(do something a certain way when the framework has built in functionality to do that thing very easily). The rest I think is just dependent on how good your programming skills are.
Welcome to the Rails world!

Should I learn Rails, Joomla or DHTML as a beginner? [closed]

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 1 year ago.
Improve this question
This is not a core programming problem as most posts on this website are, forgive me for that but I didn't know where else to ask this.
I am a beginner in web languages and want to build a small website for our family business, mostly a bunch of galleries that would display our different product lines with prices and some basic specs for customers to get an idea..currently I'm pursuing comp science at the undergrad level
So here is the problem, I can't decide between platforms
I started out with HTML and making a basic mock up but that didn't quite work out as i needed to have dynamic galleries that was quite hard to code by hand and since we need to update often it would be a pain even if I did manage to get it going
then I thought of Joomla as it would be easy to update but soon realized that its not that easy to customize templates
Then I started reading about Ruby on Rails and what it offers and it sounded really interesting might be useful in developing applications that we possibly would need in some time.
so I wanted to know from the community which course should one pursue: DHTML, Joomla, RoR
Please keep in mind that I want this to be a learning experience that will be useful possibly in the future in my professional career and at the same time get the job done.
I would also greatly appreciate any resources or suggestions that the community might have.
You are actually comparing apples to oranges here as DHTML, RoR, and Joomla are not the same thing. You are comparing a mark up language, to a programing framework, to a content management system. You could feasibly learn a CMS (Joomla, Drupal, Wordpress, etc) and never learn to code a single line of HTML or PHP.
For the purpose of getting a site that you can manage and edit yourself, then what you are asking is which CMS should you use. There are dozens of CMSes and opinions on which one is the best. In general are the big 3 - Wordpress, Joomla, and Drupal. Wordpress is by far the easiest to learn. It has a very simple admin that shouldn't take more than a few minutes to figure out. There are tons of themes and extensions that go along with it. The downside is that it's coded to be a blogging platform, not an extensible CMS. That means that doing things other than blogging are harder to accomplish (relative to Joomla and Drupal). It can still be done, but the more complex the site, the harder it is to do in Wordpress.
Joomla is the next step in ease of use. The admin is significantly more complex than WordPress, but a tech savvy user will get the basics down in the first couple of hours or so. Extendding Joomla is much easier for both the developer since the framework is specifically designed to be extended, and the user since installing is very quick and easy for most extensions. It's a pretty good balance between ease of use for the admin and ease of extension for the developer.
Drupal is probably the most powerful of the 3, but the trade off is in the user admin. Most non-developers will struggle to understand how the admin works or what taxonomy is and how it works. Again, the trade off is that it allows developers much more power in extending Drupal. Drupal makes it easier for the developer to accomplish much more complex tasks than Joomla or Wordpress.
At the end of the day, all 3 can accomplish the exact same thing on a website. You need to determine which one will accomplish your particular needs the best.
That said, you should still learn HTML and a programming language. My recommendation would be to learn PHP and mySQL. That will give you a solid foundation on which to build on once you are well versed. Other languages and flavors of SQL will come easier, plus many of the large open source projects are done in PHP/mySQL.
Since what you are trying to do is a pure learning exercise, I suggest you look around into a lot of things(rails/css/javascript/php etc) until you finally find the one that you will have fun playing-with. You learn faster when you can tinker with it.
Ruby on Rails may 'seem' easy to an advanced web developer. Its an advanced framework and needs considerable amount of investment in terms of time and interest and most importantly you need to have an aptitude for it. If you REALLY want to do this, and you have a general aptitude for Web programming, I suggest you start with Wordpress. Its search-engine friendly and will get you running in no time.
Learning we development and design is not a small task. It'll take you years to get even moderately good, so if you need to get something up and running now, I'd not recommend you to build it yourself.
There are a lot of nice Joomla templates and plugins available if you are ready to pay a small price for it. Search around a bit more, and you might find something that works for you.
I would start with a CMS such as Joomla or perhaps even Wordpress. Grab a template and tweak it - this will be a good introduction to coding websites as the really hard parts are already taken care of.
Once you have finished the site that you are working on then you can think about moving on to a framework such as Rails or even a PHP based once like Code Igniter. The frameworks will take a lot longer to figure out but at the end of the day they will give you a better learning experience then just tweaking a CMS template.
I would say it depends on your goal. As mentioned they have different purposes. That said I would say Joomla or Rails.
If you are interested in CMS (or design), and don't want/care about getting down and dirty into coding then I would use Joomla and learn what you need to acccomplish your goal.
If your goal is to be able to develop custom web APPLICATIONS, I would probably learn Rails. There is much more of a learning curve but you will get experience with things like html5, javascript (or coffeescript), css3 (or sass), exposure to the MVC model (model view controller) and exposure to Ruby.
But with Rails there is a lot more to learn, but you will have a lot of knowledge.
If you want to go down the rails path, maybe start with a Rails CMS (like locomotive or refinery) b/c they are written in Rails, you could look at the code or have some insight into the CMS. Disclaimer I have not used a Rails CMS (just did some research)
I would choose Joomla. They have a vast array of components and modules that should meet your needs. As far as customization, if you are a beginner this will be difficult no matter the platform. DHTML is not a platform. DHTML is mainly javascript, css and php. I suggest you get some books on doing dynamic stuff with javascript and jquery, styling with css and creating MVC sites with PHP. When you learn all this first your job customizing an whatever platform will be much much easier.

Do I need to know Ruby in order to learn Ruby on Rails? [duplicate]

This question already has answers here:
Closed 12 years ago.
I've read several other questions about material in order to learn RoR. But my question is can I start learning RoR without Ruby?
It's clear that the other way around is better, but I would rather try this way if it makes sense (somehow). Or learn both in parallel...
Well, given that Ruby on Rails is just Ruby written in a particular fashion (read: framework) yes you will need to learn Ruby.
You will need to learn these things about Ruby (amongst other things):
Everything Is An Object. Everything. Yes, even 2 and "foo"
Class Inheritance and What It Does(tm)
How to tell the difference between class and instance methods
Modules and how to use them correctly (class_eval Is Your Friend)
People write gems. Use them. Re-inventing the wheel is fine and dandy for learning but re-inventing it because you think your method is better is not.
And these things about Rails:
Do not fight conventions.
Do not fight conventions.
Model code goes in the model.
Controller code goes in the controller.
View code goes in the view.
Helper code goes in the helper.
Ask yourself "Does Rails have a helper for it?". If the answer is "No" ask somebody else. The answer is likely to be "Yes".
And these things in general about learning:
Google it.
Google it again.
If the answer you seek is not within Googling distance, formulate it in a way that is kind to those who may know the answer (such as you've done with this question!)
Appeal to people's greater motives. How can helping you, help them?
Try not to be too much of a help vampire.
If asking in an IRC channel, use a pastebin service such as http://pastebin.com, http://pastie.org or http://gist.github.com
Second rule about asking in IRC: Don't ask "any ideas?" after your question. Your question should already ask this by itself.
And finally: Love what you do.
People used to say that you could learn RoR without knowing Ruby (including DHH, if I am not wrong).
But in my opinion, if you also know Ruby, you can do a lot more stuff than without knowing it. And the knowledge would be very helpful when you debug or troubleshoot your programs.
So my suggestion is learn both in parallel.
You can. RoR is in a way a domain specific language, since a lot is defined for you and putting a simple application together can be like following a straightforward recipe. It would of course be better to learn the language properly, but many people don't.
The Ruby For Rails book tries to teach you both at the same time, so you might want to look into getting that one. I haven't read it but I hear it's pretty good.
Obviously :) ... if you really want to develop good web apps ...
But it will also be interesting to first get your hands wet with some RoR sample applications using inbuilt features that RoR provides... and then learn the details(which will require knowledge of Ruby)
If you avoid learning Ruby, (that many of the RoR developers do)... then you will find yourself stuck at position and going through an alien code. And eventually you might leave RoR out of frustration. I have seen many of such cases.
The question you ask is slightly ambiguous. Specifically, you could be asking "Can I learn Rails without first knowing Ruby?", or "Can I learn Rails without having to learn Ruby too?".
The answer to the later question is probably no, if you want to be particularly functional with it. Without knowing Ruby, it would be hard to take advantage of much of Rails' power.
The answer to the first question is most certainly yes. While knowing Ruby first would make learning Rails faster/easier, you can easily learn both at the same time. That's actually how I learned Ruby/Rails, by taking a site I had to implement first in Java and re-implementing it using Rails.
You need to know both, The RoR framework is an organizational and convenience system if you will, what it organizes is your ruby code.
If you have programmed before then here are most of your answers:
http://www.ruby-doc.org/core/
http://railsapi.com

Rails learn's confusion

This is a beginner's rails learning confusion. When I learn rails, from time to time, I feel frustrated on rails' principle "Convention over Configuration". Rails uses heavily on conventions. A lot of them are just naming conventions. If I forget a convention, I will either use the wrong naming and get unexpected result or get things magically done but don't understand how. Sometimes, I think of configuration. At least configuration lists everything clearly and nothing is in fog. In rails, there seems a hidden, dark contract between you and the machine. If you follow the contract, you communicate well. But a beginner usually forgets items listed on the contract and this usually leads to confusion.
That's why when I first pick up rails, I feel like it is somehow difficult to learn. Besides, there are many other things that could be new to a learner, such as using git, using plugins from community, using RESTful routing style, using RSpec. All these are new and come together in learning ruby and rails. This definitely adds up difficulties for a beginner.
In contrast, if you learn php, it wouldn't be that bad. You can forget many things and focus on learning php itself. You don't need to learn database handling if you know SQL already(in rails, you need to learn a whole new concept migration), you don't have to learn a new decent unit test(in rails, usually they teach RSpec along the way because rails is agile and you should learn test-driven development in the early learning stage), you don't have to learn a new version control(in rails, you will be taught about git anyway), you don't have to use complicated plugins(in rails, they usually use third-party plugins in textbook examples! what the hell? why not teach how to do a simplified similar thing in rails?), you don't have to worry RESTful style.
All in all, when I learn php, I learn it quick and soon I start to write things myself. Learning php is similar to learning C/java. It tastes like those traditional languages. When I learn rails, it is more difficult. And I need to learn ruby as well (I believe many of you learn ruby just because of rails).
Does anyone have the similar feeling as I have? How do you overcome it and start to master rails? Hints will be welcomed. Thank you.
You do need to learn Ruby. Ruby is a language. It has its own quirks. You don't need to learn a lot of Ruby, but you can't learn no ruby and expect to write anything decent.
Next, you do need to learn the Rails conventions. Learning the conventions means that you don't need to learn the Ruby networking classes. If you don't want to learn the conventions, then writing anything of value will be difficult.
It's really no different than learning C# (as a language), then learning an MVC framework, like ASP.NET MVC, or FubuMVC.
Yes, you throw up a anything in PHP, learning a lot less in the process. But investment is valuable. Your education is valuable.
Learning takes time. Modelling is important, and I've seen some ugly Rails code because the authors were poor modellers. Those poor models turned into ugly databases. But it still worked! It met that customer's needs.
You comparision Rails with PHP does not hold, since Rails is a framework and PHP is a language. You should compare Ruby with PHP, or Rails with some PHP framework (I am not familiar with PHP frameworks and do not know an example)
But you are right about the things that 'magically' happen with Rails. I too had problems understanding them and looked many things in the Rails code to see what was actually happening and why.
To learn Rails you should first learn the language on which it is build (like you should do with any framework IMHO), so learn Ruby first. Personally I liked Mr. Neighborly's Humble Little Ruby Book a lot. It is written in a easy and nice way and is not boring/serious like a lot of books on languages.
After that I read/did all tutorials/guides on http://guides.rubyonrails.org/ they covert the (important!) basics and tell about the Rails specific things you are writing about.
When I first heard of Rails the claim was that you could build a web app ten times faster than the other frameworks. I always thought this was an exaggeration.
Most of the conventions are hard to remember if you don't have ten years of doing it the 'configuration' way. So, for someone new to web development it is hard to remember all the conventions and to understand why they are important. I definitely did not see a ten time increase in productivity. Routing, for example, probably started nice and simple but grew more and more complex. I think some effort should be made (perhaps by the people writing Rails books) to not try and throw every capability out there to confuse newbies.

Rails vs Ruby CGI [closed]

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 have a boss who is convinced learning Rails is too steep a learning curve and not cost effective from a labor standpoint when straight Ruby running as a CGI app on Apache is available. He is proposing, for our rewrite, that we use straight Ruby w/ no framework rather than Rails (or Merb, Sinatra, etc.) I believe in my heart that this is a bad idea but I'm having trouble putting my case into words. Some ideas I've come up with so far:
Rails promotes better code reuse and better separation of concerns via MVC
A shop running rails will look more attractive to the qualified job seeker, since Rails looks better on his/her resume, is more fun to work with, etc.
(I may be wrong on this one) Rails will have better performance on Passenger because Passenger automatically pools connections to the database where as a handrolled CGI app would have to manage that itself or not at all resulting in worse performance.
Rails is a proven technology, at least certainly more than a handrolled CGI framework
Are there any reasons I'm missing or wrong about? Are there valid tradeoffs I'm not aware of?
There are occasionally good reasons for a company to roll their own framework instead of using a standard Rack-compliant framework. But "Rails has too steep a learning curve" is not one of them.
Doing it brute-force is actually more complex, rather than less. If your boss is really worried about learning curve, he should use the standard framework that has documentation and articles and screencasts and entire hosting companies dedicated to it.
Besides, Rails is dead easy to develop for. I've taught one-day workshops on Rails, and even people who have never programmed before have a working, deployed app by the end of the day. Experienced developers have an even easier time of it.
If your boss doesn't understand Rails, and rather than figure it out, he's giving you this line about Ruby over CGI...be careful. Technology left him behind 15 years ago, and he's no longer qualified to make technical decisions.
He should be moved into marketing without delay.
Does your boss have any reasons for his conviction? Other than "a feeling"? What are his real concerns - you won't have much success in changing his mind until you have worked out what his underlying concerns are. Don't be surprised if they turn out to be substantially different to what he's currently saying. He may have an irrational fear of Danes, for example.
Do you have any concrete reasons for disagreeing?
As a boss, I wouldn't be too swayed by the reasons you list so far: good design/coding practices don't need a framework, recruitment isn't your concern, performance optimisation? Don't do it? How more proven than CGI? (He might say, not me: I drink the Rails Kool-aid every day).
Is he technical in a current sense? I mean, will he be involved in coding the rewrite? If so, might he be open to a challenge? Pick a subset of features, buildable in a day or two and try it both ways. If he's not technical, why does he think your opinion is less valid than his?
If he's concerned from a cost/effort perspective, why does he believe that writing less code (and getting thousands of lines of useful, tested framework code for free) is more costly and/or more effortful than otherwise?
Someone else has already mentioned "managing up" - I suggest Googling for resources on ways to work on this.
Are there other members of a team involved? How do they feel?
Martin Fowler famously (in the Agile world at least) said something like "if your organization is not doing what you think it should, you should change your organization". There are at least two ways to read that...
I think a potentially great idea would be to use parts of RoR(Cough ActiveRecord) and roll your own stuff if it simplifies things... I'm not a framework kinda guy, I prefer libraries and a certain degree of code abstraction, which is why I could never be mistaken for a RoR fanboy... but I think getting him to use certain parts of rails, might turn into using all of rails.
Only other point I would like to make is that MVC isn't rails only and if you rolled your own then you could very easily follow that design pattern... besides rolling your own can have benefits... for one thing, you'll know exactly what everything does and how it works, self rolled would mean a leaner system, that you can modify more easily...
My final answer is meet in the middle... Ruby is EXTREMELY powerful in the hands of creative programmers... in fact, I'm in the process of re-rolling my 2 months of rapid "throw-together" php/jquery prototype into a erb/jquery site...
--Thinking out loud--
Not trying to crap on Ruby on Rails... but Rails are what trains go on... and trains do go fast... but they only go where the tracks take you. I'm more in favor of a "Ruby off Road" environment. Less speed, More control.
Using Ruby on Rails versus just Ruby is the difference between buying an automobile and welding a unicycle out of a single tire: both will get you where you are going.
At heart though, I think this is less a technological issue and more an issue of "managing up" as the decision NOT to use Rails is so laughably bad at this point as to be nonsensical.
I think you have two options:
Sort out a way to make it seem as if using Rails was your bosses idea all along. You might say something like: "Boss, I've heard what you've said and so instead of using full blown Rails, I'm just going to use it as a basic framework and do most of the work in straight Ruby."
Take the initiative to do a prototype of the development over a weekend, give your boss something provable that says: "This is clearly the way to go".
Good luck.
It's not a very steep learning curve. You might want to ask him to walk through a tutorial before making a decision.
Also, a big advantage is that RoR is a pretty popular system right now. Installing plugins is trivial, there are many deployment options already figured out--basically a lot of the work that isn't directly "Programming" will probably be easier.
And active record--it's so useful that it's difficult to imagine doing a web/database app without it any more.

Resources