Search
Enlightenment
  • Beginning iPhone 3 Development: Exploring the iPhone SDK
    Beginning iPhone 3 Development: Exploring the iPhone SDK
    by Dave Mark, Jeff LaMarche
  • Code Complete: A Practical Handbook of Software Construction
    Code Complete: A Practical Handbook of Software Construction
    by Steve McConnell
  • How to Break Software: A Practical Guide to Testing W/CD
    How to Break Software: A Practical Guide to Testing W/CD
    by James A. Whittaker
  • How Linux Works: What Every Superuser Should Know
    How Linux Works: What Every Superuser Should Know
    by Brian Ward
  • Rootkits: Subverting the Windows Kernel
    Rootkits: Subverting the Windows Kernel
    by Greg Hoglund, Jamie Butler
Blog Archives
Powered By

Want an awesome looking site like mine? Look no further than Squarespace.

Looking for a Web Host or a Domain Name registrar? Check out Bihira.

Entries in Programming (16)

Wednesday
03Feb2010

I Really Want to Be Able to Put if Statements on the RHS of an Assignment Operator

That's pretty much my whole rant right there in the title. But I suppose I should elaborate a little.

At work, I write a lot of code in Progress (I know, nobody's ever heard of it.) In Progress, you can put if statements in the RHS of an assignment operator, like so...

Click to read more ...

Saturday
19Sep2009

Are Small Coding Tricks Worth It?

The following code snippet is part of the PAUSE BUTTON implementation in a video game. The game is paused by setting Time.timeScale to 0 and it is unpaused by setting it back to 1.0.

if (GUI.Button(Rect(25,100,100,30),"PAUSE"))
{
    if (Time.timeScale == 1.0)
    {
        Time.timeScale = 0;
    }
    else
    {
        Time.timeScale = 1.0;
    }
}

The code is simple and straightforward. The solution is logically consistent with the way most people would naturally think through the problem. But is this the most efficient solution? With just a little more thought, one might come up with something similar to the following solution.

if (GUI.Button(Rect(25,100,100,30),"PAUSE"))
{
    Time.timeScale = 1.0 - Time.timeScale;
}

Click to read more ...

Saturday
08Aug2009

Pass-By-Reference Error Handling?

I'm going to try something new here. Normally when I write a post, I think through everything that I want to say before I start writing. But I think I'm going to just shoot from the hip on this one and see what happens. Since I'm just writing this as I'm thinking about it, the end result may be brilliant or it may be senseless drivel that will make you dumber by reading it - Proceed with caution.

I was just reading Joel Spolsky's argument against programming with exceptions, and I'm inclined to agree with him.

A better alternative is to have your functions return error values when things go wrong, and to deal with these explicitly, no matter how verbose it might be. It is true that what should be a simple 3 line program often blossoms to 48 lines when you put in good error checking, but that's life, and papering it over with exceptions does not make your program more robust. I think the reason programmers in C/C++/Java style languages have been attracted to exceptions is simply because the syntax does not have a concise way to call a function that returns multiple values, so it's hard to write a function that either produces a return value or returns an error.

While I completely agree with this, I think one could argue that we do have a way of returning multiple values: Pass-By-Reference.

Click to read more ...

Monday
20Apr2009

The Default Case Dilemma

I have to confess something. In my last post, I talked a lot about good coding practices. Well, it seems I have a tendency to break one of my own rules. I was looking through some of my Memories of Hyrule code and I realized that I have a tendency to leave the default cases, in my switch statements, blank.

Click to read more ...

Saturday
11Apr2009

A Passion for Programming

I Love CodeThere exists programmers who do not love what they do... I know, I can't believe it either.

To many, software development is just an everyday 9-5 job. But to others (such as myself), programming is practically a way of life! But I suppose not everyone can have the same love for code that I do. Not everyone can really admire the elegance of a well-formed recursive function. Not everyone can read a piece of code and appreciate it in the same way that others might appreciate a song, film, or book. But the problem is not that there are people who don't love software. The problem is that there are people who don't love software despite the fact that they CHOSE a career in which they write it every day.

But how do I know? How do I know that the people writing software don't love it the same way that I do? How do I know that people chose to go all the way through school in order to start a career in a field that they don't love?

I know because I read their code.

Click to read more ...

Saturday
14Mar2009

What Makes a Good Programmer?

 

I just came across this awesome video, and thought I'd share it.

Richard Buckland, a UNSW professor, discusses problem solving, craftsmanship, and what it means to be a good programmer. If you enjoy this video, you can watch his entire COMP-1971 course here.

Click to read more ...

Sunday
01Mar2009

10 Random Thoughts

  • No matter how good your code is, once it becomes legacy code, the person maintaining it will hate you.

  • 9 times out of 10, the Copy Paste Modify approach to programming results in more work than just coding it all from scratch.

  • Coding in Objective-C just feels awkward. Sometimes I think they did things different from C/C++ just for the sake of being different.

  • The idea of weakly typed languages annoys me.

  • I tend to do my best work around 2AM. They should make it a law that all programmers are allowed to set their own hours.

Click to read more ...

Saturday
21Feb2009

Add a Custom Twitter Widget to Your Squarespace Site

Updated on June 26, 2009 by Registered CommenterErrornix

Twitter BirdAs I'm sure you've noticed, I recently added a Twitter widget to the site. Twitter does a pretty good job of getting you started with a generated chunk of HTML/JavaScript (or Flash). But I figured I'd go ahead and describe what all I did to add the widget to Squarespace as well as give some insight into how you can customize your Twitter widget.

Click to read more ...