Category Archives: Uncategorized

Life is a broken computer

This poem was written completely by Jamie, it’s an original work 100% by him.

Life is a broken computer.
Now boy let me tell you this,
I’m not working right.
Viruses are hitting me everywhere, and I can’t even charge.
My chords are ripped and my screen is cracked.
My speakers are destroyed and my vision is blurry.
Many of my sites are messed up.

Even through this, I have been goin’ on.
When I shut down I don’t stay shut down.
I always come back on.
Even though my internet is slow, I still get to where I need to go.
Viruses never kept me from getting to places.

They never will and they should never keep you either boy!
Now boy don’t you shut down.
I’m still goin’, boy
I’m still goin’,
Even though I’m not working right.

Functional Programming Principles in Scala

I recently finished a Coursera class entitled ‘Functional Programming Principles in Scala’, taught by none other than Martin Odersky himself. For those that don’t know, Martin is the creator of the Scala language and a professor at École Polytechnique Fédérale de Lausanne.

Read it and weep: scala_certificate

For those contemplating taking this class, I encourage you to do so. It was well worth it! My only “caution” would be to take note of the title — the class is truly about FUNCTIONAL PROGRAMMING using Scala. Meaning, you will focus on solving problems in a purely functional way (in the mathematical sense). E.g. no mutable variables, functions as first class citizens, currying, etc.

I think the code snippet below is one of the more beautiful pieces of code I’ve ever seen, and it’s representative of the types of things you’ll learn. It defines the (infinite) series of prime numbers in a ‘lazy’ way.


def from(n: Int): Stream[Int] = n #:: from(n+1)
def sieve(s: Stream[Int]): Stream[Int] = s.head #:: sieve(s.tail filter (_ % s.head != 0))
val primes = sieves(from(2))

The entire class is 7 weeks. Each week you’ll watch approximately 90 minutes of video lectures, and you’ll have some assignments that get progressively more difficult as the course progresses. At first the assignments are very easy, but by week 6 they get fairly difficult. Expect to average around 5-7 hours per week on assignments. You’ll upload the assignments using a provided tool, and within a few minutes you’ll get your grade. You can submit the assignments as many times as you like to improve your grade, up to the point the assignment is due.

Here is the week by week breakdown of topics:

  1. Functions and Evaluations
  2. A lot of basic syntax in here. You’ll learn about the concept of functions as first class citizens, evaluation strategies and tail recursion.

  3. Higher Order Functions
  4. Composing functions using other functions, currying

  5. Data and Abstraction
  6. How to compose more complex data structures, polymorphism

  7. Types and Pattern Matching
  8. Functions as objects (everything is an object!), subtyping, generics, pattern matching

  9. Lists
  10. Pairs, tuples, higher order functions on lists (such as map and filter),

  11. Collections
  12. Collections other than lists, such as maps and sets. for comprehensions (not your standard for loop!)

  13. Lazy Evaluation
  14. Trees, streams, lazy evaluation.

I can’t say enough good things about this class. The material was interesting, the assignments were challenging, and I thoroughly enjoyed it.

Nothing

What’s this blog about?  It’s about nothing!  No story, forget a story.  Who says you’ve got to have a story?

Ok, maybe it really should be about something (ask Atreyu). But what? I haven’t quite figured that out yet.  I set this site up a few weeks ago but haven’t yet posted because, really, I’ve been trying to decide exactly what I want this blog to be about.  Should I stick to technical posts?  If not, how much of myself do I share?  Should I create two blogs – one for ‘business’ and one ‘personal’ ?  Who will read this thing anyway? To be honest, I still haven’t completely resolved these questions.  So I’ve decided to just write something.  We’ll see what happens.

I guess I’ll start by introducing myself.  My name is James Swafford.  I’m a self-employed software developer, specializing in Java based technologies.  More importantly, I’m a husband, father, and a Christian.  I live in eastern North Carolina, in the small town of Farmville.  (Yes, it’s a real town, not just a Facebook game!)  My wife Amy and I have been married for nearly 17 years now.   God has truly blessed me and my family!

In the interest of full disclosure, I’m writing this blog because I’ve been told I have to.  Really!  Virtually everyone says it’s a requirement for anyone that’s self employed to have a website with a blog.  Since I’ve been self employed for a few months now, it’s high time to get with the program.  Really though, this is something I’ve thought about doing for some time, but writing about myself isn’t something I’m terribly comfortable with.  And while purely technical blogs are informative, they aren’t terribly interesting, are they?  So I guess it’s settled – there will be at least some personal postings on this site. (Not that I’m the least bit interesting.)

Well, I feel like I’m rambling already so I’ll close this initial post here. I’m hoping to post something every week at least, but no guarantees.  So, until next time..

Cheers!