Open Side Menu Go to the Top
Register
Coursera SaaS class (Ruby+Rails) discussion Coursera SaaS class (Ruby+Rails) discussion

03-05-2012 , 09:25 PM
The course can be found here: https://www.coursera.org/saas/lecture/index

I guess we can discuss homework answers/solutions as soon as the hard deadline passes. I feel like it's ok to post cucumber/rspec etc. tests earlier.

Gonna go to bed now but I'll post my tests later...they are pretty terrible from an "engineering good tests POV" so I'd love to discuss how to improve tests. Just started with cucumber so I used that for a couple of the examples eventhough it probably wouldn't make much sense to use cucumber IRL.
Coursera SaaS class (Ruby+Rails) discussion Quote
03-06-2012 , 09:47 AM
is ruby popular? whats the advantage of it over alternatives?
Coursera SaaS class (Ruby+Rails) discussion Quote
03-06-2012 , 10:59 AM
It may sound strange but the advantage is that it's a fun language. It looks nice when you read the code and you can get lots of stuff done in very few lines of code.

The main appeal for most is obviously the existance of the Rails framework which lets you build webapps fairly quickly and in a nice and sane way (imo) but similar frameworks exist for Java, PHP, Python etc.

Ruby the language itself is pretty nifty though, everything is an object, classes are always open, metaprogramming is easy, closures are uncomplicated and make life easy, duck typed, mixins instead of multiple inheritance, (almost) functional programming is possible and used

It's been buzzing for a couple of years now. Twitter uses it, so do some other projects you'll know if that's your domain (metasploit for example)

Edit: Just saw this quote in 7 languages in 7 weeks: "If you think of other C-based languages such as JAVA as old draconian British nannies...Ruby is like Mary Poppins"
I like it

Last edited by clowntable; 03-06-2012 at 11:28 AM.
Coursera SaaS class (Ruby+Rails) discussion Quote
03-06-2012 , 10:28 PM
Quote:
Originally Posted by Ryanb9
is ruby popular? whats the advantage of it over alternatives?
Ruby is gaining popularity due to the Rails framework, mostly. There are a lot of open source solutions (gems) that quickly solve 95% of the common problems you face in SaaS solutions.

That said, Django offers pretty much the same thing, but you have to be well versed in Git to take advantage of a lot of the solutions.

In my personal opinion (very personal so don't give this real weight), Ruby is mostly for hipster nerds who get the philosophy of what good programming is, but are too lazy to handle difficult tasks. Using Django/Python (or even Pyramid/Python) takes more work up front (speaking of ramp up time only), but it performs much better on a higher scale than Ruby any way you slice it... that and if you manage to somehow get Jython to actually support all your Python code (LOL @ abandoned projects that are fantastic ideas), you'll be able to run in the JVM giving you the best performance available.


To be quite frank though, anybody who is writing *new* production level SaaS software that isn't in Rails/Django/Groovy is ****ing ******ed. The development and maintenance costs of more old school languages/frameworks is simply too high to be taken seriously. Legacy projects, for the most part, are excluded from this analysis.
Coursera SaaS class (Ruby+Rails) discussion Quote
03-06-2012 , 10:34 PM
Quote:
Originally Posted by clowntable
but similar frameworks exist for Java, PHP, Python etc.
Was going to let this slide until I saw you included Java frameworks. Good lord Struts and Spring are overhyped garbage. A framework is supposed to take care of common tasks for you... Struts and Spring basically give you an "outline" to go by... you still need to hand-code a ton of layers or come up with your own dynamic solutions... that and the docs are ****ing garbage. Groovy/Spring has potential... assuming you are supporting a Java based legacy codebase.

I won't say much on the PHP frameworks since my exp with PHP is limited to a single personal website that doesn't do more than post a resume, handle a contact me form to send a Postfix mail server a mail, and send an SMS through an API call, but from the code I've reviewed PHP tends to be really Perl-esq as far as difficulty to read. That may be due to its popularity, however, since popular languages tend to get overrun with D level programmers.
Coursera SaaS class (Ruby+Rails) discussion Quote
03-07-2012 , 03:25 AM
Quote:
Originally Posted by deafeye
Was going to let this slide until I saw you included Java frameworks. Good lord Struts and Spring are overhyped garbage. A framework is supposed to take care of common tasks for you... Struts and Spring basically give you an "outline" to go by... you still need to hand-code a ton of layers or come up with your own dynamic solutions... that and the docs are ****ing garbage. Groovy/Spring has potential... assuming you are supporting a Java based legacy codebase.
the java "play" framework is very nice and takes its inspiration from rails.

Quote:
I won't say much on the PHP frameworks since my exp with PHP is limited to a single personal website that doesn't do more than post a resume, handle a contact me form to send a Postfix mail server a mail, and send an SMS through an API call, but from the code I've reviewed PHP tends to be really Perl-esq as far as difficulty to read. That may be due to its popularity, however, since popular languages tend to get overrun with D level programmers.
well written php using one of the major frameworks is not bad. however, even with my now minimal experience with ruby and rails, it's clear they are superior. ruby as a language just ****s all over php.
Coursera SaaS class (Ruby+Rails) discussion Quote
03-07-2012 , 01:19 PM
lol at programming language wars. There's a saying about programming languages: all good programming languages suck. I use PHP and Ruby and like both of them very much. Most of the people that would go to war and die for Ruby don't even understand why. Their answer to every question about Ruby is "syntactic sugar!!!" Seriously, it's 2012. If you don't realize that every language is capable of having good and bad code you're a moron. There are a ton of terrible PHP programmers but just because other people aren't good with a language is not grounds for a language sucking. For a while the leadership behind PHP sucked. In the last 5 years or so it's clearly headed in a much better direction. Previously people wanted PHP to be things that it isn't. The latest update to PHP (5.4) is only further proof of heading in the right direction.

Ruby has a fantastic community behind it to help you learn and one of the best parts about Ruby is also the worst -- gems. People who start with Ruby as a first programming language often don't learn how to think past a certain level of abstraction. There are so many gems to do just about everything for you that you don't need to think most of the time. So many Ruby Developers can probably build a full on shopping cart in a weekend using gems but if you ask them to add a special set of functionality that isn't solved with a gem they will have a brainfart on how to do it for a week.
Coursera SaaS class (Ruby+Rails) discussion Quote
03-07-2012 , 02:22 PM
Quote:
Originally Posted by RICHI8
So many Ruby Developers can probably build a full on shopping cart in a weekend using gems but if you ask them to add a special set of functionality that isn't solved with a gem they will have a brainfart on how to do it for a week.
Is the standard to use all that you can and then tweak what you have to fit what you need? Or if you knew in advance you would need the tweak later, would you not use a 'gem' and do it from the ground up? (im very new to programing btw, not even sure if my question will make sense)
Coursera SaaS class (Ruby+Rails) discussion Quote
03-07-2012 , 03:16 PM
Quote:
Originally Posted by Ryanb9
Is the standard to use all that you can and then tweak what you have to fit what you need? Or if you knew in advance you would need the tweak later, would you not use a 'gem' and do it from the ground up? (im very new to programing btw, not even sure if my question will make sense)
When you build a new car, do you spend time re-designing the wheel?
Coursera SaaS class (Ruby+Rails) discussion Quote
03-07-2012 , 04:44 PM
Quote:
Originally Posted by deafeye
Ruby is gaining popularity due to the Rails framework, mostly. There are a lot of open source solutions (gems) that quickly solve 95% of the common problems you face in SaaS solutions.

That said, Django offers pretty much the same thing, but you have to be well versed in Git to take advantage of a lot of the solutions.

In my personal opinion (very personal so don't give this real weight), Ruby is mostly for hipster nerds who get the philosophy of what good programming is, but are too lazy to handle difficult tasks. Using Django/Python (or even Pyramid/Python) takes more work up front (speaking of ramp up time only), but it performs much better on a higher scale than Ruby any way you slice it... that and if you manage to somehow get Jython to actually support all your Python code (LOL @ abandoned projects that are fantastic ideas), you'll be able to run in the JVM giving you the best performance available.


To be quite frank though, anybody who is writing *new* production level SaaS software that isn't in Rails/Django/Groovy is ****ing ******ed. The development and maintenance costs of more old school languages/frameworks is simply too high to be taken seriously. Legacy projects, for the most part, are excluded from this analysis.
Python 3 vs Python 2 (especially concidering Django) is pissing me off too much that's why I switched to Ruby mostly.

Ruby as a language also seems a tad more elegant than Python, I have a feeling it may be slower but the speed difference is something I can ignore (or if I have to worry about it that's a good thing and I'll have the resources to do so). Either way I treat Python/Ruby as pretty much the same. Fun, can develop quickly, nice to read.

FWIW, I dunno much about JRuby but it exists.

---
I haven't started on the second HW assignments yet. I see I'll have to get the VM to run and get a Heroku account to do it though.
Coursera SaaS class (Ruby+Rails) discussion Quote
03-07-2012 , 04:48 PM
Quote:
Originally Posted by clowntable
Python 3 vs Python 2 (especially concidering Django) is pissing me off too much that's why I switched to Ruby mostly.

Ruby as a language also seems a tad more elegant than Python, I have a feeling it may be slower but the speed difference is something I can ignore (or if I have to worry about it that's a good thing and I'll have the resources to do so). Either way I treat Python/Ruby as pretty much the same. Fun, can develop quickly, nice to read.

FWIW, I dunno much about JRuby but it exists.

---
I haven't started on the second HW assignments yet. I see I'll have to get the VM to run and get a Heroku account to do it though.
I just ignore Python 3 like it doesn't exist... matter of perspective I guess.

If JRuby is anything like the Jython project then don't expect much... but Rails hasn't derailed (har har) due to a split like Python 3 not being backwards compatible, so it's possible that JRuby is a much better solution in comparison to its kin. FWIW the benchmarks on JRuby outperform Ruby itself...
Coursera SaaS class (Ruby+Rails) discussion Quote
03-07-2012 , 05:51 PM
Quote:
Originally Posted by deafeye
When you build a new car, do you spend time re-designing the wheel?
No. But what I mean is, do you use the blue prints to an engine you already have, or do you design a new engine specifically for this new car you are making.
Coursera SaaS class (Ruby+Rails) discussion Quote
03-07-2012 , 06:09 PM
Hate to be a nit, but this is a thread about a specific SaaS course. Can we move the more general debate to LC or another thread?
Coursera SaaS class (Ruby+Rails) discussion Quote
03-07-2012 , 07:11 PM
Quote:
Originally Posted by gaming_mouse
Hate to be a nit, but this is a thread about a specific SaaS course. Can we move the more general debate to LC or another thread?
+1 actually
Coursera SaaS class (Ruby+Rails) discussion Quote
03-07-2012 , 08:24 PM
Is this strictly a ruby class? I don't think I have the time/experience to easily pick up another language right now but can see that this cloud stuff is huge.
Coursera SaaS class (Ruby+Rails) discussion Quote
03-07-2012 , 09:55 PM
Quote:
Originally Posted by e i pi
Is this strictly a ruby class? I don't think I have the time/experience to easily pick up another language right now but can see that this cloud stuff is huge.
yeah it is. and even if you don't have time now, if you decide to learn ruby in the future i'd recommend this class's book/vids. i have a few of the most popular ruby books and i think their method of teaching is better than any of them.
Coursera SaaS class (Ruby+Rails) discussion Quote
03-08-2012 , 10:43 AM
Quote:
Originally Posted by clowntable
+1 actually
+1 me too
Coursera SaaS class (Ruby+Rails) discussion Quote
03-08-2012 , 02:10 PM
Nice to see this thread in 2p2. I'm in this class and really enjoying it so far. Lecturers sound like they are extremely knowledgeable and they are going at a good pace. I didn't have any previous Java experience but started learning Ruby a couple weeks before the class started.

I have no experience with cucumber/rspec, so def will be using this thread more later. I'm on hw3, problem 4, its been a slow process but definitely feel like I'm learning a lot.
Coursera SaaS class (Ruby+Rails) discussion Quote
03-11-2012 , 10:04 AM
I want to throw my computer out the window. Has anyone successfully launched rails server on rottenpotatoes running the latest version of lion and xcode 4.3?
Coursera SaaS class (Ruby+Rails) discussion Quote
03-11-2012 , 11:30 PM
surprised how long this week's hw took....
Coursera SaaS class (Ruby+Rails) discussion Quote
03-12-2012 , 02:56 AM
I signed up for too many of these free courses and had to sacrifice this class, but the little I learned of ruby intrigued me.
Coursera SaaS class (Ruby+Rails) discussion Quote
03-12-2012 , 03:49 AM
this hw took me a really long time as well (prob 12-15 hrs)- though i found out when i reviewed my solution, that i made it way more complicated than i needed to (i created a new parameter for previous ratings instead of continuously just storing it in the ratings parameter). probably could've shaved quite a few hours off if i didn't do that. however all the research and code-tweaking to get the super-complicated solution working helped me understand rails a lot better, so i guess it wasn't a complete waste of time...
Coursera SaaS class (Ruby+Rails) discussion Quote
03-12-2012 , 11:22 AM
Didn't even start on the HW yet, probably won't and will switch to just watch and do the occasional assignment that looks like fun.
Have to prepare for something different that happens to be this Wednsday and needs full focus
Coursera SaaS class (Ruby+Rails) discussion Quote
03-12-2012 , 02:13 PM
Has anyone had trouble with the automatic grading? For example in part 1 I fail the first test:

Quote:
Failure/Error: 2.rupee.in(:dollar).between?(0.037, 0.039).should be_true
but when I run it on my machine:
Code:
puts 2.rupee.in(:dollar) #0.038
Parts 4 and 5 seem to be giving me some issues despite my site working (as far as I can tell) according to the criteria.
Coursera SaaS class (Ruby+Rails) discussion Quote
03-13-2012 , 06:23 PM
Hard deadline for HW1 has passed so might as well post my stuff (would like to see if others solved it in nicer ways etc. pp).
Very interested in any pointers about cucumber/rspec use (outside of don't use it here lol).
The one thing I'm aware of is I tend to use non-Ruby-like explicit returns. Guess I could ditch them but I have my reasons for using them.

hw 1.1 (Used Cucumber for 1.1 and 1.2 just to use it)
count_word.feature:
Code:
Feature: Count Words

As a user I want to be able to count the words in a given sentence.

Scenario Outline: Count words in a given sentence
  Given the input to count_words is "<input>"
  When count_words is run
  Then the output of count_words should be "<output>"
  
Examples:
  |input|output|
  |A man, a plan, a canal -- Panama|{'a' => 3, 'man' => 1, 'canal' => 1, 'panama' => 1, 'plan' => 1}|
  |Doo bee doo bee doo|{'doo' => 3, 'bee' => 2}|
  |a A a|{'a' => 3}|
count_words_steps.rb:
Code:
require_relative 'hw1_1.rb'

Given /^the input to count_words is "([^"]*)"$/ do |input|
  @input = input
end

When /^count_words is run$/ do
  @output = count_words(@input)
end

Then /^the output of count_words should be "([^"]*)"$/ do |expected_output|
  raise("Wrong Output") unless @output == eval(expected_output)
end
palindrome.feature:
Code:
Feature: Detect palindromes

As a user I want to be able to check if a given word or phrase is a palindrome.

Scenario Outline: Provide input to palindrome?
  Given the input to palindrome? is "<input>"
  When palindrome? is run
  Then the output of palindrome? should be "<output>"
  
Examples:
  |input|output|
  |A man, a plan, a canal -- Panama|true|
  |Madam, I'm Adam!|true|
  |Abracadabra|false|
palindrome_steps.rb:
Code:
require_relative 'hw1_1.rb'

Given /^the input to palindrome\? is "([^"]*)"$/ do |input|
  @input = input
end

When /^palindrome\? is run$/ do
  @output = palindrome?(@input).to_s
end

Then /^the output of palindrome\? should be "([^"]*)"$/ do |expected_output|
  raise('Wrong Output') unless @output == expected_output
end
hw1_1.rb:
Spoiler:
Code:
def palindrome?(string)
  pretty_string = string.downcase.gsub(/\W/,'')
  return  pretty_string == pretty_string.reverse
end

def count_words(string)
  my_hash = Hash.new
  string.downcase.scan(/\w+\b/).each do |key|
    my_hash[key] ? my_hash[key] += 1 : my_hash[key] = 1
  end
  return my_hash
end
Coursera SaaS class (Ruby+Rails) discussion Quote

      
m