Category: Uncategorized

Comment left on the Register about Kindle stats

http://www.theregister.co.uk/2010/12/27/amazon_holiday_sales_stats

It works and comparing it with an iPad is silly, it costs less than a quarter of the price. I was interested in an iPad for reading stuff (have actually read a ton of things on my old iPhone) and the Kindle made economic sense.

Kindle will also do a Steven Hawking reading thing, which I plug into the car. Not brilliant, but means I’m still doing useful stuff when commuting.

Also switched to an HTC Desire, because it just works and has buttons with labels on that say things like “back” and “menu” instead of having to guess where the app has buried them in the user interface. Plus I can check my diary, twitter and email from the desktop without starting an app. When the new Android 3 devices come down the pipe, costing around £200, I’ll probably get one and be able to do about 10x more than the folk with iPads. Then I will give the Kindle to my other half.

Grateful to Apple for breaking the network’s monopoly and assumption that their users are stupid, but moved on. Also moved on from O2’s non-3G 3G and 500MB tariff to T-Mobile 3GB standard package. Plus the hassle free MiFi that’s built in, so I could use the phone with the Kindle … hmmm.

Imported Comments:

Chuck J Hardy

Kindle + iPhone 4, yet agreed

Agile Heart: 1st Essay: What is Agile?

This is the first in a series of essays about what it means to be an Agile Practitioner, at least from where I stand. Agile has a venerable history and started from a sense of dissatisfaction with existing practices and methods. I’ve heard lots of people say that they’ve “done Agile” and it didn’t work. I overheard a project manager saying that it doesn’t work, or only works in certain situations, to the sage nodding of the guys around him.

I wanted to shout oh yes it does!

But there are a lot of things it isn’t:

  • A set of rules
  • Diagramming conventions
  • No documentation vs too much documentation

What I’m reaching for here is that it’s a state of mind. This is hard to explain to people. In essence you can do what Burger King once said to Tom Peters Even when we did it right the first time it was still pretty average.1 If all you do is follow procedures, treating people (particularly that stubborn breed of cat called a Developer) like they can be programmed then you get something that is really average, the sum of mediocrity. Sure, it will probably work, but be buggy and poor – so what? 

Agile started as a movement when a group of practitioners got together and wrote the  Agile Manifesto2. In essence, put the customer at the centre of what you do, and have an approach that lets you change your mind easily without lots of documentation and other things that create inertia:

  • Individuals and interactions over processes and tools
  • Working software over comprehensive documentation
  • Customer collaboration over contract negotiation
  • Responding to change over following a plan

That is, while there is value in the items on the right, we value the items on the left more.

This has practical implications for anyone who wants to write software, or do anything involving thinking and planning with other people. One of the eye openers for me was where the principles section of the site says Welcome changing requirements, even late in development. Agile processes harness change for the customer’s competitive advantage. This meant that change is not the enemy, a feeling that had been driving me on for a long time. It also means that change requests are not an excuse to charge exorbitant sums of cash. I had worked on projects where you walked into a room the size of a football pitch and saw a number of people in a dozen teams (one project I worked on had 200 people in “the room” and didn’t include another 50 or so in portakabins outside and dotted all over Europe). You knew you were doomed when you walked through the door. The enemies of productivity, of getting things done, are (in no particular order):

  • Bureaucracy – documentation for its own sake
  • Large teams with no focus – documentation as a poor communication medium
  • Process replacing understanding – documentation, anyone?
  • Meetings “explaining” (i.e. mandating often inappropriate) architecture – pictures and discussion about fit, anyone?
  • Meetings about meetings (this does happen)
  • Unfocussed lone consultants on site saying “yes” to the client but not feeding anything back3
  • Progress reports when the project is less than a day old – “it’s procedure” (oh, F-off)
  • Whole team meetings stopping coding
  • Meetings that could be summarised in a two paragraph email
  • Control freak meetings (as in you have to explain things to someone senior who won’t understand what you’re doing over and over again) – these are also sometimes massaging the Project Manager’s ego meetings.

If you want a refreshing take on meetings, read Rework4

You can get things done with a traditional large team (or in practice set of teams mediated through yards of documentation and meetings) but it’s hard to do well, and expensive too. I used to work for the database company Oracle and we were very good at delivery (then, no idea if it’s still true). On site we would always do our best to make sure that we left the customer with something they could use. A common complaint from the on site team was that you’d spend the first four months of a six month project writing about what you were going to do in an incomprehensibly boring pile of document templates generated from Microsoft Word macros (the macro suite was called Oracle Method, funnily enough). Piles of words on top of each other, with the occasional code fragment – sometimes there were so many code fragments you could  have pasted them in and probably had some working software. I remember starting a rebellion and putting some before and after pictures in the documents and losing several yards of verbose technical text that people who didn’t have English as a first language would really have struggled with (and there were lots of them). It followed the utterly mad waterfall (don’t forget that each of these phrases has the words and sign off at the end – usually four signatories):

  • Functional specification
  • Technical specification
  • Design document
  • Implementation document
  • Some code actually gets written
  • Unit test documentation
  • Functional test documentation
  • User acceptance test documentation
  • System test documentation
  • Fluffy cloud documentation
  • Finally we can go home and cry documentation (ok, I’m being silly now)

If something has been signed off then you have to go into Change Control – oh, the pain, the meetings about nothing. The cost!

We rebelled and merged functional and technical on one project. This saved us over a month of elapsed time. Consultants (or at least their management and sales force) and governments (tasty bureaucracy, yum) love this approach because you can bill for it and it looks like you’re doing something. But you aren’t. It’s bullshit business (as in busy-ness) and doesn’t get much useful done. One of my colleagues said: I didn’t join Oracle to spend all day using Microsoft products. This was terribly funny, because Oracle corporately saw Microsoft as the enemy, the devil incarnate, and yet they’d invested in this sub-product written in Word Basic that generated all these templates and employed people as auditors running around making sure they were being used. I’m finding it hard not to write swear words here, it was unbelievable, it was insane and we did it because everybody else did it. Did I say I joined Oracle from working at KPMG Management Consultants? This is not a critique of Oracle, it’s a critique of everybody around at the time. When all you have is the Waterfall approach then everything turns into one.

So I read the Agile Manifesto as a breath of fresh air against all this crazy shit. And yes, shit is the right word, honestly.

There was some confusion in my mind because I was switching to using Object Oriented techniques, e.g. learning to write use cases and follow slightly less crazy methodologies like RUP5 – which is still mind-bogglingly bureaucratic and was bought by IBM (surprised???). RUP has some good things in it, like the artefacts (i.e. documents of one form or another) are not mandatory and you pick the ones that work for your project. Also you do a risk analysis on project inception and do the risky things first, this means you can make sure you deliver something useful or, worst case, discover that you can’t deliver anything within your budget before spending a ton of cash on failure. So it’s definitely better than pure consultancy-driven waterfall. I never really got into UML (oh, the UML, sorry) because I was already a hard-core user of Oracle Designer and, if you start from the database like I was taught UML is an inferior way to describe relationships (disagree if you want to, like I care, honestly). UML works well in those insanely large projects with bazillions of dependencies and abstraction layers, but of course that’s where it came from.

Thing is, in 2002-3 North West England, as an Oracle PL/SQL specialist learning and getting certified in Java, it was impossible to find people who were using Agile. Whether it was XP, Scrum, Kanban, or roll your own. So I made an agile approach of my own work, questioning documents where code will do and drawing pictures instead of using lots of words. Wherever possible delivering working software. Testing software in the crucible of real people actually using it. 

I switched to using Ruby on Rails (RoR) after falling out of love with Java. I think Java is a language tailor-made for bureaucracy: curly braces everywhere, endless cruft from limitations of the language, no syntax for common stuff, use yet another class in the standard library, lots of useless layers in J2EE, “agnostic” approaches that mean configuration options coming out of your arse, 20-minute Ant builds, strong typing, everything verb has to be wrapped in a noun – no wonder corporations and consultancies love it, the bloat is built in right from the start. Again, Ruby set my mind free to worry about delivering working software. The other thing from RoR is I caught the test-driven bug. I tend not to write software without tests anymore, at least for production code. I’m not sure how purist Agile this is, except that it allows you to change your mind without breaking things which is a key need for Agile thinking. I recently put one of my own projects on pause while I got the tests working after migrating to Rails 3. Yes, it cost me a couple of weeks part-time, and no, I wasn’t going to compromise.

I also like RoR because it starts from the database. Code is built using generators, and some tests are also built in. But you start from a data-centric place. Not some pretty design done by a designer, but from the data. I believe that working software comes from data. As in, understanding the data flow means you understand the business you’re working with. But on the other hand, I’ve also worked with beautiful data models from Oracle Designer Generator that created software you couldn’t use because it was technically correct but very hostile. As usual the middle way (which appeals to me as a committed Buddhist) is the most sensible one. Rails makes it easy to find the middle way between data and design because it doesn’t sweat the simple stuff, and lets you be very strict about how your model is used.

So, I will move on and start the next essay in this series in a few days. Talking about the Agile heart, as against the Bureaucratic Tendency – you can measure bureaucracy so it’s popular (ISO 9001 certified shops take note). You have to do agility, and think, and care about what you do and how your customers feel, so it’s as much a feeling as anything else. A feeling that leaves your competitors behind, though.


1 Tom Peters Circle of Innovation, 1997

2http://agilemanifesto.org

3 Anyone else worked with Earnst and Young back in the day?

4DHH and Jason Fried, Rework, 2010

5 Rational Unified Process. Methodology used to sell the Rational Rose modelling tool. I think the Rational was dropped when IBM bought it.

Imported Comments:

Ralf Westphal

Being agile as a state of mind. Yes, I guess that´s it. Even though I call it a lifestyle I guess we mean the same: agility is not something you switch on while you´re in a software project meeting.

I see a lot of people claiming to be agile – and when they´re buying a coffee machine they browse the internet for hours, read reviews on end, check every store in tone to know exactly what´s the best offer. To me that´s a contradiction and I always wonder how agile their projects really are.

If someone claims to be agile and it does not show every minute of his life… then something is missing.

As for “As in, understanding the data flow means you understand the business you’re working with.”: That´s a great observation. But I´d like to ask: And then? What do you do once you see the data flow. How do you get from there to code? By translating data flows into domain object models?

-Ralf Westphal
http://geekswithblogs.com/architectsnapkin

Francis

Thanks for the comment Ralph!

I agree the data flow comment isn’t very detailed – it was more of a
reaction to when I see designers go mad with half understood
requirements and we end up with a mess. The data flow, for me, always
tells the truth. But then I’m an old database hacker 🙂

first post from my new phone

I just got myself an HTC Desire and logged in here It’s interesting how I feel more comfortable using it compared to my now pretty crusty iPhone 3G. Still a bit laborious to type anything long on it but I think I’ll get up to speed quite quickly.

I’m tired of being led – student fees, lies and politicians that can’t count

Leadership

I think less that 20% of the UK population approved of the Iraq war (the Afghan one was unavoidable after 9/11, so let’s leave that out of the discussion). At the time there was a lot of hocus pocus where Tony Blair was said to be taking an unpopular decision for the right reasons and people need to be led in times of crisis. This is code for we don’t give a shit what you think, we’re going to do it anyway – something politicians do lots, but they use code to make it hard to see.

The problem was there was no crisis, and we didn’t need to be led anywhere. The weapons of mass destruction weren’t there, and Saddam, armed with the best former-Soviet technology money could buy, may as well have been waving sticks in the air and banging rocks together for all the good it did him in the end.

Now, however, the political class are trying to run away from their responsibilities. There was no popular movement that could have been helped to create a democratic government with the backing of the Iraqi people, so the coalition had to invent one. If they hadn’t run away at the end of the first intervention then there would probably be a democratic government there that was pro-Western, but they were cowards and didn’t do it. Now, of course, years later, there are a lot of other vested interests that don’t want a stable Iraq and don’t trust the coalition – but who can blame them, after what happened?

If we withdraw, then all those civillian lives, all those brave young men and women who fought for the coalition, all those deaths, all that suffering, will have been for nothing, There will be a blood bath. Now we need to be led, the politicians need to be brave and say uncomfortable things like we were wrong to go in there, but now we have duty to all those who suffered and died to make it right and stop the bloodshed. But they want to run away because that’s what’s easiest.

I’m tired of being led, and I’m sure I’m not the only one. And the running away afterwards, shirking responsibility, makes me puke – it’s an insult to those who have suffered.

Stop pretending to lead us, because you aren’t, and try listening to us.

Student fees

Please, can someone who can count past 10 without having to take their shoes off tell me how raising the fees (which get paid back after graduation if the graduate earns more than a certain amount) will make even the tiniest bit of difference to the deficit now? No significant amounts of money will flow back into government coffers for probably at least 5 years. Who has any idea what state the economy will be in then? The entire argument is bogus and innumerate. No-one is asking this question. If students were paying the fees now, so the government weren’t having to fund them then it would make some sense, but in fact it’s a political thing about not wanting free (or at least subsidised) education – the deficit has nothing to do with it. The deficit is a smoke screen and they should be called on it.

The other thing, which follows on from the last section, is everyone moaning about violence in the students’ protests. Well, matey, we’ve had 25 years of peaceful protest when we were ignored – none of the protesters are stupid enough not to have noticed this. What the hell did you expect? We have a government without a mandate putting up the cost of education without listening to anybody, one half of the coalition signed a pledge (which was in case they were elected remember?) that they would look to abolish the fees, not double them. I think we’re all entitled to be extremely pissed off, and no, don’t try leading us here either. You are full of shit and you haven’t got a mandate – all 3 parties lost the election. So tread with care and be careful not to piss off the 60% of the population who don’t like what you might be trying to do? Too stupid.

If you don’t start listening and actually changing things the 1980’s will look like a dry run.

And Milliband isn’t being an opposition, he’s just waiting around to be elected. This has also been a problem for the last 25 years, or perhaps even longer. Grow a spine, man.

Fun with Cucumber and ActiveRecord after Rails 3 upgrade

I was using Rails 2.3.4 (2.3.10 wouldn’t do logging in as a different user for some annoying reason).

In my data model a story can have many fragments (which in turn can have many gates out)

I had an idiom where I was forcing the ID’s of things to be something I knew, so I could do things like this in my cucumber scenarios:

  Given story 1 exists
  And story 1 has fragment 1
  And I am on story 1 fragment 1
  And follow "New Gate"
  Then I should see ....

This used to work. I had a helper in my web steps that looked a bit like this:

def create_story(attribs)
  force_id = attribs.delete(:force_id)
  story = Story.new(attribs)
  story.update_attribute(:id,force_id) if force_id
  story
end

Plus a similar one for the Fragment. This doesn’t work any more, even though the update_attribute method returns true – it just doesn’t let you update it. Neither can you force the id when you create the record. This is probably a good thing, to be honest, in the general round, but for creating test data it’s a complete pain.

So, how to proceed? I was already creating the stories and fragments with titles like test story 1 anyway. So, instead I use the names of things to get what I want:

def get_story desc_id
  Story.find_by_description("test story #{desc_id}")
end
def create_story(attribs)
  Story.create!({ :audience_classification => 1, :story_classification => 1,
                  :owner_id => @current_user.id, :originator_id => @current_user.id}.merge(attribs))
end
When /^story (.*) exists$/ do |desc_id|
  @story = get_story(desc_id) || create_story(:description => "test story #{desc_id}",:narrative => "narrative for test story #{desc_id}")
end

And the same for the fragment too, finding the story by its name and then creating the fragment for it alone. This turns the scenario above into the much more natural:

  Given story 1 exists
  And story 1 has fragment 1
  And I am on the list of stories
  And I follow "test story 1"
  And I follow "test fragment 1"
  And follow "New Gate"
  Then I should see ....

Instead of jumping straight to the page where I want to test I have to do the navigation and press the named links. I think this is better in the end.

Decided to work on non-software project for a while

I started a comic novel GRTZ way back in the day and have been thinking of adding some more stuff to it, and working on it for a while. I need a break from doing software in the evenings because I can’t concentrate on it.

Here are the existing chapters:

Have a peruse if you want, I will be posting more over the coming few weeks.

New stuff

I suppose this is chapter 3

Imported Comments:

Laurel Wingfield

I enjoyed this. I liked the tone of irony, the ring of reality, in that the Big Corp running the operation were trying to do the whole thing as cheaply as possible, the idea that humans can take the desirable qualities of some animals and use them to modify and augment themselves, and the tongue-in cheek humour.

I found the writing style a bit rough-and-ready, but once polished up and completed, I think this would make a very entertaining novel. It has a sort of ‘Starship Troopers’ ring to it, with a grim humour which might appeal to fans of ‘Firefly’ or ‘Blake’s 7’. It would be difficult to find a publisher who would be prepared to accept this, though, with so much competition out there.

Francis

Thanks, Laurel. I have a huge, far too serious novel I could send you if you want… 🙂

Ruby and Rails 2010: Corey Haines

Thoughts from Software Craftsmanship

Corey Haines

Pair programming started in 1946!

Definitive source of information – googlefight. Says it’s good.

TSA – top secret information. Kept erroring out.

Travel visa for Australia – rejected for a Visa

New term Softwared! Follow Glyn Vanderberg – glad I’ve got the skills feel sorry for the folks who don’t. @glv

This is US!

All written our fair share of things we didn’t test. We’re the ones who are creating all the crap that doesn’t work.

SWC manifesto. Make the world a better place for the people who aren’t developers.

Career ideas – become better at what we do. Business software and web apps aren’t hard but you have to pay attention to the detail.

Alan Kay OOPSLA 1997 talk. Air force tape. Everyone came up with their own formats. Beginning of tape has pointers to code that has the read and write routines. Didn’t have to write code to read any more. All of these ideas slowly started coming in over time. Combined together.

Bruce Tate – most people have never done non OO. Interesting idea most people don’t know what it was like not doing OO.

MongoDB – Document DB – new hotness. .Net only talk about Mongo. Lotus Notes, schema less. Awful job of email. Nothing new about Mongo – had document databases for a long time.

Cuke – inspired by COBOL!

Looking back at the tools can sometimes give us useful insights. Quote: older a program gets the more valuable the readability never hear that this is the value of cuke.

Relishapp.com – all the documentation for rspec. How to use Rspec. Relish takes cucumber features and generates documentation – all doco in the cuke scenarios. If they’re green that’s how rspec work.

Not just code, systems we use. Techniques come from who taught us. Wing Chun teacher focused on interactions between people, fluid interaction. Influenced development style, focues more on interaction – behaviour-oriented. Don’t know where you came from not going to be able to build effectively.

Uncle Bob.

  • Professionalism
  • Design techniques
  • Abstractions

David Chelimsky

RSpec Maintener

  • Care for code
  • Testing techniques
  • Naming

Attention. All of these things very imprtant to him

Continual learning. As we go through our careers always going to have new stuff to learn. Also improtant to get better at what you already do.

Cratsmanship-oriented career model. Don’t spend a lot of time learning from those around us, new people. Just stick with what we know. Feeding the same techniques.

When studied with teacher did what was asked – do what needed to learn, not blind. Respect the person enough to trust that what being taught works. Once studied and become effective, stable point in your career.Most people have other people around them that you can work with, user groups etc.

Knowing what you do know and practicing stuff you don’t : Deliberate Practice

Focus on performing. What would you do if you went to see a band who only play instruments when they’re on stage, but we do it every single day. E.g. write and delete/rewrite? The things you know you should do. Practice – minimise the difference between “get it done” and “do it right”. On stage, you want to just play.

Practice Techniques

Outside of getting it done.

  • Code Kata
  • Dojo
  • Retreats

Randori style. All attack one person and they defend themselves, two people, crowd and then swap one at a time. Get to watch and get to do a little bit. Wonderful. User groups. Pick a small problem.

Kata. Originally Dave T small problems, but broadened out martial arts – a solution. Over and over again, don’t alter them, the goal is to make the motions perfect. When the time comes you won’t be slow. Kata in software, small solution, e.g. string calculator, roman numerals. Solve it. Then do it again, again, again until you don’t have to think about it. Techniques you use will speed you up in day to day work, e.g. flatten array.

Performace Kata – learn it and perform it. At the end feedback. I noticed you did this, better if did that Lots of katas online. katacasts.com

Code retreat. A day where we work on specific problem, e.g. game of life. 45 mins, delete, swap. Can’t finish in 45. Pressure goes away, so look at the process & write perfect code – problem takes too long. Throw away idea of even finishing.

Practice

Being better. Not just the new Gem/DB/banana about being excellent. Fundamentals of s/w development the heart of s/w craftsmanship

We have the greatest job in the world

Get paid to do things you enjoy.

(Except maybe fighter pilots)

Comes down to happiness. Be happy every single day. If we enjoy what we do then everyone will want a piece of it.

Not going to convince anybody without being happy. People want some of that.

Ruby on Rails 2010 notes part 2

Concurrency: Rubies, plural

Elise Huard

Moore’s Law finally hit in 2002. Multiprocessor response, plus non-uniform memory access. Important to be aware of concurrency.

But … forget all that (mostly)

Concurrent programming != parallel computing

Thread level paralleism vs instruction level

Not orderly more like a stream of cars on a busy road that soldiers in lock step.

Scheduling

  • Preemtive → told to yield
  • Cooperative → thread yields control

Threads are the unit of execution. Process container/memory space of one or more threads. Context of thread.

Ruby

Process

  • 1.8 green
  • 1.9 Native threads MRI 1.9, Rubinius

MRI: GIL

Global Interpreter Lock

Only one thread executed at a time, scheduling of threads fair. Main and time. Blocking region to allow limited concurrency. (Blocking IO driver)

Other Rubies

Parallel quicksort

Easy to parallelise, put each tree in its own thread.

Multiprocess

Separate state
disadvantege overhead to cpawinign & context switching

Ruby: for and IPC: IO.pipe Mmap

DRb

Fibers – not parallel. Cooperative scheduling, coroutines – passing between fibers at same point.

MVM

Rubinius – VM per native thread. Looks out of date now and not supported?

Shared state will melt your brain

  • non-determinism
  • atomicity
  • deadlock
  • livelock
  • fairness/starvation
  • race conditions

Actor model

named actors: no shared state – asynchronous message passing fire & forget

CSP

Communication Sequential Processing

  • Process calculi
  • Events, processes
  • Synchronous message passing (rendez-vous)
  • named channels – dual to Actor model

Languages

  • Erlang
  • Clojure
  • Go (CSP)
  • Haskell (several)
  • Scala (Actors)

Ideas

  • Functional programming – no side effects, immutable data
  • Nothing shared
  • message passing

Erlang

  • Actor model: Actors, asynch message passing
  • actors = “green processes:
  • efficient VM (SMP since R12B)
  • high reliability

Rubinius

  • Actions in the language, threds with inbox
  • VM actors (not working at the moment)

Ruby: Revactor

  • elrang-like senatics: actor spawn/receive, filter
  • Fibers (so coop scheduling)
  • Revactor::TCP for non-blocking

Go

  • Fairly low-level fit for systems programming
  • static typing
  • goroutines: parallel execution – sort of async lightweight thread
  • channels (sync named)

Clojure

Functional, lisp-like

Concurrency, Sottware Transactional Memory system

  • Vars = variable state is thread isolated
  • Refs = shared, and mitation within a transaction (atominc. consistent, isolated) – Multiversion concurrency control

Ruby: STM

  • @mentalguy

Kernel stuff

Some of these problems have been solved before.

http://www.delicious.com/elisehuard/concurrency

http://github.com/elisehuard/rubyandrails-2010

Rubinius

Dirkjan Bussink, Nedap

1.1 is out! Bug fixes, block inlining, new debugger API and included debugger as a reference, improved GIL (used ideas from Python 3.2)

2006 Ruby interpreter in Ruby, is it possible to write more of Ruby in Ruby?

2010 1.0 release

2 virtual machines (3 if you count the 1st VM in Ruby) new VM in C++ better fits Ruby’s model from C++

1.75 garbage collectors

3 bytecode compilers (based on MRI parser)

1 Ruby core library

2 primitives systems – call into VM to do work for you

JIT compilers

Rubyspec

Create a reference for Rubinius and create in Ruby.

Memory

Compacting garbage garbage collector
Generational – long lived objects out the way not scan every object every time

Fast workers die young

Instance variable packing, keeps track of instance variables used in compilation

JIT

InlineCache – simple technique, remember where method was found. But need to invalidate caches if class has been changed. Method calling much faster than MRI. Counts how many times you call the method, and looks at chain of calls. JIT using LLVM – intermediate representation (IR) assembly language for LLVM.

Debugging

Debugger.here – shows backtrace, disassemble into bytecode

The awesome backtrace, proper alignment, different colours for what kind of code

Profiling

Measuring is knowing and guessing is often wrong. Runs twice, warm up to get inlining and optimisations. Profiler graphs too so that you can trace why things take time when they don’t in isolation.

Contributing

One patch accepted == commit access

Rather have a policy of being very open.

rbx my_awesome_code.rb

Future

  • 1.9 support new Hash syntax, encodings
  • Windows support
  • Hydra GIL removed

Audio Synthesizers

Jeff Rose, Sam X

Clojure. Serge modular synth

Modules/patch cables/no save button

Software synths like Circle – can’t get into the guts and rearrange things. Visial programming analogues. Finally found SuperCollider – own language based on Smalltalk. Getting into clojure, connect it to back end audio engine of SuperCollider …

Generate music / hack. Representing a waveform as arrays of numbers and manipulating them. Software – sound card DAC takes sample values and makes smooth waveform. Voltate corresponds to position of an electromagnet.

Crash course in Clojure …

Overtone – library around SuperCollider API

Compile synthesiser in terms of DSP units and function you can call to trigger it.

Live coding session followed. It was ok for a while.

Ruby on Rails 2010 notes part 1

Mildly incoherent, but here they are:

Culture of Testing

Jon Yurek, Thoughtbot, @jyurek

Testing & version control not taught in school, no reason not to. Java testing getters and setters – insane. Culture of Ruby is to test/TDD.

  • Coming of age blog
  • Then framework

Contrib factory_girl/shoulda. Out the box very limited. Then we found cucumber. Didn’t like at first, but then having a story. 2009 Rumble – pure cuke. Can’t test with just cuke. Fakes – sham-rack. Tiny apps that can run basic API hits. Outside-in the way forward.

Don’t write integration tests like unit tests – cuke stories are not supposed to be code.

Steps not just long-winded method calls.

Don’t have time to test – it will make us faster. Technical debt – won’t be able to refactor or add new features. But if you really need to, go ahead. Once done, and calmed down rewrite it the right way headaches down the line.

Working with the unknown – write stuff to find out what the approach is. Understand problem and then throw it away. Experiments, toss them out. Weren’t writing your best code in the first place.

Code is communication, tests even more so.

Tests are also tests – tests are first client for app. No-one will know how to change, cargo culting. Tests will tell you what the coder was thinking.

Look at tests first.

RSpec & Shoulda have very few watchers on github.

Everybody’s testing, just not very efficiently.

Use the scientific method hypothesis/test/control/results Profit!

Hypotheses – Greatest challeng to any thinker is stating the problem in a way that will allow a solution Bertrand Russel

Test explicitly exposes solvable problem and confirmation. Harder than writing a solution. More time,

All testing in some sense – switching over to TDD – make code better.

Black-box testing. Outside in, refactoring should make no difference.

We owe it to ourselves and our profession to prompte automated testing. Having this culture.

Crazy ideas would like to see –

  • Javascript in Ruby (exists, but crazy).
  • Automated tests for HTML/CSS
  • CPAN tester network for gems

Good testing ==== public shame

Won’t run gems without tests.

Tests are professional – respectful enough of their code to document in code.

All work in topic branch – git pull requests. Code coverage done through review.

Git the stupid NOSQL database

Rick Olson

Github use it more like a database.

git hash-object

(what?)

Send some JSON into a file and get it out again – crazy.

Git also a graph database – Nodes to nodes

Tree – subdirectory of blobs

git update-index
git write-tree

commit-tree

refs (not an object, a tag/pointer)

tags

2 types – lightweight, branch pointer to sha, annotated tags object that points to a commit w custom tag message who/when

gem install grit
gem install gollum

Local wiki clone of the one in git

Hmmmm – git grep

Latest files updated atom feed

diff-tree —name-only master~10 master

Need to know how many commits or will errir

Gollum suited for small to medium projects.

Smoke is grit on the cloud – proxies out to Erlang services.

Rails Admin, The right way of doing data administration

Bogdan Gaza, @hurrycane

Rails Admin Ruby Summer of code 2010

Way you organise & control your data

Admin panels – PITA

Simple, secure & fast – custom error prone not fast or simple.

CMS? Simple but not always flexible. Rails Plugin/engine, usually secure fast & simple

Choices:

  • lipsiaAdmin (R2) ExJS
  • Active Scaffold (R2)
  • Hobo (R3) includes a lot of non-admin stuff

RailsAdmin sferik/rails_admin

Port Merb-Admin to R3. Merb slice/R3 engine, structure pretty much the same.

Engines similar to plugins, but work like Merb slice.

Namespaced controller/model/routes. Mountable app outside Rails structure

gem ‘devise’
gem ‘rails_admin’, :git => ‘git://github.com/sferik/rails_ad,in.git’

bundle update

rails g rails_admin:install_admin

Not using devise? Override or use another warden-based solution.

authenticate … and current_user

3.1 it will be mountable.

Automatically adds history and search

Will be the admin panel of choice in future.

Seecodez – a code review manager

Seecodez is a project I’m working on in amongst the million other things I’m doing at the moment. I’ve decided to set up a Rails 3 project on my little Evo machine that I can take with me and work on when I’m waiting for things. I use the Evo rather than my MacBook when I don’t want to lug the damn thing about or worry about it getting stolen as the Evo only cost me a few quid.

It’s interesting but you can run Ruby 1.9, Rails 3, Emacs and Google Chrome on an old Pentium 3 with 512MB RAM. It’s not particularly slow, but I am running Ubuntu and not some Microsoft excuse for an operating system.

Discovered that Rails won’t run without open SSL installed on Ubuntu. This is a problem I’ve been through before with Ruby 1.8.6 about a million years ago.

Anyway, I’ve defined my first model. Now need to write some tests and start homing in on the functionality I want.

Progress of a sort.