I've decided... I'm going to learn Ruby

Ye' old general discussion board. Basically, for everything that isn't covered elsewhere. Come here to shoot the breeze, shoot your mouth off, or whatever suits your fancy.
This forum is not for asking programming related questions.

Moderator: General Moderators

User avatar
Ollie Saunders
DevNet Master
Posts: 3179
Joined: Tue May 24, 2005 6:01 pm
Location: UK

Post by Ollie Saunders »

Well...do you like development?
Yes, very much so.
Do you desire to be in an enviornment that requires you to have understanding of c/c++ - style syntaxes
Not necessarily. C syntax is pretty good but there might be better. C syntax was devised for C you know, not for dynamic object orientated interpreted languages.
or do you just want to let things work in a basically anti-c-syntax enviornment?
I wouldn't say Ruby is anti C.

Code: Select all

a = 4
a+= 7
puts a

Code: Select all

int a = 4;
a+= 7;
puts(a);
there are similarities i'm sure you will agree.
Would you like to be able to apply what you learn in a language to other languages (notibly c++, C#, java, etc), or do you not care ?
I care about this but not to the extent that I would not learn something new if it disrupted what I already know. If I had that attitude I probably never would have learned OO or unit testing or changed my programming style.

One of the things I do (90% of my life has proven to be the right thing to do) is when someone or someones with authority comes along and says something like
"this", the person with authority points to the sky, "is a good thing" or
"you should do it like this" then I listen and I try it, properly. If I think they are completely wrong then I examine this issue. Why do our views differ so greatly?

Whilst there is a chance that our views differ for a good reason it is more likely that I just haven't quite got it. It is at this point that I stand to learn something. I know that at the end of that day I'm going to be better programmer than I was when I woke up.

I strive to improve and if it's a little uncomfortable or a little new, that's fine. If it's very uncomfortable and completely alien I'd have to think about embarking upon it or the authority behind it would have to be very large. OO is a good example of this.

There's a growing stream of authority behind Ruby, it's probably only a trickle at the moment but I know enough about programming to make my own judgements now and I've decided it is worthy of my attention; hence the thread.

Your statement implies I'm going to be throwing away everything I know and I put it to you that you speak those words out of fear and ignorance for this is not the case. *cough* </shakespear>. Let make a list shall we? Of the things I know and then the things I'm going to be able to apply in Ruby.

Things I Know
  • Syntax of PHP
  • Understanding of logic
  • Expected behaviour from the use of program flow constructs such as loops
  • Familiarity with data structures such as arrays, stacks, queues, tables, vectors etc.
  • Familiarity with the concept of state
  • OO design principles
  • Motivations behind refactoring and the refactors themselves
  • Working knowledge of PHP standard library
  • Web application security issues
Obviously that's a brief list I didn't particularly want to spend the rest of my life typing this post plus I don't think Readers Digest do forum posts.

Things I Know That can be Applied to Ruby
  • Understanding of logic
  • Expected behaviour from the use of program flow constructs such as loops
  • Familiarity with data structures such as arrays, stacks, queues, tables, vectors etc.
  • Familiarity with the concept of state
  • OO design principles
  • Motivations behind refactoring and the refactors themselves
  • Web application security issues
so let's print_r(array_diff($thingsIKnow, $applibleToRuby));

Code: Select all

array(1) (
   0 => 'Working knowledge of PHP standard library',
   1 => 'Syntax of PHP'
)
OK so by programming in Ruby I'm missed out on two things. But I'm happy to learn the new Ruby syntax because it is better. With regards to the standard library: I still have a rough idea the kind of actions I need to perform, what I should expect from a language's standard library and when I use the ruby equivalent of strpos() I'll have all the knowledge of how I've used that function in the past such as when it was useful, when a different function would have been better, when I used it as a callback, what it should expect it to return, what parameters it takes etc. etc.
User avatar
infolock
DevNet Resident
Posts: 1708
Joined: Wed Sep 25, 2002 7:47 pm

Post by infolock »

Very good response. I understand where you are coming from, but I still don't agree. I dove into RoR head first and halfway through it, i stopped. I just didn't like the syntax, I didn't like the environment, and I just didn't agree with how they were trying to make the developer code. To me, I just felt like my iq was dropping every second I tried to go on.

But not everyone will have that experience. Obviously you haven't, and you are having a wonderful time in it. That's awsome, I hope you do well :) It just isn't for me, and I don't feel like a developer at all.

it's stuff like this:

Code: Select all

<% @recipes.each do |recipe| %>
  <tr>
   <td><%= link_to recipe.title, :action => "show", :id => recipe.id %></td>
   <td><%= recipe.category.name %></td>
   <td><%= recipe.date %></td>
  </tr>
 <% end %>
or this code sniplet

Code: Select all

def setup_referring_keywords
	# Check whether referring URL was a search engine result
	referer = @request.env["HTTP_REFERER"]
	unless referer.nil_or_empty?
		search_referers = [
			[/^http:\/\/(www\.)?google.*/, 'q'],
			[/^http:\/\/search\.yahoo.*/, 'p'],
			[/^http:\/\/search\.msn.*/, 'q'],
			[/^http:\/\/search\.aol.*/, 'userQuery'],
			[/^http:\/\/(www\.)?altavista.*/, 'q'],
			[/^http:\/\/(www\.)?feedster.*/, 'q'],
			[/^http:\/\/search\.lycos.*/, 'query'],
			[/^http:\/\/(www\.)?alltheweb.*/, 'q']
		]
	query_args =
		begin
			URI.split(referer)[7]
		rescue URI::InvalidURIError
			nil
		end
	search_referers.each do |reg, query_param_name|
		# Check if the referrer is a search engine we are targetting
		if (reg.match(referer))
			# Highlight the Search Term Keywords on the page
			#@javascripts.push('keyword_highlighter')
			# Create a globally scoped variable (@referring_search) containing the referring Search Engine Query
			unless query_args.nil_or_empty?
				query_args.split("&").each do |arg|
					pieces = arg.split('=')
					if pieces.length == 2 && pieces.first == query_param_name
						unstopped_keywords = CGI.unescape(pieces.last)
						stop_words = /\b(\d+|\w|about|after|also|an|and|are|as|at|be|because|before|between|but|by|can|com|de|do|en|for|from|has|how|however|htm|html|if|i|in|into|is|it|la|no|of|on|or|other|out|since|site|such|than|that|the|there|these|this|those|to|under|upon|vs|was|what|when|where|whether|which|who|will|with|within|without|www|you|your)\b/i

						@referring_search = unstopped_keywords.gsub(stop_words, '').squeeze(' ')
						logger.info("Referring Search Keywords: #{@referring_search}")
						return true
					end
				end
			end
			return true
		end
	end
end
true
end

That just doesn't make me feel like a developer at all. It makes me feel like i'm just writing very poor xslt or a mockup of Fortrane.. The language is just too dumbed down for me i guess.

And just for the record, a few similarities in a language does not constitute it to be just like c++. If you are able to interpret between the two because you understand both, that to me isn't the same as the syntax being the same. Granted, PHP has differences between C++ too, but the similarities far outweight the negatives.

But to each his own. I hope you have fun with it :) I just can't bring myself to go down that road.
User avatar
Luke
The Ninja Space Mod
Posts: 6424
Joined: Fri Aug 05, 2005 1:53 pm
Location: Paradise, CA

Post by Luke »

/me is enjoying his python book :)
Post Reply