Category: curphey

Learn Core Python in a Week – My Way

By , July 16, 2011

@curphey on Twitter and on Google Plus

I took a week off of work this week to learn Python. Truth is I have been trying to learn Ruby (and) or Python on and off for the last 18 months or so but work and kids (and the “dog ate my homework” syndrome) have always found priority and I made little meaningful progress. After a big release at work I checked my vacation balance, bit the bullet and booked this week off work. I told everyone I was going dark. It’s Friday and so far I am feeling like I have really got to grips with the basics of the core of the language. I am now in a place where I can be productive writing code and solving my own problems. I think I now have the basic level of knowledge to continue learning and overtime actually become a half-decent decent Python developer. In this post I share how I approached getting my results so far.

If you want to know why I wanted to learn a language and why I want to learn Python in particular there is of course a short story. I got involved in computer security via formal education (cryptography and mathematics). As my career progressed through start-ups and financial services companies I became good at managing technical projects and managing technical teams. Through personal interest I steered towards running software security programs and running teams of developers building software security tools. For the last five years I have been more interested in “software” than “software security” and while I am no pointy-haired boss (I have picked up a lot along the way) I have never been formally trained as a computer scientist or worked as a commercial software developer (code contributing developer). When I turned forty, two years ago I had the classic mid-life crisis. I took up distance running and evaluated my long term career plans. Many people start off their careers as highly technical individual contributors and slowly morph into spreadsheet crunching people managers. Power, money and (pseudo) respect in most corporate structures is understandably aspirational for some people but having been there and done it, I made a conscious decision to morph my career back the other way. I won’t ever stop wanting to lead teams of smart motivated and passionate people but I want to be a grass roots technical contributor creating meaningful software. I could write a very long post indeed on how I think the very nature of software teams is changing way beyond Agile and how I think the future is very small self-contained teams operating in an eco-system but perhaps for another day. The short summary is that I decided I wanted to be the member of a rock band and not a member of an orchestra and want to lead software teams from within.

Why Python? With the huge choice of languages and having explored a number over the years (Java, Ruby, Perl, C#) I decided to pick one with a view to becoming proficient in it rather than try and become a “jack of all trades” in a few. I view JavaScript and CSS as base knowledge for any modern developer so didn’t include those in the scope of my decision. You have to know them regardless if you want to build web applications. I have always been passionate about open source software and so one pre-requisite that there was a strong open source community (online, local meetings etc.) and eco-system (tools, components etc.) behind my language choice. At college in ’97 I first played with Java back when it was all about applets, then later when I ran the software security program at Charles Schwab between 2001 and 2003 we were all about EJB so Java might have been a natural choice and the eco-system is clearly very strong, but for some reason the community around Java doesn’t excite me. For me it essentially boiled down to Ruby vs. Python and to cut a long story short Python won. While Ruby has stronger test support with Cucumber (and friends) and of course a first class web framework in Rails, the developer community felt arrogant. Hang out on a ruby language mailing list for a week and you will know what I mean! Python on the other hand has a very strong scientific community behind it with a wider range of libraries for a broad spectrum of science things like bio-informatics. There is a great MVC framework called Django and in recent years Google has adopted it as one of its formal language for both use internally and on the Google App Engine. There is no real science behind my choice and it is very much personal preference but simply put it feels like a decent choice at this time.

Of course there will be a lot of code, a lot of learning and a lot of time before I will be a competent developer, if you are like me and want to learn Python (and have a day job that seems to get in the way) here is what has worked for me that you may want to consider.

1. Book a dedicated week – This is by far and away my number one tip. I took last Friday off to deal with the inevitable bow-wave of mail from work so I could enter this week 100% clear of any work issues. I structured my day with a 5 – 6 mile run every morning (obviously optional) followed by 4 hours of dedicated coding time. I take a break for the afternoon and then follow-up in the evening for a few hours (no fixed length) to cover any loose ends, extra reading and preparing for tomorrow. I created a bow-wave of learning so I wasn’t going into this week cold by starting tutorials a few weeks ago. This allowed me to focus this week on exploring important concepts and not understanding basic theory. I knew what I needed to learn going into this week and what success looked like for me so created my plan for the week (see below) ahead of time.

2. Agile Planning – I scoped out my work using Agile planning techniques. This maybe overkill but got me into the right mind-set. I used the community edition of Rally and set up a backlog and daily iterations. I even entered exercises as tests to prove my knowledge to myself. I have been able to look at my backlog, add stories and tasks and get better at estimating my velocity as the week wen’t along. Other decent free options for this include Pivotal Tracker or Agile Zen.

3. There is no substitute for writing code – You can read as many book as you want and write code in your mind but there is no substitute for writing code on your computer. It really is the only way you will learn syntax, semantics and how things really work. Don’t fool yourself into reading a chapter of a book or watching a video, writing code is what teaches you to write code. There is nothing more to say on that topic. Zed Shaw’s “Learn Python the Hard Way” echoes this. Use the Python shell as much as you can to experiment. iPython gives you a great extended shell to play with.

4. Hire (pay) a good instructor – Having a good mentor / instructor is essential. I was lucky enough to have a very smart friend (who is very, very good developer) last year agree to meet me for coffee every other week and teach me some Ruby. I never really made progress. Reason? I wasn’t committed. I never had to pay him, I would meet and catch up on a social level and our relationship was based on friendship and not on learning. This time I did some Googling, found out that the local University (University of Washington) ran an extension class and emailed the lecturer asking for private lessons. I met him for coffee first to make sure there would be a social fit and that his style would match what I was looking for. It’s not cheap (although all up will probably be 50% of the cost of doing a formal class like this) and has allowed me to operate at my own pace and on topics I want to cover. We can get side-tracked when we want. The lecturer (Brian Dorsey) is great and I look forward to meeting. During this seven day sprint we planned to meet three times and every Friday for a few weeks before and afterwards.

5. Use the Right Learning Material – Over the years I have bought a lot of language books. They range from step-by-step instructional books like the APress or Head First series to less structured books like the O’Reilly language series. While I have gotten a lot from them I have either found them to be “draw by numbers” or not organized in the way I wanted to learn. Bryan suggested “Python for Software Design – How to Think Like a Computer Scientist” which is what the UW course is based on. You can get a free PDF version here. The book has been a perfect fit for me as it talks about computer science in terms of recursion and stack diagrams and has exercises to build fractals and solve math problems. It is an an academic level that I can relate. The right material has really had a significant impact on my learning this week.

6. Use an IDE – Many purists will expose that using a text editor like TextMate (which I own) or TextWrangler is the best way to learn but for me using a fully fledged IDE has been a serious benefit. I use PyCharm and for the most part love it. When you are exploring an API you can see the functions it supports and syntax errors are highlighted as you type. While this could indeed make you lazy I think it helps you get up to speed faster so that the syntax becomes second nature. For me it’s like the difference between using a text editor or word processor to write a story.

7. Use good development practices as you learn – All week I have put my code into revision control. I generally use Git so also took the opportunity to learn Subversion this week (my only real violation of my next tip but it was so simple that …). I comment all my code no matter how trivial the example and even took to running it through the Python style guide PEP-8. Towards the end of the week I have even taken to writing unit tests for all code. Python Koans are great for learning testing in Python.

8. Just Learn the Language, Nothing Else – It’s very tempting to also learn Django at the same time as learning Python. If you want to build web apps you will need a framework to build on but I think it has been very valuable to separate the two. Apart from separating the complexity and scope it forces you to focus on the language only and not how to use the language to drive a framework.

That’s it for now. If I can think of more I will add it and I would love to hear others tips and tricks.

Useful References

A Jump Start for Learning Python

33 projects that make developing django apps awesome

http://learnpythonthehardway.org/

ipython

Python Koans

 

 

 

 

Share on TwitterSubmit to reddit

Barefoot Running – 3 Things I Learnt at My First Born To Run Clinic

By , January 15, 2011

Today I took my first barefoot running lesson at Born To Run. Born To Run is a new barefoot / minimalist running shop set up around the principles of the barefoot running movement and the Born To Run book (Barefoot Ted, one of the characters in the book is involved in the shop). I am lucky enough to live near their first shop and over the holidays noticed they are running barefoot running clinics so I signed up. For $50 an hour you get 1:1 tuition on barefoot running form and how to effectively and efficiently run barefooted. Despite some scheduling hiccups today it was a great intro. and I plan to make it a monthly event to work on my running form. This is what I learned today:

1. Lean

2. Lift Your Knees (Don’t Jump)

3. Relax the Ankles

Lean – By leaning forward you use gravity to go forward. If you think about it imagine running downhill. When you want to slow down you lean backwards and if you want to go fast you lean further forwards. The same works when level. We practiced slowly falling towards a wall to get the feeling and then  using the same technique to lean forward when running.

Lift Your Knees – Try running on the spot. Chances are you will do what I did, which is to jump from foot to foot. When you do this you are bouncing your entire body weight on each stride. Needless to say this is very inefficient. I pranced around the shop like a show pony just lifting my knees and walking to get used to it. I was asked to pretend I had rods through my ankles and I had to lift my legs to make sure I didn’t trip. This was surprisingly effective.

Relax Your Ankles – A relaxed leg leads to your foot landing correctly. I had previously been focusing on landing on my forefoot. Dan the instructor explained that he doesn’t teach fore-foot striking, instead focusing on people having relaxed ankles and forefoot striking naturally.

We went outdoors for a quick trot and put it all together. I can honestly say that in an hour I have not learned as much about running as I have in days of reading. It explained why I have been getting very sore calves (I prance on my feet) and why my achilles has been inflamming.

Next lesson in two weeks.

NB : It turns out I can bring others to the lessons for no cost. Let me know if you are in Seattle and want to join!

 

- Mark Curphey

Share on TwitterSubmit to reddit

Why Run Barefoot ? – My Story

By , January 15, 2011

This is the story about how I came to embrace bare-foot running and what I have learned along the way so far.

I have been jogging on and off for the last two years but never considered myself a runner. Last March I was in Buenos Aires, Argentina speaking at a conference. I was traveling with two girls from work who were both training for a marathon. One of them had lost a friend the previous year to Lukemia and was running with Team in Training raising money for Lukemia research. I went out for some glorious runs with them in the sunshine around Buenos Aires and it’s wonderful parks. One evening over beer in Argentina I decided to do the marathon as well and joined them on the Spring Team in Training (TNT) Season for the Seattle Rock’N'Roll marathon. Thanks to generous friends and Microsoft’s gift matching I quickly raised over $3,000 dollars and settled in to focus on the training. TNT make it easy with a planned training schedule and group runs. I started running in the morning before work during the week and attending the longer group runs at the weekend.  Despite the cold Seattle weather training was enjoyable and I found myself really enjoying the running. I found running to be a combination of a mental and physical challenge and I found that I had a very high tolerance for mental pain that I could translate to physical endurance. I felt great, weight came off, I felt alert and happy and generally more inclined to eat well. I hated running as a child and have nasty memories of dreading cross-country at school in the cold British winters but here in my middle-age I had discovered a sport that offered the mental challenge and physical rewards I was looking for. After my first half-marathon distance I got a mini-boost of confidence and eased into the longer distances until one Saturday on an 18 mile training run disaster struck. I felt a pain in the shin of my left leg after around 15 miles, dismissed it as a “twinge” and ran back. Over the weekend the pain increased to a point where I struggled to walk. Ibuprofen and constant ice packs were having little effect and so on the Monday I visited a physical therapists and was immediately referred to the hospital for an MRI. While on the table getting the MRI the problem became obvious. An area on my leg was lighting up like a match on the screen. I had picked up a stress fracture.

What followed was what I suspect is the typical way doctors treat this kind of injury. I was prescribed a leg brace, crutches and strong anti-inflamatory drugs and told in no uncertain terms that I would not be running a marathon anytime soon. I was referred to a series of physical therapy three times a week and referred to a podiatrist for a gate analysis. The physical therapy consisted of a set of exercises to improve mobility and flexibility along with a set of yoga poses to improve core strength.  I bought ankle weights to work at home, although frankly didn’t use them much. After a month or so the podiatrist put me on a treadmill and had me run while they took a high speed video and looked at how my feet hit the ground. My feet were put in a machine that took a 3D mould with a laser and I was prescribed custom orthotics to go inside my running shoes. I was told to go and get specific balance shoes to compensate for my pronation (bow legs to the average person). The orthotics were horrific, they looked like the sort of thing old people wear and I became very skeptical that they were the answer. A week before seeing the podiatrist and at this point missing running I picked up a book called Born to Run (Amazon link here). Both to Run is the story of a journalist who stumbled across a tribe called the Tarahumarha in Mexico’s Copper Canyons that were ultra-distance runners. They would cover hundreds of miles in nothing more than thin soled sandals often home-made from car tires at incredible speeds and on a very limited diet. The book follows the story of the search for a fabled American who had gone to the Copper Canyons and was now living and running among the Taraumahra and how he realized a crazy idea to pit the worlds best endurance runners again the tribe. The book is a wonderful read for it’s story but contained a powerful message that most of running injuries in the modern world have happened since the birth of soft spongy running shoes in the 70′s and 80′s. People have been running barefoot for thousands of years chasing down animals on foot for food and that there was living proof in Mexico of all of this in the form of the Tarahumara.

I was immediately drawn to the mantra of the book. It just made sense. I had never even thought about my running form, the type of shoes I was wearing or my bio-mechanics so I started researching the web and the more I read the more it made sense. A distractor for me had been the rise of Vibram Five Finger shoes (which ironically I now wear). Many geeks could be seen wearing them in normal life and they certainly aren’t flattering (especially on over-weight hairy geeks!) but I read Born to Run twice and decided to give it a go. After a struggle to by a pair of the new (at the time) running Five Fingers called Bikila’s due to over-demand I spent a few weeks running 30 minute circuits around the grass sports field at work in my lunch hour. I got some crazy looks from people playing football and frisbee but soon got comfortable and found myself steadily able to run barefooted with no pain. The feeling of running with no cushioning is strange at first but rapidly becomes natural. Over the course of the late summer I got my Five Fingers, built up my distance and decided to enter the November Seattle marathon. A serious of unfortunate work pressures kicked in and for whatever reason I could never seem to pull together a reasonable training schedule. Four weeks from the marathon I was running just a few miles a week and so I decided to drop the the half-marathon as a pre-caution. I new that I wasn’t even prepared for this but with a strong mental capacity I figured that I could go out and run and deal with some stiffness after the event. Foolishly I decided to go out two Saturdays before the event and run 12 miles. It was a very cold day  and wet on the ground, so I put on my Saucony Kinvara’s. Kinvara’s are a minimalist running shoe but still look and feel like a traditional shoe. It was simply too cold for FiveFingers and I wanted to run (I have since bought Injinji socks and am planning to try some TerraPlana Evo’s soon). I had a great run around Lake Union, my heart rate was actually dropping after 2 hours and I felt great, but as I turned into my road at home I felt my achilles tightening. The inevitable had happened. Low distances and then just going out and running a half marathon and I had picked up another injury! The November marathon came and went and work got in the way of a new training schedule but it’s the new year and I am more determined than ever to not only complete an official marathon this year but tackle an ultra marathon. I am also hoping to get some trips to run in cool places like the rim of the Grand Canyon or maybe some deserts. The Pacific NorthWest has some great trail running as well on my door step.

The evidence for me has been compelling and I can’t see myself ever going back to running shoes at this point. I have been injury free while running bare-foot but each time I put on running shoes I get some sort of injury. Why would I do that to myself? And that right there is why I run barefooted. This morning I had a bare-foot running lesson at Born To Run. When I got home my seven year daughter was laughing hysterically; “Why does a 42 year old man need to learn to run?”. It’s simple. I know that running barefoot seems to allow me to run injury free. I know the evidence and history supports that evidence all boils down to a key factor being running form. It’s running form that helps you avoid injuries, run longer, faster and use less energy. I am now looking to find out how to optimize my form to improve my running and remain injury free as I do it.

- Mark Curphey

 

 

 

Share on TwitterSubmit to reddit

The Importance Of Side-Projects

By , December 30, 2010

I think side-projects are very important for creative people. They allow you to;

1. Define Your Own Destiny – For many people ‘work’ means working for someone else (person or company). That means largely taking into account the interests of the thing you are working for and first and foremost doing what’s right by them. You have responsibilities and accountabilities that constrain your free thinking and decision making process. Side-projects free you from those constraints and allow you to be in charge of your own destiny. You answer to yourself.

2. Take Risk – The cost or ramifications of failure is usually significantly less in side-projects. If the side-project fails you’ll still have your day-to-day life. That doesn’t mean to say people are any less committed but it does mean that people working on side-projects can take more risk that they can with their day-jobs. They can experiment. The irony of course is that experimentation and controlled failure breeds success.

Thomas J Watson : ” Would you like me to give you a formula for… success? It’s quite simple, really. Double your rate of failure. You’re thinking of failure as the enemy of success. But it isn’t at all… you can be discouraged by failure — or you can learn from it. So go ahead and make mistakes. Make all you can. Because, remember that’s where you’ll find success. On the far side. “

3. Create Your Own Structure – Side-projects can sustain teams of people that typically won’t survive commercial projects. Companies typically need a mix of rocket-scientists and “steady joes” to succeed. Without the need to have a guy to make sure the bills are getting paid or that the Mr X isn’t an HR violation, side-projects can create working environments where people can truly be themselves. People can form teams of rocket scientists and choose to work only with people they want to work with rather than people they have to work with.

4. Don’t Worry About Breaking the Rules – Side-projects don’t have to worry about breaking any rules because they make their own rules!

Even forward thinking companies are embracing side-project philosophies like Googles famous 20% rule.

- Mark Curphey

Share on TwitterSubmit to reddit

Online Community Patterns

By , December 28, 2010

I have been looking for a meaningful new side-project for a while and have now been actively working on an idea with a “partner-in-crime” for a few months. We plan to launch a web-site sometime early in the new year and we will start blogging and tweeting about it soon.

The last big side-project I started was OWASP (which now has thousands of “partners-in-crime”). Looking back the time I spent working on OWASP was one of the most motivated and creative times of my adult life. When we first started the project there was no goal or rule book to follow. There was a set of ideas and a collective passion for web application security. That was it. Everything else got figured out along the way as a community. A community that had no definition, no initial structure and no governance. I don’t think anyone even recognized it as a community for a year! Probably most importantly was that there was a feeling that there were no-rules and no-limit to what could be achieved if a few like minded passionate people came together. While I haven’t been involved in OWASP in any meaningful way for a number of years and so can’t take credit for it’s phenomenal success over the last decade, it ignited my interest in something that I think is quite profound. In truth while there will always be software security in my DNA it was the community aspect of OWASP that I enjoyed and learned from the most. I read a lot and often find myself relating passages in modern online social science books like Getting Real (Re-Work), The Long Tail, Groundswell and Here Comes Everybody to what I have observed happened (and is happening) at OWASP. It has been a very good online social science lab!

Of course at the time certain patterns of behavior or actions weren’t calculated. They just happened by luck (lucky timing  I guess) but several years on and way too many hours spent online I am utterly convinced that there is a very strong correlation between key patterns in online social science and organizational theory which when combined with design patterns in social software are strong indicators of the success or failure of online communities.

The way people organize themselves, the types of people that are involved, who makes decisions (and of course how decisions are made), how community members are recognized and rewarded and how disputes are resolved are all critical patterns. The type of software communities embrace is also vitally important to success. Social software be it a wiki enabling collective editing, a mailing list enabling seamless discussions or a blog enabling friction-free publishing work with different degrees of effectiveness depending on the community.

Most fascinating of all of this of course is that no one size fits all. There are clear patterns but not play-books and that’s what makes it so fascinating.

So my next project will a community for community organizers and developers!

- Mark Curphey

 

 

 

 

 

 

Share on TwitterSubmit to reddit

Panorama Theme by Themocracy