I came across this via Daring Fireball today. There’s a lot more than a grain of truth to what it suggests about how what most user interfaces look like.
Author: Scott
Time to buy an iPhone?
I went to the barbershop on Friday. During my haircut, I ask my barber how he likes the iPhone. He doesn’t just like it, he loves it. I got quite a sales pitch from him. Then the guy getting his haircut next to me chimes in. He just got an iPhone as well. He actually said he’d been thinking about getting a laptop, but found the iPhone did what he needed.Of all the iPhone owners I’ve talked to since it came out (friends, fellow conference attendees, even a guy waiting for the bus in Seattle), I have yet to hear any complaints.I haven’t caved in and bought one (yet), for a few reasons:
- I’ve been kind of annoyed with AT&T Wireless lately over dropped calls
- Don’t really like the idea of a $70/month cellphone bill
- I’m kinda waiting for the next version of the iPhone (new hardware anyway)
Every day that goes by however, I find I dislike the Motorola Razr I’ve got just a bit more. The gap between my current monthly cellphone bill and that $70/month is starting to get smaller too (probably too much text messaging). I’m also not sure I want 3G badly enough to wait months and months for it.
Refactoring
Last night, I went to a presentation on refactoring by Jonathan Cogley. My notes are below:
refactor – improve the design of existing code incrementally
Code must:
- do the job
- be maintainable/extensible
- communicate its intent
Code that doesn’t accomplish all of the above is broken.
Refactorings
- rename
- extract method
- inline method
- introduce explaining variable
- move method
- inline temp
technical debt – anything that needs to be done to the code that gets put off until a later date
I found a much better definition for technical debt. It makes a nice argument in favor of refactoring (though not as good as it would be with some way to quantify and measure it).
code smell – indication that something could be wrong with the code
Code Smells
- duplicated code
- long methods
- large classes
- Too many private/protected methods
- Empty catch clause (FxCop flags these by default)
- Too many static methods
- Variables with large scope
- Poorly-named variables
- Comments
- Switch statements
- Unnecessary complexity
Even though comments in code to tend to get out of date, I’m not sure I’d call them a code smell. Wikipedia has another definition of code smell, along with a link to a taxonomy of code smells.
When to refactor:
- before a change
- after all current tests are green
Sometimes, refactoring is necessary to understand code.
reduce scope – bring variable closer to where it’s used
Be sure your unit tests don’t re implement what the tested code is doing.
Eliminate double assignments (a = b = 0) for clarity.
Each method should have only one operation/concept.
If you must use code comments, they should explain the “why”. The code should be clear enough to explain the “what”.
Favor virtual instance methods where possible in your code.
Avoid using the debugger. Write unit tests instead.
Performance improvements tend to make code harder to understand. Don’t use refactoring to address application performance.
Recommended reading:
Wireless Mighty Mouse
I saw one of these as a clearance item at MicroCenter yesterday, so I picked one up to try it out. In the tiny bit of time I’ve used it so far, the only annoyance (and a minor one at that) is turning the mouse on and off. I find it challenging to move the slider on the bottom of the mouse without clicking the mouse body a few times. I like the little trackball on the top for 360 degree scrolling (though I don’t find myself scrolling sideways much with a 24″ monitor). I haven’t played with the configuration tool much yet, but it appears to give you a wide variety of ways to customize the mouse’s behavior. We’ll see how the battery life is.
Taxes
For the first time in a number of years, I had a professional do my taxes. I’d been a TurboTax Online user for the past 6 years, but got a referral from a friend and figured I’d try them out. The parking situation wasn’t ideal, and the wait to be seen was long (over 3 hours for me), but the size of the refund I got back made it worthwhile. If you don’t mind a wait (or the fact that they’re cash-only), visit Newby Tax Service at 6315 Windsor Mill Rd, Gwynn Oak, MD 21207.
Rates are $150 for single filers, $300 for businesses. The charge for e-filing is an additional $80.
Null Coalescing Operator
I didn’t know about this C# 2.0 operator (??) until ReSharper suggested it as a replacement for a particular use of arithmetic if (?:) that I’d added to some code recently. I already prefer C# to VB.NET because of its terse syntax and stricter compiler, so this discovery tipped the scales just that much more.
The most recent blog post Google coughed up for this operator is this one, from Aaron Zupancic. Aaron links to another post that demonstrate its use for viewstate.
Fixing Computer Science
I’ve been reading a lot of complaints about the current state of computer science education lately. This post makes a reasonable attempt at summarizing the different ideas around what sort of graduates these programs should produce. I’ve been in industry long enough that my CS program hadn’t switched to using Java as the initial language when I started. I agree with Brian Hurt and Chris Cummer about the value of a computer science degree.
The right courses in a CS degree amount to a toolbox of concepts that you can use to solve whatever real-world problem you’re facing. The most recent example of this happened on the job. We had an issue where some text files being downloaded for storage in a database kept causing failures in a process. Because of how the process was implemented, there was no way to pin the cause of a failure on a particular line of the file. The files in question are regularly more than a gigabyte in size, so manual inspection wasn’t an option. The minimal understanding I have of how compilers work enabled me to direct my staff to build a parser, so we could validate the input file before running the process against it. Without a CS background, it’s highly likely that I don’t come up with a solution at all (or a really bad implementation of a parser).
If I had it to do over again, I would have spent more time in my CS program getting better depth in compilers, operating systems, and other areas.
Computer science isn’t perfect, but it’s relatively young as a field compared to disciplines like law or medicine. There are probably things that should be changed, but I think the fundamentals are good.
TeamCity 3.0
Now there’s a freeware version of it that supports up to 20 users and build configurations. We were looking at setting up CruiseControl.NET again for continuous integration at work, but this will be much easier.
Apple Stuff
iPod nano
The iPod I mentioned yesterday is the 4th (!) one I’ve owned. Each of the previous ones was sold to help fund the upgrade to the next one. I love this one even more than all the previous ones because it handles video. The video is watchable, even at that size. The nano makes great use of the screen when it isn’t playing video too. The earbuds that came with this one are better than the previous ones, but I’m still going to buy a better set.
Thoughts on MacWorld
The most important product announced there isn’t MacBook Air–it’s Time Capsule. I think far more people will find a use for wireless drive backup than they will for a really thin laptop. Because Time Capsule also works as a router and can share a USB device (or devices if you plug in USB hub), you could conceivably share even more hard drive space and a printer to every machine on your wireless network. As far as I can tell, Time Capsule provides more capabilities than Mirra Personal Server (a comparable backup/Internet access product) at a lower price ($300 for the 500GB version) in a much smaller form factor. After a copy of Leopard, I think a Time Capsule will be my next purchase from Apple.
Birthday
I turned 34 today. I suppose I’m officially in my “mid-30s” instead of my early 30s now. Other than that, it doesn’t seem different at all from any of my other post-30 birthdays.
I did pick up a new toy for my birthday–an 8GB iPod nano.