Category: Software Engineering

Coding, Python, web development, architecture, and deployment

  • Applying The Creative Writing Process to Software

    Grabbing the best ideas from other industries and applying it to your own is a fantastic way to learn and discover new ways to do things.

    I was listening to the Tim Ferriss podcast yesterday in an interview with Neil Strauss.  Two best selling authors discussing their creative process for writing a book.  It got me thinking if some of the approaches they discuss could apply to to software development -which is also a highly creative process.

    Let’s break down Neil’s process a bit.

    The first part is to do a lot of research.  For example, when Neil is doing an interview with a celebrity, he will read everything they’ve written, listen to ever song, devour every bit of information he can about the person.  He writes out a list of 100 questions for the person and studies it like you would for exam prep.  Finally when it’s time for the interview he puts the questions in his back pocket and forgets about them.  As a result of this level of preparation and study the interviews can flow naturally.  He has a backup of questions to draw on if the conversation stalls but usually he can riff off the bulk of knowlege he has collected to build rapport and get to the really interesting details.

    With a cache of notes from research it’s time to start writing.  There will be several drafts and the goal of the first one is to “Write to the end”.  Convert the pile of notes into a story as quickly and rough as possible without self editing along the way until you get to the end of the book.  This first draft will be read by no body else.

    After the first draft you are just 1/4 the way finished.  The second draft is done for the readers.  You cut out all the uninteresting pieces, ensure the story arc is solid, characters are developed enough, flow is good, and jokes are funny.  You do this by putting on the hat of a reader and ruthlessly editing your first draft.

    The next step is to put on the hat of a hater.  To deflect criticism before it happens you go through it again with the perspective of someone who wants to debunk your stuff and criticize your ideas.  At this step you fact check everything, and make sure there’s nothing offensive, or at least that the counter points are acknowledged and dealt with.

    Finally it goes to the editor and is test read by anyone who wants to read the manuscript. Listen to their criticism, and adjust your book to improve things and cut parts that people don’t find interesting.

    After enough feedback you’ll know when to lock down the book to a final version and send it to be published.

    For an average size book this whole process can take upwards of a year to complete.

    There are some lessons that we can take from the best approaches to writing books and apply it to writing software.

    Notice that this approach to writing a book is not Agile, and it’s not waterfall, it doesn’t involve sprints, scrums or user stories. It’s completely unique to the way most software is created.

    The first part of Neil’s process is research.  You might roughly correlate this step to requirements gathering but that vastly understates the effort Neil goes through.  I have never met a developer that thoroughly masters the domain knowledge before typing anything the way Neil does.  Taking months and often years to interview people, take courses, and generally immerse yourself in the space you will eventually write about gives you skills and knowledge to be able to write “to the end” without pause.

    Side note: Interruption is one of the most detrimental things to the creative process. Stopping to look something up, or ask a question of the client can waste half a day of productivity.  Agile methods promote this open communication during development… maybe there’s a better way.

    Writing to the end for the first draft is something not possible without having enough domain knowledge to do it in the first place..  There really isn’t a comparable product in any software project I have personally worked on which compares to this first draft.  The scope of Neil’s first draft expands far beyond what is in the final book as he will likely cut 50% of the pages during editing.  It has me wondering if it would be a good software development approach to rip through a 20,000 line first cut of an application knowing that I’d delete 1/2 of the code before being finished, slashing out features along the way.

    If we did write this quick rough first draft application with the intention of whittling away anything superfluous to arrive ultimately at a publishable product then the next step would be to put on the hat of someone who wants or needs to use this software. Can you make the interface more intuitive? Can you give it some life? Are there any features that are more complex than they’re worth? What can be cut without destroying the utility of the application?

    It would be only after these changes have been made that anyone other than yourself would see a demo.

    In Neil’s process the final step is essentially debugging. Going through the application yet again with an eye for correcting errors, fact checking things, getting a lawyer’s review for liability etc.  At this point you would also ask for the input from as many test subjects as you can, gathering and filtering feedback to fine tune rough edges.  Essentially you want to make sure that if someone is trying your software they don’t have a reason to ask for a refund and they can’t claim that you or your company are incompetent.  The final product has to be great.

    Only after enough friends, family and colleagues have used the software that you feel confident in it do you call it done.

    It’s interesting to wonder if this would produce a better product than the typical agile developed software.

    There are a couple of significant differences in software vs book writing however that need to be addressed.  Software is rarely a single developer’s sole project.  There is usually a team to divvy the work between. This team adds some communication load to the project as people need to be in sync.  This team approach doesn’t work well if all the domain knowledge is stuck in scribbled notes and in the head of  one guy that did the research.  Would Neil’s approach scale to writing a 10,000 page book with 4 other writers?  The counter point would be that if you’re looking at writing a 10,000 page book maybe it would be better to write 20 500 page books and only have a single author per book.

    Software is also not written linearly.  When you start to write a book chapter you may be able to start writing and continue without stopping the flow of words.  You probably wouldn’t be halfway through chapter 18 and realize that it would be good to foreshadow what’s happening earlier, then stop and go back through to find a good spot to add that foreshadow element to an earlier chapter. A disruption like that would completely disrupt the flow of your writing.  It’s difficult to write software without jumping around like that.

    Programming languages are much more rigorous than English.  it’s not always possible to skip pieces where you need to know an answer to get a working program. There can be hard dependencies that prevent you from moving on until they get solved.  Again this is an opportunity for interruption.

    It would be interesting to try this method on a software project to see how it translates.

    If you are interested in getting more details from Neil Strauss and Tim Ferriss about the creative process check out this video:

  • too many computers?

    There are quite a few computers in the house.

    • Heather has a MacBook Pro for herself
    • I have a Macbook Air that I use most of the time and leave around the house
    • In my office there is an old 2009 Mac Mini which is showing it’s age but mostly acts as a machine to host my music and movies
    • I also have a Macbook Pro for work which I try to keep my personal stuff off of
    • There is the new PC that I built which currently is a hackintosh
    • There is also a rack mounted server which is currently going unused because it’s too loud to leave on

    Currently I don’t have a backup solution in place.  When I built the PC I salvaged pieces from my backup Linux server leaving it non-functional.  All those computers and no backups in place is an accident waiting to happen.

    So looks like I’ll be rebuilding a Linux server, adding yet another computer to the collection in the house.   Just as soon as I find the time.

  • Finding time to code

    Finding time to write code after work, when you have an eight month old and a full time job is nearly impossible.  I’m not sure how others manage to do this.

    It’s time to do an audit of my time management.  To figure out just where all my free time is going so that I can focus on finding ways to remove my biggest time sucks out of the day.

    I suspect that TV time and running errands are the biggest areas that can be optimized to give me time in the day to get more software written.

    To be sure, I’m going to do a 1 week audit of my time by filling out this print form.  I’ll share the results next week

  • Polyglot vs Specialization

    I consider myself a fairly well rounded developer. So when it comes time to choose a technology to accomplish a task I will happily choose the one that is the best fit whether it requires Ruby, Python, Java, Objective-C, PHP, CSS, or Bash or anything else.

    Recently I was given a project to take on.  At first it looked like it would be adding some PHP code to an inherited code base.  Upon starting it became apparent that the code was a disaster and too far gone to be recoverable… a full re-write would probably be best however it was way out of the budget for now.  Rather than continue patching in the new features we needed, we decided to create a new side project that tied into the existing database to accomplish what we needed.  It gave me a chance to evaluate how I wanted to build this application.

    Generally we do Ruby on Rails work with my team.  However given that the existing database schema was not even close to normalized or conventional Rails would have been a difficult way to go.  There would need to be a lot of boilerplate code to map things to new field names.  It just wasn’t a good fit.

    Instead I opted to go with a simple, lightweight Node.js App.  It would leverage the SQL queries copied out of the original PHP code with minimal overhead.  The app is heavy on database IO and has zero application logic so Node is a good fit.  We already have Javascript skills on the team and experience with testing frameworks for Javascript code, so support wouldn’t be difficult.

    Turns out, it didn’t go over well with some people on the team.

    “We use Rails as a  technology stack”

    Passion can run high in technology circles over tools. Apple vs. Windows. VIM vs Emacs there are religious fights about which is better.

    I like to be good at a breadth of technologies, that means staying sharp on a fistful of languages and tools, while always looking to learn new things.  Others like to focus on being world-class with one technology stack.

    Which is the better approach?

  • What happens when computers are smarter than you

    A few years ago I was working at a finance company doing quantitative stock algorithms and I remember hearing an interesting story.

    Back in the early 2000’s there was some buzz around neural networks and their ability to be used to pick stocks.  The company at the time had invested some R&D into creating their own neural network algorithms to help with their trading.  The algorithm performed well and they apparently moved it into production.  However, it was quickly pulled back out.  Even though the trades were profitable, when investors asked why they had made specific trades the portfolio managers couldn’t give them a reason.  An “I don’t know” answer from your highly paid portfolio manager doesn’t instil a lot of confidence.

    The neural network algorithm was in someways smarter than the portfolio manager, it could identify correlations in the stock market that could not be explained in terms the investors could grasp.

    I believe there is nothing inherent to the bundle of neurons in your head that would make it impossible to replicate in silicon and software.  Furthermore, if it’s possible to replicate the average person’s brain then it’s possible to replicate a brain with an IQ of 200, and if that’s possible then perhaps it is also possible to simulate a brain with an IQ of 500 or 10,000! The ramifications of which are incomprehensible.

    Over the last handful of years big strides have been made in the world of AI.  Facebook has face detection algorithms that are as good as humans, Google has self driving cars with a perfect driving record, publishing companies have algorithms to write news articles.

    We are fast approaching a time when computers will be smarter than us all.  They will gradually pick off more and more tasks to be better than us until they are smarter in a general sense at virtually everything.

    When I look at my profession of being a software developer, I can foresee a way for computers to make dramatic inroads to making even me obsolete. You take all the publicly accessible code online and feed it into a learning system. correlate issues and bug reports to the code fixes and it becomes possible to identify logical errors and bad practices, or autocomplete entire sections of code. Even without cutting out software developers completely, it seems possible to increase their productivity by an order of magnitude.

    When a computer is smarter than me at programming, it will program itself.  I will be out of a job, and likely, so will everyone else.

    When a computer is smarter than all of us, the entirety of human civilization will change.  We are currently unaware how a system a complex as everything on Earth will react, and that’s kind of scary.  Perhaps someone should attempt to forecast this future.  An economic forecast may have more weight to pull in political debate.

  • Investing in your Productivity

    This week in discussion with the rest of my team it became apparent that there was a lack of investment in creating tools to help with the productivity of the team.

    There are four distinct areas you can focus on to improve your productivity as a software developer.

    Focus

    Software development requires a lot of time to think about solutions.  This usually requires focused thought to make any real progress.  Distractions can totally derail your day.  Finding ways to always reduce the number of distractions in your day can pay huge dividends.  Improving your focus is one of the first things you can do to improve your productivity.

    Knowledge

    The more you know about all the tools you use the less time you spend looking for answers on StackOverflow.  As a developer myself who jumps between Python, Ruby, Javascript, Go and Objective-C on a regular basis I sometimes blank out on even simple things like the syntax of a foreach loop in javascript.  As a result of a detour to google for answers I can easily loose a few minutes here and there throughout  the day which can add up.

    Knowing your higher level constructs can reduce the amount of time you spend re-solving already solved processes.  Having a solid understanding of authentication techniques, CRUD interfaces, caching strategies, SQL etc can make a task that would require a google search and turn it into a trivial exercise.

    Reading or re-reading books about your language of choice, framework, or concept can greatly improve your code, and your productivity. I try to read one book per month, and subscribe to weekly email lists for everything I’m interested in keeping current on.

    Typing Speed (core skills)

    Your ability to translate thought into code is dependant on how seamlessly you can move things from your brain into the computer.  The keyboard is your interface and being able to use it effectively is a basic skill for anyone who uses a computer.  Even though I have been touch typing for 15 years I still invest some time here and there to master the keyboard.

    Tools

    Knowing how to use your text editor advanced functions is one thing, writing your own tools to help streamline your processes is an investment in your productivity going forward.  You can do some pretty cool things with a 100 line shell script.  If you could spend 10-20% of your coding effort on creating tools to improve your productivity then it would compound into tremendous gains over time.

    The current evolution of devops is an example of what’s possible.  The old days of purchasing hardware, spending weeks having IT configure the server software stack and then developing a custom process for deploying your app has been replaced with ‘git push’ to the cloud.

    Investing in tools for your business (Sales, Marketing, Accounting) automation or tools for personal productivity (creating S3 buckets, debugging notifications, app templates) can pay huge dividends.  They give you a competitive advantage.

    Open sourcing some of these tools can provide new visibility to your business (see thoughtbot as an example)  and can attract top tier developers.

    So get out there and keep an eye on always getting better.  Always be learning, always care.

  • Getting Back to Node.js

    Javascript is the most popular language on GitHub.  There is roughly 5 times more Javascript than Ruby code!

    Node.js has been moving very fast since it was first released 5 years ago.  It has been pushing the development of Javascript to expand into numerous other areas including commandline tools and servers.  Coming back to it now after a year, it’s amazing to see how it has matured.

    The bleeding edge ECMAScript 6 Harmony language changes to Javascript have helped to tame callback hell, Express has become the defacto standard for web servers, and there are now libraries available for just about everything you could want.

    One thing about Javascript that is interesting is the uniqueness and flexibility of the language. When you read other people’s code and say “that is clever” it feels like you’re understanding how another developer really understands what the code is doing.

    Most developers who haven’t worked with Javascript make the mistake of assuming they know Javascript.  However Javascript deceptively complex.  Understanding the subtleties of how ‘this’ is defined gets tricky.  Being able to write idiomatic, properly encapsulated, testable code is requires some dedication.  Good code is much different than just using jQuery to hide a div.

    I just finished reading Node.js the Right Way: Practical, Server-Side JavaScript That Scales and though I picked up a few tricks it left me wanting to dig much deeper to understand and learn more.  Thankfully there are now plenty of books to read on the subject.

    It seems as though Node.js and Javascript have been infiltrating the enterprise.  Using the same language from front end to backend is a great selling point.  The high performance is perhaps more valuable.  What this means to you is that learning Node.js has actually become a good career move.

  • Birds Can Fly in the store

    My new Flappy Bird clone, “Birds Can Fly” made it into the store yesterday. To kick things off with a bit of a boost I ran $250 worth of ads. That worked out ok though it’ll take a long time to earn that money back. The idea with the ads was to try to get the game in the hands of a range of people who will hopefully show their friends and get the game out there.

    This game features me singing, and sound effects I recorded in the basement.

    Birds Can Fly – HalOtis Inc.

    I’m going to continue to work on a number of quick games now that I have a bit of a handle on using SpriteBuilder to help with the development.

  • Invader Crush in the Store

    After a longer than usual review process, my latest game Invader Crush made it into the App Store.

    I had to resubmit my flappy bird game due to a bug that was picked up by the reviewers. Expect that to be reviewed within the next week.

  • Open Sourcing old Projects

    While trying to clean up my computer a little I noticed that I have a lot of old projects that are really doing nobody any good by just sitting on my computer.  So in an attempt to both back them up and share them with the world I’m going to be reviewing some of these old projects and sharing them on GitHub.

    The first project I’m open-sourcing today is an old simple web app I did way back in 2007 called TwitSig.us.  It’s a PHP application that retrieves your most recent tweet and renders it into an image.  It was designed to be used as an email signature that would continue to be up to date.

    You can now find the code for this project on the github repository.