You are currently browsing the tag archive for the ‘Code Share’ tag.

The Graduate Developer Community’s next free event is ‘December’s Code Share: Java Puzzlers’ on Wednesday 7th December at 6:30pm.

Please see link for details and to sign up –

Java Puzzlers

There are more things in heaven and earth, Horatio, Than are dreamt of in your philosophy

William Shakespeare’s Hamlet The year is coming to and end and there’s a last day of term feel to the last code share of 2011.  We’re going to solve some puzzles.  It’s going to make a nice change Joshua Bloch and Neal Gafter have gathered together a good collection in their book Java Pluzzlers

These behaviors are known as  traps, pitfalls,  and corner cases. Every platform has them, but Java has far fewer than other platforms of comparable power. The goal of the book is to entertain you with puzzles while teaching you to avoid the underlying traps and pitfalls. By working through the puzzles, you will become less likely to fall prey to these dangers in your code and more likely to spot them in code that you are reviewing or revising.

Joshua Bloch’s and Neal Gafter’s A Java Puzzlers Sampler Does every language have them?  It would be interesting to see some from languages other than java.   The puzzles seem like the black holes of software, the places where the normal laws break down.  This isn’t true, the laws are behaving exactly as they should but interacting in unexpected ways.  That’s why studying these puzzlers is such a useful exercise: it forces to look at what is really happening, to see the rules for what they really are. They also remind us of Spolsky’s Law of Leaky Abstractions.

All non-trivial abstractions, to some degree, are leaky. Abstractions fail. Sometimes a little, sometimes a lot. There’s leakage. Things go wrong. It happens all over the place when you have abstractions.

Joel Spolsky’s Law of Leaky Abstractions programming is all about building abstractions, code is just a lie we tell ourselves because we cannot cope with complex reality of engines we tend.  There is nothing wrong with that as long as we don’t start believing them.

A lot of computer programming consists of building abstractions. What is a string library? It’s a way to pretend that computers can manipulate strings just as easily as they can manipulate numbers. What is a file system? It’s a way to pretend that a hard drive isn’t really a bunch of spinning magnetic platters that can store bits at certain locations, but rather a hierarchical system of folders-within-folders containing individual files that in turn consist of one or more strings of bytes.

idid Looking at these puzzles reminds us that there is more going on than our simplified philosophical abstractions allow for.  In these puzzles the consequences are obvious, they results jump out and confound us.  In our day to day code those consequences are hard to see.  They may result in code that performs poorly.  They may confound only a fraction of ours users under unusual circumstances.  Regardless, their are always consequences and it does us good to be reminded of them. Also, it’s fun to do puzzles.

Challenge: Language Quirks

Thanks to Peter Lawrey of Vanilla Java for the following challenge.

Give all the types and values for which `x` make this an infinite loop.  There are 16 answers!

while(x == -x);

Here is another one, this time with 3 answers.

while(x != x + 0);

Please bring along your answers, or any other example of a language behaving strangely.

What’s Going To Happen?

On Monday 5th December, a couple of days before the share, we’ll send out an email to everybody who has signed up.  If you have any code to contribute please send it in a reply to that email.

On Wednesday 7th December, the Code Share itself, we will all have a couple of short presentations.  This will be followed by breaking out into groups to try and predict the behaviour of the code.  Will we be able to successfully predict the outcome?  The puzzles will be printed, so you won’t have to bring a laptop. Afterwards we will come back together as a group to discuss what we have learned.

After the event we will be heading to the Half Moon, 213-223 Mile End Road, Mile End, Greater London, E1 4AA –… – for drinks/networking.

ThoughtWorks are delighted to be sponsors of the December Code Share!

This event is hosted in collaboration with the London Java Community. We expect many programmers across the range from junior to experienced to be participating, so it’s a great chance to see how code is viewed by an experienced programmer.

The Graduate Developer Community’s next free event is – The Code Share event on Thursday 25th August at 6pm.

Please see link for details and to sign up –

We are happy to announce the Code Share for August.  It is the first in a series of events focusing simply on the code.  Not writing code, not code tools, but looking at the code itself.

The event is for anybody who cares about the code.  You may be a beginner, looking to improve.  You might be a grizzled old hacker who want to show how it’s done.  We all have something to give and plenty to gain.

We will be reading code rather than writing it.  Anybody who has something to share should just bring it along for everybody to see.

Is it an elegant solution you’re proud of?  Let us all see it.

Are you facing a particularly knotty problem?  Perhaps we can help.

Are you nervous about the code you are submitting for job applications?  Get some positive feedback (and perhaps a little constructive criticism).

Do you have some have some other thoughts or ideas?  If it’s about the code then we want to hear about it.

The format is open, driven by what people want to share.  To help things along we will have a theme and a challenge.  This month the theme is “achieving flow” and the challenge is “pulling tables out of a Word document.”

Achieving Flow

Coding is all about achieving flow.  When programming we have to get ourselves into the zone.  We have to reach a state of flow where we can hold all of the objects, variables and statements can pour out of our heads, through our fingers and into the editor.

The code we produce also needs to flow through so many forms and states.  At one moment a person may be represented by a screen of fields.  Then as a set of key-value pairs held in memory or as url-encoded text.   Then as an XML document traversing an ESB finally to be bottled for weeks or months in the tables of a relational database.  The person is always there, but the forms and representations are in a constant state of flux.

In our code sharing meet up we want to get to the heart of what programming is all about.  We need to achieve flow to create code.  Code is created to achieve flow.  The moments when it all flows freely are the moments we are always seeking.

How do you achieve flow?  Do you have some code that flows nicely?  What impedes the flow?

Let’s get together and let the sharing flow.

The Coding Challange: Pulling Tables from a Word Document

The challange for this month is Pulling Tables from a Word Document.

Imagine that you have lots of Word documents and those documents contain lots of tables.  Write some code to pull the data out of those tables and make them available for your code.

You can save the document in any format provided by Word: .DOC, .RTF, .HTML or any other format that Word will save.

Please see link for details and to sign up –

What is the GDC?

The GDC, or Graduate Development Community is an independent community of undergraduate software developers. Our goal is to bridge the gap between the worlds of Academia and Business. We organise and host presentations and events with senior members of the development community as well as offering advice, guidance, internships and jobs through our community site.