David S. Ackerman web cowboy (+ software development tales of the wild west…)

30Oct/101

Why frameworks are not a silver bullet for rapid development…

It had been a while since I'd worked on my current OSX app. The code seemed strange and unfriendly. But after a few hours of re-introducing myself to everything I'd written over the last year, I managed to find my groove again. That is, until I decided to try a new interface for one of the pieces of functionality. I'd actually done the same thing in another area of the application before, so it should be easy, right?

The coding gods were not on my side.

I was trying to simply turn a div inside a WebView into a contenteditable div. This basically meant putting:

contenteditable="true"

on the div tag. Try as I might, I could not get that content to be editable. To make it even more frustrating, copying the same generated HTML content out of my application and into a regular HTML page allowed me to edit the content I wanted to without issue.

There were no error messages. I whipped out the google-fu on "WebView contenteditable" and other variations and could find nothing. I tried explicitly setting the WebView component to be editable. Nothing.

By luck, I ended up stumbling on the following in my code:


- (BOOL)canBecomeKeyWindow {
  return YES;
}

which must have been how I made the other contenteditable area work. Sure enough, that was it. You run into problems like this often with frameworks. Simple things become incredibly difficult because you haven't flipped the right switch. You haven't flipped the right switch because no one said you had to. No one said you had to because they didn't predict you'd try to do this specific thing with the framework. But I did. And now after endless hours of frustration, I know not to make that mistake again. Onto the next one!

(297 words)

Filed under: Cocoa, Programming 1 Comment
28Oct/100

Brevity, my elusive friend…

I have fallen prey to one of the many clichés of blogging, developer friends. In the beginning, there seem to be far too many spectacular ideas and so little time, but before you know it, there's just this nagging thought in the back of your mind: "Oh yeah... I haven't done a post in a while, have I?"

Now, there are always several reasons any good procrastinator can give you for putting things like this off, but probably the biggest for me is the apparent inability to be brief.

Just today I told myself I was going to fire off a concise email about a design issue I wanted to discuss with my co-workers. Straight. To the point. Just the facts, m'am. And, after about a screen length of text, I figured I'd pretty much covered it.

Was it helpful for me? Undoubtedly. Writing helps me to work through ideas. I notice problems and solutions more easily than if I was just sitting there thinking. But did my co-workers need to go through the same thought process? Probably not.

When it comes to writing a blog post, something I don't really have to do, knowing that I'm probably going to go on forever about something is a good recipe for stalling.

On the art side, I've been exploring setting arbitrary limits in order to be able to still make stuff in this world of infinite possibility. I think I'll apply that to this blog as well. So here goes: this and the next 10 posts will all be under 300 words, no matter what. There, I've said it. Give me brevity, or give me backspace! (272 words)