Confident Ruby is Finished, and Avdi has three sample chapters available, as well as three separate versions of the book (with various combinations of accompanying videos, digital versions, etc) for purchase.
I’m proud to say reading day, or reading weekend as it turned out to be was a complete success. I managed to read through all of Clean Code: A Handbook of Agile Software Craftmanship, by Robert “Uncle Bob” Martin and I have to ask, where was this book at the start of my project? Forget that, where was this book at the start of my career? Most books will teach you how to write software that works. Some books will teach you how to test that software. This book will teach your software how to behave in the real world, to use proper diction, maintain posture, and not wear white after labour day.
In Clean Code, you learn some of the fuzzier un-written rules for the “science” of software development. Rules like how to comment, how many arguments are used in your functions, what those functions should do, or not do.
All of these rules are followed or broken in the service of a very strong set of basic unbreakable principles.
Your code should be readable.
It should be atomic, meaning you should be able to take it apart and fix it without breaking other parts of the code.
It should work.
It sounds like common sense, but it the gravity of deadlines, budgets, and non-technical managers, it often gets filed under “I’ll do it later”.
You might be intimidated by some of the knowledge in this book. Some of the code samples are kind of obtuse, and you might understand them the first time through. Read it again then. If that doesn’t work, go to cleancoders.com and buy the screencasts of any chapter you are unclear on. If nothing else, you’ll realize that this kind of knowledge exists which is the first step to cramming it in your brain.
Now, for today’s work on Gameplaydate.com. We are almost through the main three user verbs I have on the front page. We can now add games and personas to our user profiles. We can find friends through a paginated list of users. Now, we need to make sure users can accept or refuse event invites. Once that’s done we’ll have a very basic version of the site on hand. From there, I’ll start on one hell of a refactoring and then begin to refine the user interface.
I’ve decided to give this scrumcast a little bit more production value, so I’ve got a sweet headset now, and I’ve upgraded to the latest version of screenflow instead of just using the mac photo booth app. Now, not only I can easily show my work onscreen, but I can also do this…and this…and even this…(Man, I hope that doesn’t take much time in post). But anyway. Yesterday, I spent a lot of time on the more mundane workings of the app. I added a persona table to the database which keeps track of each user’s player profile that they want to share with their friends. I also made it possible for administrators to enter game profiles on the site, and gave users the ability to claim these games through a join table. Today, I’m going to try and streamline the routes and hopefully refactor some of these functions into single pages.
Once that’s done I’ll take a look at the front page of the site and try to design the user experience from there. So far all I have is my awesome marketing copy in one of twitter bootstrap’s stock layouts. When the user signs in, I want them to immediately know what to do, so I’m going to start off by depicting the main user verbs: Completing your profile, finding your friends, and hosting events. Once that’s done, I hope to create a better database population script so I can fill out the layout with the kind of data I need to test it.
Happy Monday, fellow scrummers! Since the last meeting I’ve been working on getting the site’s persona system working. That’s where you enter the details of your online character or persona into the database so your friends can find you when they decide to try out your favorite MMO.
I kind of did a bad thing. I used a generator to create it, and not just any generator, Ryan bates’ nifty generators! They created the model, the controller, the view files, as well as a nice battery of rspec tests. And it was… Nice! It doesn’t do everything I needed it to do, but I feel like I got a lot more done than if I simply started from scratch.
There is a grand body of programming literature that tells you to not use generators, and with good reason. You might spend more time on the details because it is not your code. You may be hobbling your skills by relying on a framework that you didn’t write. Hell, the way some programmers talk, I shouldn’t be using rails at all. My site should be written in assembler, uphill, in the snow, both ways, and optimized for the altair 8800.
Now, I consider myself a writer. I’ve written comic books, plays, television pilots, and essays in my spare time. I don’t think I’ve quite got the hang of the haiku that is high-impact ad copy. Okay, so the front page is one paragraph describing the site overall and three subheadings about the features because, well good things come in threes. It starts off…
Welcome to Gameplaydate.com! This is the Gaming Network for Parents, Professionals, and other busy people. Get the most out of your gaming experience by scheduling meet-ups and keeping all your profiles in one place!
Not bad, concise, succinct, but, just okay overall. Maybe it’s too long, maybe the verbs aren’t strong enough, I’m not sure. But the sub-headings are where I’m really having trouble.
Heading 1: Schedule
We love playing games, but we also love keeping the rest of our lives in order. Schedule your online time so your friends know when to meet you.
Because if there’s one thing we associate with having fun, it’s a schedule. The mere thought of all the meetings and tps report deadlines on that schedule just gets your nerves a-janglin’ doesn’t it?
Heading 2: Plan
Keep all your profiles in one place so your friends know where to find you.
Oh, There’s no kind of fun like expected fun, is there?
Heading 3: Have Fun
Because you’re playing with your friends, there’s no need to be harassed!
Great, there’s some wonderful association there! When you think of Gameplaydate, think of that 13-year-old who told you to get back in the kitchen on Halo
In my own defence, I did toss this off while trying to have a debate about PRISM with the guys at the Ruby Brigade, but Marketing not as easy as it looks.
When I finally, finally get the app uploaded, it crashes. No Errors, no nothing, just some text in the log displaying the rails/server command and the app crashing on the very next line. How helpful. It turns out that I needed to regenerate the ruby executables using rake rails:update:bin. Oh and don’t forget to precompile your assets.
Anyways, now for something completely different. My attempt to re-introduce multiparameter attributes to Mongoid was rejected as a wont fix. The developers thought that it was entwining the view code with the database and that code simply could not be written well. Which really doesn’t help anyone who wants to use a date_select box when building their app.
Fortunately, another developer called Matthew Doza took the code I wrote for Mongoid and made a gem that re-adds multiparameter attributes. It’s called mongoid underscore multiparams and you can find it on github. It just goes to show why so many developers use open source. If somebody doesn’t like your changes, you can just take your code and go play somewhere else.