Halffull.org

Category: Programming

Why You Should Learn Go

by redshift

I’m pretty excited about Go, the new programming language from Google. It’s been my obsession over the last few weeks, and I think if you’re a programmer, you should learn it.

Why did I start? Out of respect for its creators, Rob Pike and Ken Thompson. They helped create and popularize Unix, C, UTF-8, Plan 9, and many other things. It may seem like they’ve been under the radar lately in their research wing at Google, but I think they’ve just been building up a foundation of code and ideas.

Why is it exciting? It seems to have solutions for concurrency, compilation speed, and safety, while still looking somewhat familiar. You can run hundreds of thousands of concurrent goroutines. The entire Go library compiles in ~5 seconds. Go code runs almost as fast as C, without even being optimized yet. It’s type-safe without being too verbose.

It’s not as high level as Ruby or Python, but it can be more mentally satisfying in an OCD geek kind of way. It’s C without the pain.

Sure, it took ideas from Alef, Limbo, Newsqueak, and other languages (watch this then this for proof, and for enlightenment) – but how else can you make progress? Go has the momentum those languages never got.

And I, for one, am glad that the legacy of Bell Labs lives on.

Read the rest of this entry »

10 Ways to Get Inspiration as a Programmer

by redshift

Sometimes I fall into the trap of reading about programming and not programming. I can’t always find an interesting project to work on, even though I know there are a sea of opportunities. If you have the same issue, here are some tips that might help.

  1. Hang out with other programmers. This is the best source of inspiration because, naturally, they’ll have ideas that you won’t. It doesn’t matter if it’s just some coder friends, a programming group, or even a conference. The mixing of all those ideas is sure to give you a fresh perspective.
  2. Hang out with non-programmers, too. First of all, it’s healthy to be around people that make you happy or challenge your thinking, whether or not they code. Second, they can give you inspiration from a user’s perspective. What frustrates them about their computer? Can you come up with a solution?
  3. Have a dedicated workspace. If it’s not possible to have a dedicated space, at least make sure it’s quiet and you can focus on the computer without distractions. Make it your cave. Make sure your chair is comfortable and supports your back. Have water handy. Don’t sit without moving all day — stay healthy.
  4. Have a good development environment. The software version of the previous tip. I don’t care which editor you use (though I recommend vim) but make sure you’re using one that gives you some power and flexibility. Always use source control – in particular, I recommend you learn git because of the concepts it will teach you. Always back up your work. All of this will prevent the massive demotivation you will experience if you don’t use them and you lose your work.
  5. Keep your ears open. Read the twitter feeds and blogs of the programmers you respect. (Look at my twitter feed if you want – it’s mostly programmers.) RSS aggregators, such as Ruby Inside, or the old-school Planets, can be great sources of news because they add prominent new programmers without you having to search. Pick a few blogs on topics you wouldn’t normally read, and subscribe to them too.

    Yes, this can get you sucked into the trap of reading code and not writing it, but being plugged into the larger coding ecosystem is good for you and can be the source of many ideas.

  6. Read good code. Think of some software you love and look at the source code. What problems did they have? How can you learn from it, or better yet, how can you improve that software? There are many sources of good code, but GitHub has to be one of the best. The GitHub Rebase series on the GitHub blog lists a number of notable new projects if you want some specifics.
  7. Read the rest of this entry »

Programming Language Websites Need Code

by redshift

Please – if you’re making the website for a programming language, show some code. What could possibly be more important?

Firebug on Linux

by redshift

Thanks to Kenny for a tip on how to use Firebug on Linux. Firebug is a great web development tool, but it only works on Linux if you compile Firefox with “–enable-jsd”, or in Gentoo, if you use the “mozdevelop” USE flag. To see if you have jsd support, just go to your build config and search for “jsd”.

MiniPCI for Wireless

by redshift

For the love of God, if you’re having trouble getting your wireless NIC recognized on a linux laptop, make sure you have MiniPCI turned on in your BIOS. Don’t waste half a day like I just did. It’s not worth the massive headache. (On the bright side, I learned a lot.)

The Object Oriented Office (with Duck Typing)

by redshift

It seems to me that modern offices have a bad model of operation. They usually involve a strict hierarchy of employees with orders given directly down one level. Information filters down when needed, and flows up when requested. Changing the hierarchy itself is a very slow process, and has little to do with the type of information that moves.

Allow me to geek out a moment. Object-oriented programming is a Good Thing because it abstracts out some messy details from other types of languages. Rather than having a function like do-something(with, some, values) you get object-with-state.do-something(another-object). This is important for several reasons:

  1. It’s often easier to think about objects and interaction than processes with specific inputs and outputs. For example, you kick a football. It makes more sense to say you kick it [you.kick(football)] than to say there is a kick occurring, with you and the football being primary participants. [kick(you, football)]
  2. Objects abstract away ugliness. A lot of things in a program can logically be thought of as objects. Say you’re getting information from the web. The site is an object, the receiving computer is an object, (perhaps the stream is an object) and all these objects interact nicely. Each thing knows how to deal with its own information, each thing can exist alone or it can accept input from others. A football object knows to slightly deform and rocket away when it’s kicked. The kicker doesn’t have to know that. If everything had to do every job, it couldn’t be as efficient. Abstraction creates efficiency.

Object-orientation isn’t a one-size-fits-all solution, but it’s often a godsend.

Duck Typing is a concept from Ruby, or at least it was popularized by Ruby. Type systems in general determine how a language deals with different types of objects or values. Static typing systems bind variables to specific data types, whereas dynamic typing allows a variable’s type to change. Duck typing, on the other hand, doesn’t care what type a variable is – if it responds to certain signals of a type, it is that type. If it walks like a duck and quacks like a duck, it is a duck. (thanks Dave)

Where am I going with all this? These models are a perfect fit for an efficient office.

Read the rest of this entry »

Follow

Get every new post delivered to your Inbox.