Clan x86

Technical (Development, Security, etc.) => JavaOp Board => Topic started by: Joe on August 21, 2011, 01:55:06 am

Title: A few changes..
Post by: Joe on August 21, 2011, 01:55:06 am
Hello!

If you follow me on twitter, you certainly know that I was at a Ruby conference these past few days. As yesterday was Whyday, I decided to remove the ant build script and replace it with rake. This means two things:

The ant script ran clean,build,jar on my MacBook Pro in about 8 seconds. Rake runs clean,build,jar in just under 13. You're probably thinking, "whytf did you do that, then?". Most of the startup time for rake with JRuby is loading a JVM (and using standard rake isn't an option for building Java projects). There's a neat project called Nailgun that keeps a server JVM running in the background. By typing 'jruby --ng-server &', you'll start up a Nailgun server, and then run 'jruby --ng -S rake clean build jar'. This still takes 13 seconds. However, JVM has been optimizing the compiler. Running it again only takes 7 seconds, so the ant script is outperformed after only two runs. The next takes 5 seconds. Do you see a trend? It's unlikely that I'll sit down, fix a bug, test, commit and push in one build cycle, and if I do, it only cost me an extra 5 seconds in build time.

Equally important, and much more important to users, is that rake is awesome for testing. I was using JUnit before, mostly to fix some CheckRevision bugs I made by testing local hashing directly against BNLS. JUnit is a real pain. I need to download the JAR, put it in the correct place, figure out dependencies and classpaths, etc etc, and maybe it'll run. Check this out:

Code: [Select]
[00:52:48] [william@enterprise ~/Documents/Git/GitHub/javaop2]$ jruby --ng -S rake test
Loaded suite /Users/william/bin/jruby-1.6.3/bin/rake
Started
Testing D2DV..  local: 573e1c0c, remote: 573e1c0c
Testing D2XP..  local: 7264e3da, remote: 7264e3da
Testing STAR..  local: -5bab8e79, remote: -5bab8e79
Testing W2BN..  local: -3122f25d, remote: -3122f25d
Testing WAR3..  local: 32a227d6, remote: 32a227d6
Testing W3XP..  local: 32a227d6, remote: 32a227d6
.....
Finished in 1.061 seconds.

5 tests, 15 assertions, 0 failures, 0 errors

This is really neat because now every time I run rake tests, it makes sure I didn't break CheckRevision. Unit testing is a Ruby philosophy, and being adopted in a bunch of other communities. Now, if I break CheckRevision (through any means leading up to the absolute result that gets sent to BNET), I'll be immediately notified. I'm sure this makes rabbit very, very happy.

Happy JavaOping.
Title: Re: A few changes..
Post by: Sidoh on August 21, 2011, 01:54:02 pm
Unit testing is a lot older than ruby...

Rake is fun and all, but I'd much rather have ant. Especially after having ivy. Maybe rake plays well with ivy, but i kinda doubt it's as seamless as it is with ant.
Title: Re: A few changes..
Post by: Joe on August 21, 2011, 02:15:38 pm
Unit testing is a lot older than ruby...

Yeah, but Rubyists and Railers do it at least 100x as much as anyone else.
Title: Re: A few changes..
Post by: Sidoh on August 21, 2011, 03:09:36 pm
Unit testing is a lot older than ruby...

Yeah, but Rubyists and Railers do it at least 100x as much as anyone else.

This is patently false in general, but maybe true in open source. "Unit testing is a Ruby philosophy" makes it sound like ruby folks are the originators of unit testing, which is clearly false.

I like ruby as much as the next guy, but it really sucks for a lot of things.
Title: Re: A few changes..
Post by: Joe on August 21, 2011, 04:20:23 pm
Unit testing is a lot older than ruby...

Yeah, but Rubyists and Railers do it at least 100x as much as anyone else.

This is patently false in general, but maybe true in open source. "Unit testing is a Ruby philosophy" makes it sound like ruby folks are the originators of unit testing, which is clearly false.

I like ruby as much as the next guy, but it really sucks for a lot of things.

I should say "most Rubyists and Railers unit test absolutely everything whereas others don't", and "unit testing is an agile programing philosophy, which is used heavily in Ruby". Of course, agile was only adopted by Ruby after the Rails-era began and was itself originated elsewhere, but the point is that I was introduced to agile and unit testing by rubyists and that's where I see it's primary use today.

I'm curious what things Ruby sucks for. I agree that it's terribly outperformed by {insert any other language here} when run on MRI (http://en.wikipedia.org/wiki/Ruby_MRI), but with JRuby, or especially JRuby + Nailgun, it's deadly fast.
Title: Re: A few changes..
Post by: Sidoh on August 22, 2011, 03:44:40 am
Unit testing is a lot older than ruby...

Yeah, but Rubyists and Railers do it at least 100x as much as anyone else.

This is patently false in general, but maybe true in open source. "Unit testing is a Ruby philosophy" makes it sound like ruby folks are the originators of unit testing, which is clearly false.

I like ruby as much as the next guy, but it really sucks for a lot of things.

I should say "most Rubyists and Railers unit test absolutely everything whereas others don't", and "unit testing is an agile programing philosophy, which is used heavily in Ruby". Of course, agile was only adopted by Ruby after the Rails-era began and was itself originated elsewhere, but the point is that I was introduced to agile and unit testing by rubyists and that's where I see it's primary use today.

I'm curious what things Ruby sucks for. I agree that it's terribly outperformed by {insert any other language here} when run on MRI (http://en.wikipedia.org/wiki/Ruby_MRI), but with JRuby, or especially JRuby + Nailgun, it's deadly fast.

Unit testing is incredibly common in a majority of software companies. The startup I just finished interning with had just as much test coverage for Java projects as it did for its Rails projects.

Weakly typed languages cause all sorts of trouble in bigger software projects.  If I'm doing something in cascading/mapreduce, I'd never wish the ability to do it in ruby. Fuck that.
Title: Re: A few changes..
Post by: Joe on September 05, 2011, 04:27:42 am
I just rewrote CheckRevision in Ruby, and man oh man did I wish I had int64's instead of just BigNum / FixNum. Having to do:

Code: [Select]
a = a & 0xffffffffffffffff
b = b & 0xffffffffffffffff
c = c & 0xffffffffffffffff

...after every iteration of the loop, yikes.

I need to commit that code at some point. I like the way I did it. I used blocks, kind of how MyndFyre dynamically emitted his version, but except not. I defied a block for each action ("A=A+S", etc) and fire each of the blocks on each iteration. I need to do an actual speed test to see if it's faster than the old structure.

For those curious, it does a StarCraft CheckRevision in ~3.6 seconds on MRI, or ~1.8 on JRuby on Nailgun (5th run).

EDIT -
And for those also curious, it's not replacing CheckRevision in JavaOp. I'm thinking about rewriting JBLS (RBLS?) to work better in low-memory situations. It may just be much better to keep a CheckRevision worker running in Java and cache results in ActiveRecord, though.
Title: Re: A few changes..
Post by: MyndFyre on September 05, 2011, 12:40:05 pm
Can't Ruby consume C libraries?  It seems like it might be faster to do something like that...

man oh man did I wish I had int64's instead of just BigNum / FixNum.
Yeah, I don't like this trend in scripting languages to limit the kinds of numbers that you can have.  JavaScript is terrible about that... there's no good currency-based math.  Best thing you can do is multiply everything by 100, finish your math, and divide by 100 when you're done. 

Unit testing is a lot older than ruby...

Yeah, but Rubyists and Railers do it at least 100x as much as anyone else.
I've heard you say a lot of retarded things, Joe, but this is easily the most retarded of the last year or so.
Title: Re: A few changes..
Post by: Joe on September 05, 2011, 02:01:35 pm
Unit testing is a lot older than ruby...

Yeah, but Rubyists and Railers do it at least 100x as much as anyone else.
I've heard you say a lot of retarded things, Joe, but this is easily the most retarded of the last year or so.

How so? Perhaps I should have said "People in the Ruby/Rails culture", or "open source developers in the Ruby/Rails culture". Nobody from a different programming background would ever write a sonnet (https://gist.github.com/1180107) about testing and present it at a conference, or would you?
Title: Re: A few changes..
Post by: Sidoh on September 05, 2011, 02:17:35 pm
Unit testing is a lot older than ruby...

Yeah, but Rubyists and Railers do it at least 100x as much as anyone else.
I've heard you say a lot of retarded things, Joe, but this is easily the most retarded of the last year or so.

How so? Perhaps I should have said "People in the Ruby/Rails culture", or "open source developers in the Ruby/Rails culture". Nobody from a different programming background would ever write a sonnet (https://gist.github.com/1180107) about testing and present it at a conference, or would you?

The problem is it's just wrong. Companies have been hiring software testers for decades. In case that's not clear, that means there are people who have full time jobs writing tests.
Title: Re: A few changes..
Post by: Newby on September 05, 2011, 07:16:25 pm
Unit testing is a lot older than ruby...

Yeah, but Rubyists and Railers do it at least 100x as much as anyone else.
I've heard you say a lot of retarded things, Joe, but this is easily the most retarded of the last year or so.

How so? Perhaps I should have said "People in the Ruby/Rails culture", or "open source developers in the Ruby/Rails culture". Nobody from a different programming background would ever write a sonnet (https://gist.github.com/1180107) about testing and present it at a conference, or would you?

The problem is it's just wrong. Companies have been hiring software testers for decades. In case that's not clear, that means there are people who have full time jobs writing tests.

So Ruby developers are the first developers to test their programs? lol. lol x like 10.
Title: Re: A few changes..
Post by: deadly7 on September 05, 2011, 07:20:01 pm
The problem is it's just wrong. Companies have been hiring software testers for decades. In case that's not clear, that means there are people who have full time jobs writing tests.
That sounds like the worst computer-related job I could ever think of.
Title: Re: A few changes..
Post by: Sidoh on September 05, 2011, 07:22:36 pm
The problem is it's just wrong. Companies have been hiring software testers for decades. In case that's not clear, that means there are people who have full time jobs writing tests.
That sounds like the worst computer-related job I could ever think of.

Maybe for you... some people like it.
Title: Re: A few changes..
Post by: MyndFyre on September 07, 2011, 02:41:19 am
How so? Perhaps I should have said "People in the Ruby/Rails culture", or "open source developers in the Ruby/Rails culture". Nobody from a different programming background would ever write a sonnet (https://gist.github.com/1180107) about testing and present it at a conference, or would you?
I've seen a lot of people do a lot of weird things at a conference.  But another way to consider the example of someone writing a sonnet about testing in Ruby is that the Ruby tester didn't have enough other, productive things to do with his time.

More to the point, while he was writing sonnets about testing, I was writing a C# unit test that unit-tested the JavaScript for the updates GoDaddy is rolling out on my product around the end of the month.  38 tests for something like 120 lines of code.  And it turned out - lo and behold - that the unit tests found two bugs in my JavaScript.  People realized the value of unit testing well before Ruby was the little thought-sperm in Yukihiro Matsumoto's brain.

The problem is it's just wrong. Companies have been hiring software testers for decades. In case that's not clear, that means there are people who have full time jobs writing tests.
That sounds like the worst computer-related job I could ever think of.
I thought it was odd too, but we have a dedicated QA department at GoDaddy and most of them are not programmer-level technical people in the least.  http://www.joelonsoftware.com/items/2010/01/26.html
Title: Re: A few changes..
Post by: Sidoh on September 07, 2011, 04:21:26 am
People like breaking stuff. They're the kids that liked kicking sandcastles.
Title: Re: A few changes..
Post by: Joe on December 10, 2011, 08:00:06 am
People like breaking stuff. They're the kids that liked kicking sandcastles.

There's a methodology used in a shop in town called ping-pong pair programming. One guy writes a failing test, the other guy fixes it then writes his fail, etc etc. It's great because you naturally start being psychopathic.
Title: Re: A few changes..
Post by: Sidoh on December 10, 2011, 12:53:45 pm
buh.