func (x X) init() { x.foo = 1 }
func (x X) Control() { makeAChange(x.foo); return x.foo }Rule 3:
func (_ X) makeAChange(foo) { return foo + 1 }
Ed Sumerfield's musings. Life rocks.
func (x X) init() { x.foo = 1 }
func (x X) Control() { makeAChange(x.foo); return x.foo }Rule 3:
func (_ X) makeAChange(foo) { return foo + 1 }
Never write "catch (Exception e)" unless you can enumerate the reasons why it is acceptable.
A try catch allows us to intercept situations in our code flow that occur somewhere down a call stack. Generally associated with exception flow but not restricted to that concept.
Primarily talking to C# (or Java) Exception semantics but applicable to other languages to different degrees. An exception is a class that inherits from a based Exception allowing it to be "thrown" for later "catching" higher up the call stack.
The "System.Exception ("java.lang.Exception") represent the top of a hierarchy under which all exception types must be declared.
So this is where the problem starts. The following code is evil and should never be used unless you understand what the exceptions are (pun intended).
try {Because the class Exception exists at the top of the hierarchy all exception types created for the application or system types will be caught. For example, a catch Exception will intercept a NullReferenceException (NullPointerException) what should only occur for a coding bug and never in normal production flows. All exception flows should be handled intentionally using the specific thrown class only.
// do something useful
}
catch (Exception e) {
// react to problem
}
static void Main(string[] args) {These kinds of constructs would want to control situations like unexpected exceptions and log them for review. An exception that is not caught and ends up being thrown to the runtime may only be reported to standard out and perhaps be lost to anyone trying to determine why a program crashed.
var count = 2;
var running = true;
while (running) {
try {
Console.WriteLine("Hello World " + count);
if (count-- == 0) running = false;
}
catch (Exception e) {
Console.WriteLine("Unexpected error: {0}", e.Message);
}
}
}
try {In this manner all interactions will protect the management program and allow for positive feedback to the user or developer of the dynamic library.
var dll = Assembly.LoadFile("hello.dll");
foreach (Type type in dll.GetExportedTypes()) {
var hello = Activator.CreateInstance(type);
type.InvokeMember("World", BindingFlags.InvokeMethod, null, hello, new object[]);
}
}
catch (Exception e) {
Console.WriteLine("The DLL shouldn't have done that");
}
try {This means that all thread starting code should wrap thread entry points in a simple management method to ensure consistent exception handling throughout the application.
new Thread(MyThread).Start();
}
catch (Exception e) {
// This will not catch the threads exception.
}
public static void MyThread() {
try {
throw new Exception("Thrown in threads");
}
catch (Exception e) {
Console.WriteLine("Threads should report their exceptions");
}
}
We know that teams need to see the future and feel part of its creation. We talk to roadmaps and share in decisions that re-enforce our shared understanding.
However, we spend a lot of time "doing" because we think we have to. Teams only thrive when they understand the future and become part of creating it.
I think we humans have a problem expressing decent without recognizing existing value.
A system with invented boundaries, requires that people decent when the boundaries are breached.
A system with intentional boundaries requires that those boundaries are challenged.
The evolution of a flexible system is an interplay between the intentional rigidity of good rules and the intentional experimentation of alternatives.
Breaching boundaries is the clue that we are assessing the current rules.
Limiting change is not rigidity, it is the siting of theories that describe optimal flow, each of which requires proofs.
The problem is an old one; who decides what a development team should focus on next. Traditionally, we say "the business" but we know that product quality and technical debt can loose out. When does "the business" consider security important? Unfortunately, in todays tech world, security is consistently an afterthought.
I believe I have a solution, which stems from trying to understand the question. "Who decides the priority of a story" is the wrong question. It obviously depends on the story. Agile teams profess working together for a common goal, all skills sharing ideas, planning and implementing together, but we never said that everyone on the team knows everything or is skilled or knowledgable enough to make all decisions. Hence the team thing.
So the answer is "Allow prioritization within skill scope" or said more verbosely, "People with specific skill sets make prioritization decisions related to the scope of their skills and goals".
At the end of the day, everyone in the company wants the same thing. Lets make some money, using quality products that are stable and support the services the business sells all the time, and no one wants our products to be exposed to attack.
Story priorities must be defined in this sequence:
1) Production Operations Team
A development team is responsible for the building and delivering of quality products to production. They are responsible for ensuring they can perform their duties fast and efficiently and with zero defects.
Does it seem strange that the lowest priority group to set priorities is The Business? This was a revelation to me. I thought of it in a tribe retrospective a few weeks ago, when someone asked a simple question, "Why did we let ourselves create this problem"?I have noticed that the last few Ruby Conferences I have attended, Ancient City Ruby and Ruby Conf 2013, have not lived up to some of my expectations. This is not a fault of the conferences but of how I perceive improvements.
In the early days of Ruby, relatively speaking, when all the giant advancements were being made, like Rails, gems, migrations, rake, Capistrano and _why's latest ideas. I am sure we can all have our own lists of world altering ideas that fundamentally changed how we work every day. Some of this radicalization has waned.
I have been reflecting on how progress can be measured by tiny changes as well though the impact is slower and less measurable. For example, Jim Weirich works on Argus and, then Artoo changes how we approach Robotics in Ruby. Independently they are simple API's, but that simplicity becomes a fundamental driver of adoption and the growth of new ideas.
John Mair works on an improved Ruby shell and that simple improvement drives some re-birth of Small Talk ideas. What I can edit and interact with code at runtime? Small Talk got to where it is for many reasons both good and bad, but what will happen when we re-grow the good ideas into something new?
For me, I am going to pay more attention to the micro-drivers of our future. Keep it simple so that we can all be part of the growth.
Ruby is creating a thrilling world.
describe "Game" do
let(:player) { Player.new }
it "plays empty board" do
game = Game.new(" >")
game.play(player)
player.should be_alive
end
it "rescues a sad caged pair of eyes" do
game = Game.new(" C >")
game.play(player)
player.should be_alive
end
it "attacks some sludge" do
game = Game.new(" S >")
game.play(player)
player.should be_alive
end
end
class Game
def initialize(pieces)
@pieces = pieces
end
def play(player)
warrior = Warrior.new
warrior.board = Board.new(@pieces)
puts "GAME START"
while (warrior.alive? && warrior.on_board?) do
puts warrior.board.with_player_at(warrior.position)
player.play_turn(warrior)
end
puts "GAME OVER: #{warrior.alive? ? 'ALIVE' : 'DEAD' }"
warrior.alive?
end
end
It is clear that a solution to a problem like this can't just be imagined out of thin air. I am just not that smart. Just writing if statements was satisfying and productive to start with but once level 7 hit and I had to change direction there was no alternative but to throw everything away and start again.
This time, I decided to create a fake warrior implementation, an write some rspec tests to ensure that the actions I chose were appropriate. Then "release" (copy) that code to "production" (paste) to see if it worked there as well.
With this approach, I am making headway but can only solve level 2 because I haven't reimplemented the resting process yet.
class Warrior
attr_accessor :position
attr_accessor :board
def self.at_position_1
warrior = Warrior.new
warrior.position = 1
warrior
end
def self.next_to_sludge
warrior = Warrior.at_position_1
warrior.board = [:sludge]
warrior
end
def initialize
@position = 1 #zero based
@attacked = false
@board = []
end
def walk!
@position += 1
end
def attack!
@attacked = true
end
def has_attacked?
@attacked
end
def feel
@board
end
end
require './warrior_fake'
class Context
end
class Action
def self.choose(warrior, context)
if !warrior.feel.empty?
Attack.new
else
Walk.new
end
end
end
class Walk
def run(warrior)
warrior.walk!
warrior
end
end
class Attack
def run(warrior)
warrior.attack!
warrior
end
end
class Player
def initialize
@context = Context.new
end
def play_turn(warrior)
action = Action.choose(warrior, @context)
action.run(warrior)
warrior
end
end
require './spec_helper'
require './warrior_fake'
require './warrior'
describe Player do
let(:player) { Player.new }
context "walking" do
it "moves forward" do
warrior = player.play_turn(Warrior.at_position_1)
warrior.position.should == 2
end
end
context "sludge" do
it "notices sludge" do
warrior = player.play_turn(Warrior.next_to_sludge)
warrior.should have_attacked
end
end
end
describe Action do
let(:context) { Context.new }
let(:warrior) { Warrior.at_position_1 }
context "construction" do
it "walks forward" do
action = Action.choose(warrior, context)
action.should be_a Walk
end
end
end
describe Walk do
it "forward" do
walk = Walk.new
warrior = walk.run(Warrior.at_position_1)
warrior.position.should == 2
end
end
describe Attack do
it "forward" do
attack = Attack.new
warrior = attack.run(Warrior.next_to_sludge)
warrior.should have_attacked
end
end
I just ventured into the dungeons of the Ruby Warrior and spent an hour of my life that I can not get back, but would like to if that is at all possible. What a great time to be writing ruby, to program a knight, in a live dungeon.
class Player
def play_turn(warrior)
if !warrior.feel(:backward).empty?
if warrior.feel(:backward).captive?
warrior.rescue! :backward
@saved_captive = true
else
warrior.attack! :backward
end
elsif !warrior.feel.empty?
if warrior.feel.captive?
warrior.rescue!
@saved_captive = true
else
warrior.attack!
end
elsif warrior.health < 20
if warrior.health < @health
if warrior.health < 12
warrior.walk! :backward
else
warrior.walk!
end
else
warrior.rest!
end
else
if @saved_captive
warrior.walk!
else
warrior.walk! :backward
end
end
@health = warrior.health
end
end
It is easy to spot the symptoms in aggressive cases but can present in subtle ways as well. It effects individuals and teams and is communicable. The cure is long and slow but the young heal much faster. If you have been infected with this disease for more than 20 years, the chances of a full recovery is slim.
Symptoms
A programmer feels the strong urge to open a documentation tool before a code editor. This is not a guarantee of infection but a strong indicator.
Waterfall disease has been with us for decades. Until the late 1990's it was thought of as normal, even part of the best practice of what a programmer was. Only as the year 2000 approached and the new Agile medicine was introduced to the market did everyone start thinking that there might be another way.
This phase should not be trivialized. Your patients complaints will seem small and full of self-interest but they are one of the biggest drivers of resistance to the medication. Failure to attend to these details will initiate a slow drift back to habits that are more comfortable. Many retrograde steps will be subtle, almost imperceptible; a head turned to the floor during a standup, an extra second of reluctance to approach the board and be part of the team. The feelings of isolation, and failure will compound this situation accelerating the relapse.It has been a long time since focusing exclusively on writing Ruby code. So much fun.
The last two years have been groovy only which is a great language but there is something pure and simple about Ruby that just takes your breath away.
Enough of the emotional stuff, why, on earth, is it so hard to disable SSL cert trust verification. Such a common problem, google is full of Rails ActionMailer solutions but of coarse that doesn't help the rest of us.
My actual goal was to access a WSDL, over SSL, with an untrusted cert. This was not so easy. Took me about 5 hours to work out this solution. Expensive.
I used the Soap4R gem and since performance is not an issue I figured the dynamic proxy from the WSDL parsing would be the way to go:
The problem was that there is no simple API to set the verify_mode of the connection so you have to root around in the code until you find where to monkey patch. This is what I came up with.
If someone has a cleaner solution I would love to hear it.
Upgrading to 1.9.3 broke my Monkey Patch as expected so here is the updated one that handles both for the time being:
Ending with the demo of the charities new sites and the excitement on their faces as they looked up at the giant screen, was certainly the best thanks we could have received.

On October 22 through 24th we are running a Give Camp located in Southwest Ohio. Collect your project manager and developer friends and we will connect you with a team to help out a Charity for one weekend. This is a great way to use my professional skills for a good cause.
Registration opens TODAY at noon. Seating for this event is very limited and this event is going to quickly sell out. Do not wait - register today at http://cincydayofagile.eventbrite.com/.
What is Cincinnati Day of Agile?
As the Agile project management process sweeps across the software industry, businesses not understanding the details are being left behind. The Cincinnati Day of Agile is an opportunity to understand what Agile is all about and hear from people that have used it, succeeded with it and have the results to prove it.
At this one day event on Saturday, May 15th, a host of industry experts will be on hand to offer their hard won experiences. By bringing together a mix of developers, managers, Agile professionals, and technologists, the Cincinnati Day of Agile also provides excellent networking opportunities for its attendees. We hope you will join us to learn how Agile can make your software development process more effective, productive, and profitable.
More about the event can be found at http://cincydayofagile.org/.
A few months ago I completed my first Kanban project. The team was small and the introduction informal but it went well.
Background
The team comprised 5 people. A technical manager, 3 web developers and me. They managed many projects simultaneously which resulted in a great deal of task switching for the developers.
There were no detailed plans and few team planning sessions. The technical manager was able to keep track of the teams goals on the fly. As tasks and priorities changed, the team would be notified.
Three of the team members had experienced a full agile project in the past which resulted in the team continuing daily stand-up meetings. They stated that they wanted to continue using TDD but that hadn't persisted as strongly. While one of the developers had used TDD in the past, they did not use it consistently, and the rest of the team did not have any training on the technique.
Project
The project was estimated at 2 weeks and involved a UI replacement of an existing web application. A couple of minor business flows were going to change but essentially it was just large segments of the site getting new HTML/CSS. All HTML/CSS was developed by a 3rd Party design company so the in-house work was limited to verifying what was delivered and implementing the designs.
Process
We started with a little presentation on what Kanban is. Ran through some examples of how a project might be run with a focus on software projects. The whole team was in attendance along with a couple from other teams and a Director.
Feedback seemed good with statements like "We need something like this" and "I wish we could get all teams to do this".
From there we got the team together to chunk up the tasks and played Planning Poker to come up with some high level estimates on how long it would take. Each task was written on a post-it note and stuck on a white board in the left hand column ready to be pulled forward into the work in progress.
The columns we started with were:
o Backlog
o Work in progress
o QA
o Complete
Even though "everything had to be done" it was agreed that some were more important than others so a loose prioritization scheme was devised that ensured that the correct post-its were pulled forward first. The manager took on the role of adding priorities to post-its in the Backlog column when needed.
Results
Team members initially needed some encouragement to move the post-its on their own. This soon past as they were offered the opportunity to take control of the work they were going to do.
By the end of the first day we had blocked tasks. We started adding red stickies to the post-its but eventually moved them to a new blocked column between the Backlog and Work in Progress columns.
When asked, the team said they liked the process because it helped them see what was needed and completed.
A great indicator of the teams investment was the exclaimation "Wow, look how much we have got done" as they looked at the completed column full of post-its.
Since the team was switched to and from other projects the estimated two weeks was not an elapsed time but the project was released before the business needed it.
Comparison with Agile
We did take the time to estimate the stories which wouldn't necessarily be part of a Kanban project. However, there was concern about the completion time which needed some up front guestimates to allow the team size to be predicted.
Beyond release estimating, no time was spent planning what tasks should be worked in the first iteration. While it was only a two week project, in a Scrum or XP project we might have tried for 2 one week iterations. Not doing this did save us a little time and since the Kanban board continued to show tasks getting completed there was always a clear understanding that things that were getting completed.
Additionally, without iterations we didn't ever ask ourselves about what to do if we had not finished the estimated work in the iteration. Instead we maintained the column constraints and monitored how long items stayed there.
If this team ran all their projects using Kanban, the lack of planned iterations might allow some projects too fall through the net. This can be handled with simple organizational changes so shouldn't be a risk.
What an excellent time, hanging with friends, meeting new people and the opportunity to help out some charities at the same time.
I first heard about Give Camp when Mike Wood published his involvement at one of last years events. When Mike mentioned Grand Rapids I knew it was something I wanted to be involved with. Only a 5 hour drive from Cincinnati but it turned out that the drive was not going to be possible. Fortunately, with some great support and nagging from friends I decided we needed to organize a Cincinnati based satellite to see if we could help out.
Now that it is over, everyone is talking about doing our own in Cincinnati next year so here are some memories to remind us.
Over the coarse of the of the weekend twelve local developers volunteered their time and were able to contribute to 5 different projects with their Rails, PHP (Joomla/Drupal) and .Net (dotNetNuke) experience. A great diversity of skills allowed this group to really make a difference.
Thanks everyone, you rock, Rob Biedenharn, Brad Leydorf, Phil Japikse, Mark Haskamp, Frank Glandorf, Kevin Longshore, Bill Barnett, Gerard Sychay, Sunil Kommirshetty, Brian Harwell, Andy Douglas.
It was great working with the Grand Rapids team, Chris Woodruff, Ryan Montgomery, Carl Furrow, Luke Rumley, Emily Stoddard and an apparent endless list of others that I never got to talk to.
However, as with all experience, it wasn't just buttercups and blue bells. As a remote team we experienced the usual problems that distributed developers face. We had a hard time connecting with the teams in Grand Rapids. To make Give Camp Satellites more effective they really need full Voice/IM connections with the teams they work with.
On the first night Luke took on the the role of runner and was great at matching the experiences we had in Cincinnati with the work opportunities up there.
The second day involved us bugging people we learned about on the first day to see if we could help. We heard that they were mostly involved with design work and we were not UI people so the pickings were lean to start with. As the day rolled on we started getting more hits and ended up being able to make some real connections and contributing some positive changes.
The last day left us with one, particularly difficult, bug to address which ended up taking input from 5 developers, over 7 hours, to find the eventual 2 character fix. Oh Safari, the pain you put us through.
As the closing ceremony started in Grand Rapids, we had our own celebration with the most popular food of the weekend, a giant bag of M&M's and promises to work on a Cincinnati Give Camp next year.
Thanks to EdgeCase for donating their Cincinnati office space, and for those that work there, letting us use their desks and plug-in to their monitors.
Thanks to Finagilous for supplying food.
As an Agile software developer I talk alot about testing. I promote and teach Test Driven Development and push to change the habits of developers to encourage quality traits that make the software we produce just work.
I want to draw a distinction between the understanding that I am "testing" and the fact that I am following a "process". This may be moot in the grand scheme of things but it strikes me as important because of a sentence I was about to make to a security professional.
Consider this: