More Ramblings from a Los Angeles Programmer

September 18, 2007

New Turing Omnibus Mentioned!

Filed under: books, coding, technology — Josh DeWald @ 1:08 pm

For the longest time I seemed to be the only person who loved this gem of a book (I even emailed the author recently and got a nice reply).

Jeff Atwood at Coding Horror just mentioned how great The New Turing Omnibus is (and even points how that he had never really heard of it). He points to an Everything2 article that has a the complete Table of Contents (there’s only 66 chapters)… which I actually put up there in 2002!

It would not be a stretch at all to say that this book is what started me on Computer Science. I was already starting to code in BASIC when I began it (somewhere around Junior High I think), but it opened up a whole new world using very accessible chapters. This was the first time I heard about the Mandelbrot Set, Neural Networks, Cellular Automata (Game of Life!),  and 63 other core Computer Science topics.

Anyhow, Jeff’s article is really where you should head to read about it. Then you should then head to Amazon (or wherever) to buy it.

September 15, 2007

Stepping to the Dark Side

Filed under: coding, technology — Josh DeWald @ 12:43 pm

So I’m working on a hobby side project with a friend and his preference is to use the Eclipse IDE for the Java development. Eclipse makes things so “easy” that an Ant build script wasn’t included in the source repository. My entire Java development history (4 years or so) has been emacs for editing (and sometimes compiling, I like emacs jump-to-error stuff), and command line (using Cygwin) for the building and source control. So naturally I was a bit “put off” by not having an easy way to build, test and deploy the code (which my friend readily acknowledged).

I spent some time creating a basic Ant script which allowed to build the app. Then the JUnit tests didn’t work, because Ant doesn’t yet have support for JUnit 4. I google’d around for the solution, which was to add a suite() method which makes use of a JUnit4TestAdapter. Most of the tests ran but the ones that depended on external libraries still didn’t work, despite the fact that my classpath was set up properly as far as I could tell.

More and more in my life I prefer to not spend time fighting with my environment, so I gave in and decided that I’d give Eclipse a spin… go to the Dark Side. My friend said I should get the “Web Platform” version, which has integration with the JEE and web framework stuff.

Once I got that installed, it also grabbed the SVN Plugin and pulled the source repository down.

I’m still a bit ashamed to admit it, but I think I like Eclipse for the most part.  Everything you can do it in can be done in emacs (or from the command line) with the right modules and whatnot, but really just not as easily.

It’s nice to right click on a class and say “Create webservice” and also generate client stubs. It’ll warn you if the class isn’t compatible with standard WS-I formatting so that you can make sure to create compliant ones (i.e. no method overloading, objects must be easily serializable and public).

It’s nice to add a new method to an interface and be able to “Quick Fix” the concrete implementations to have a default implementation of the method.

Having standard Refactoring patterns available is awesome… having the option to change a method name and have that result in all usages changing is great.

CTRL+Shift+M to add an Import, very nice.

I’m digging on “create setters/getters”. As an aside, I’m going to admit, publicly, that I honestly see no real problem with exposing *properties* as public variables. I don’t actually do it (except for internal classes which I’m treating as structs for keeping some values together) but I honestly find that it is completely unnecessary 95% of the time to actually do get/set vs just allowing access to the method. I’ve also had times when I’m glad that I *did* have the getter, when I needed to delegate it or do some sort of change notification, etc. I’m just saying, that’s usually not needed…

Constant recompiling and the “intellisense” (or whatever Eclipse calls it) for choosing a method is awesome. I worry that those will change my coding style such that I’ll start forgetting how an API looks and will always wait for it to give me the options. I think the auto recompilation could have the effect of ruining my “flow” if I’m consantly trying to fix the all the “red” that shows up during a high speed laying down of an algorithm.

Also, one of the things that has kept me away from feature-rich IDEs is the fear that I’ll “lose touch” with the code. I really like knowing where each and every file is in and how it affects the system. When everything is accessible via a context menu or through auto-generation, I worry that my understanding of how the system really looks will become disjoint. But I’m finding that that fear seems unjustified. Eclipse absolutely doesn’t hide these things from you. When you generate a Webservice, it clearly creates WSDL and service description files. The package structure is readily apparent, you don’t just have a big list of classes with no rhyme or reason (unless you created it yourself, Eclipse certainly isn’t going to).

I’ve been experiencing a lot of lockups, which I think might be related to not giving enough memory (but 256MB should be enough!). I’ll do something trivial like want to create getters/setters and it’ll just stop responding. This happens to me at least once a session. My friend says that this has never happened to him before.

I’m still evaluating and at work I’m still an emacs guy (not that I get to code all that often any more), but if I continue to feel productivity gains from not worrying about the “little things” and can focus on the core algorithms and component interaction, then I think I could become a convert.

… especially once I find the “generate Ant build script” plugin or option.

August 22, 2007

Mentors

Filed under: coding, daily life, technology — Josh DeWald @ 7:00 pm

I have been fortunate in my, admittedly brief, career and that I was blessed with two mentors in my early* career. Some of the really cool aspects of the situation were:

  • They were friends
  • They sat next to each other
  • They were very different personality-wise

The fact that they were friends was great because I could speak and work with either one of them and be able to reference the other without there needing to be additional context added. Each understood what the other’s viewpoints were.

In the early days of my employment at my current company they had cubicles (low-walled) across from each other so at any time, depending on my mood, I could decide which I was going go to for advice. But since they were so close, either could chime in with their thoughts, which created an awesome arena for hashing out ideas.

The last was perhaps the most important because, far from getting the “company line” they had very differing views on a lot of technical decisions in addition to their way of conveying their ideas. This is not to say that the actual ideas they had were always the opposite, it was more the way they felt that the solution should end up getting done. For instance, they may have both agreed on the “ideal” solution, but one of them, we’ll call him Jerry, really would want it to be done in the most elegant and closest to the “ideal” as possible and was very opinionated on it. The other, Jess, was more practical and would tend more toward feeling that it was ok to get it done within a reasonable time-frame while at least trying to keep the ideal in mind. He did not advocate just “hacking it together” by any means, but rather acknowledged that there were time and system constraints that would make it prohibitive to do it perfectly.

What this meant for me was that on any project — especially when I myself could come up with multiple solutions or felt that my current design wasn’t feasible or featured a lot of “you don’t need it yet” — I could go to them for advice and, depending on who I chose, either argue the crap out of it until the way it was going to be done became clear or be gently led toward a design that both solved the problem in a good way but also took into account compromises that resulted from the context surrounding the problem (such as time, previous designs, etc).

I should have mentioned earlier, but neither of these guys are/were “Architecture Astronauts” were just lived in the clouds of design. Both of them can and do write amazing code that other people use willingly in their own projects. Writing together (they really were friends and worked together well) as well as alone, they wrote the Sourceforge-hosted object relational mapper (ORM) system that our company uses, a J2ME UI framework used in multiple production and internal applications, a regular expression library which was incorporated into the GNU Classpath project, among many other things. One was responsible for the design of the core system that we use at our company, which services millions of transactions a month. Together they did much of the initial implementation.

In short, they know what they hell they are talking about and I am incredibly thankful that I had them at the start of my career (and continuing today) when I was fresh out of college. They took chances in me (giving me projects that I probably hadn’t actually demonstrated the ability to deliver on) and let me make mistakes, never ever forcing me to do it their way.

As readers, you’re in one of 5 camps:

  1. Know exactly who I am talking about but perhaps haven’t worked with them
  2. In addition #1, have had the pleasure of the same experiences that I have
  3. Can think of somebody who has acted in the same way for you
  4. Have not had a mentor
  5. Are the people I’m talking about

For #1, Rest assured, if you were uncomfortable hearing myself and “Jerry” having rather loud discussions, there was definitely no anger involved in our discussions, only passion about what we did.

For #2, You know exactly what I mean by all of this.

For #3, Hopefully your experience was as positive as mine and you know exactly what I mean. Go be a mentor for somebody else who is just starting out.

For #4, Find one! I don’t think it matters how long you’ve been in the industry, you’ve got a lot to learn, we all do. If nothing else, at least find somebody that you respect that you can bounce ideas off of. It’s ok to be unsure about how you should design or implement something, you may find that as you discuss it that the “right” answer just seems to coalesce. It might not be perfect, but it never will be. Unless you’re working completely on your own, time will always be a factor. You can’t rewrite a whole system to let your new idea “plug-in” without taking time and resources to do it. But if at least you agree on the compromises with someone you respect, you can feel good in knowing that at least you’re doing the best you can do within the constraints.

For #5, thank you, both of you.

* I’m specifically talking about my early career here, but not to imply that I don’t still have mentors because I think that in some ways every developer (and even non-developer) I meet or read about can act as a mentor in some form as they end up teaching me something. I truly believe, and have been known to say on occasion, that you “learn something every day”

July 5, 2007

What frameworks do you use?

Filed under: coding — Josh DeWald @ 11:50 am

Just kidding, I don’t really care. I’ve been wanting to write on this topic for a bit but haven’t been able to figure out how to go about it. In some ways, I probably don’t need to, because there so many absolutely stunningly written blogs out there that can convey the things I want.

I recently saw this entry via reddit which made me go “Eureka!” because it conveys so well the ideas being my posing of the question: “What’s the problem you’re solving, and what’s the algorithm you’re using to do it?” rather than “What framework are you using to solve your problem?”

In it Reginald Braithwaite discusses the idea of certifications and what his certification would test. Most importantly is the idea that it wouldn’t test any specific frameworks, languages, methodologies or tools. Almost as importantly, he says that he wouldn’t be able to pass it without studying. A lot.

His certification would test your knowledge of and ability to… test. This is such an amazing concept because what it really means is that it tests your ability to actually understand what you’re building. Sure, you can make sure that when you click a button that a screen is displayed. But:

* What’s supposed to be on that screen? (And how do you know?)
* What did a user do before clicking on that button?
* Why does the user care what’s on that screen?
* What happened between pressing the button and displaying the screen?

The last question is the most important: you can just have a static “Web 0.5” static HTML site if pressing a button just results in a static screen being rendered without processing occurring.

Being able to design for testing means that you can state, at the beginning that: “Given a set of inputs I with values (A,B,C,…) the end result will be R“. And then you can verify that this is true before you write the code that does it. Using this as a black box, someone on the outside doesn’t have to care how it gets done but merely that it does get done. A non-programmer can use the statement and understand what is supposed to happen, but they don’t have to care how. What they can do is say “Hey, wait a second! When I enter (A,B,C) I actually want R2 to happen!”. This is a powerful notion indeed.

So many of the problems with our (and I include my own here) systems is that they aren’t actually tested or even, more frighteningly, testable. We just hacking on it until it appears to do what we think it might need to be doing. “Yeah, that looks right.” Meanwhile, every time that button is pressed data is being recalculated (what algorithm? why?), a database is being pulled (how do you know the query is correct?), servers are being connected to (securely? what protocol?) and a screen is being rendered (sure you didn’t miss any of the returned data?).

The actual framework you’re using for all this doesn’t matter. Sure, it might help you do it because it makes it easier to quickly generate the application. But that doesn’t make the code correct at all. Even a little bit.

Just because it looks pretty doesn’t mean that it’s actually solving the problem.

Anyhow, please read Reginald’s blog (I’ve just recently subscribed to it, it has a lot of good stuff) and other people’s. Subscribe to my ‘starred’ items which are articles that I think are particularly good (not always about programming). There’s also my ‘programming’ feed which are all the blogs I subscribe to related to software engineering/programming (warning: it includes reddit as well, which tends to have about 50 entries a day). Yes, I group programming and software engineering together because one can’t be done without the other and I don’t want to argue about the differences right now.

Note that I can’t tell whether or not you subscribe to either of these.

Lastly, don’t just go and take my word on anything I say. These are just my opinions, which I’m forming and re-forming all the time as I design, interact and fix systems on a day-to-day basis.

Note: I would consider a programming language just another framework.

Update: Realized that I said “we” instead of “he” when talking about not passing the certification test, which I think is a big distinction.

July 2, 2007

Considered Harmful?

Filed under: coding, linguistics, technology — Josh DeWald @ 5:55 pm

I’m just curious if anybody knows where the “<Something> Considered Harmful” idea came from? I have a vague sense that it was something LISP or programming language related, but I’m not at all certain of that.

Examples:

Go To Statement Considered Harmful

 “Considered Harmful” Essays Considered Harmful

You know what’s hilarious…. I think the “Go To” one is the original… or at least that’s the one I was thinking of when I said “programming language related”.

My original search was specifically “origin on… ” or “source for…”. Perhaps I should have just searched for “Considered Harmful” as I did to locate references.

Update: I received a comment (and reread my post) and realized that it sounds like I’m saying “X” (as in the windowing system) is considered harmful. I mean basically where does “Considered Harmful” come from. Added examples.

July 1, 2007

This is why Open Source exists

Filed under: coding, technology — Josh DeWald @ 4:09 pm

Stumbled on this page which lists some “traits” of hackers (in the sense of people that like to investigate and hack on things, not ‘hack’ into computers illegally).

Seven Habits of Highly Effective Hackers

Reading this, you realize why open source software exists: passionate and curious people who scratch that itch by writing code in the long hours of the night because they love doing it.

The end result is often quite useful (Linux, Firefox, Gaim, gcc, emacs, apache, perl, WordPress), sometimes just fun (FreeCiv, Tux Racing) and always educational (but possibly only for the person who made it) and hopefully inspirational (“Wow, something that good is both free and I can see exactly how it was made and even contribute!?”).

Software development is one of the few things that a person can do both professionally and as a hobby with the exact same tools: a text editor and a compiler. Something on the scale of Firefox can’t be made in a day, or even a month, but it can actually be done with no cost and lots of dedication. Linux itself was actually created by a single person (Linus Torvalds), but is now worked on by thousands of people in both their spare and professional time.

I encourage any developers out there who read this to look at any code you’ve written in your spare time (or even professional if you can get your employer to agree to it) and ask yourself if this could benefit the community at large even if you haven’t completed it. Maybe you have a pet project that you started but ran out of time for. Release it under one of the Open Source licenses. You can have as much or as little control over what people do with it as you want.  I can’t guarantee someone will pick up the torch and use it, but you never know. And if you’re not using it, why not? If someone does use it, you’ll have the satisfaction of knowing that you made somebody else’s life easier and creating something useful(!).

Go forth and code!

June 30, 2007

Combination Java NES/C64 Emulator source release

Filed under: coding, technology — Tags: — Josh DeWald @ 10:26 pm

I finally bit the bullet and “packaged” up my Java-based NES and Commodore 64 Emulator.

The delay has been for multiple reasons:

  • Laziness – I knew that I couldn’t just tar it up and send it out, but needed to do some cleanup, take out some files, etc. I had some time on my hands, so figured why not.
  • Fear – I don’t think it’s just me, but it’s kind of scary to let other people see the code you’ve written when you know that it’s not perfect and poetic and all that. However, it does in fact work so I figured that was a plus. I don’t believe the code is monumentally horendous either. There is a diagram of of the architecture available on my wiki.
  • Potential Uselessness – There are a lot of other emulators out there at have been in development for a lot longer and are open source. I did this purely out of curiosity to see if I could, so don’t download this expecting to pop in any ROM and go with it. Some work, many don’t. There’s also no sound. Nestopia is the emulator I used when I wanted to see how a game was supposed to look/work. I don’t know if it’s open source or not however.

I’ve finally overcome those and just decided to get it out there.

I’ve decided on the BSD software license. What this means is that you can take this and basically do whatever you want with it, but if you release something based on it, you have to include my license with it. I initially planned on going with GPL, but it felt too restrictive in this case. In my dream world, people will download this, fix bugs and contribute them back. That would also be highly unexpected.

It is my hope that the architecture is simple enough that a person could at least use this to see how they might go about creating an emulator (especially 6502/6510-based ones such as the Apple II). It would suck if it serves as a way to _not_ make an emulator, but I can accept that too. It’s fairly object oriented in structure, but in my testing (I modified it so that the instructions were executed as methods rather than objects) this did not prove to be a major performance issue. That said, it just barely runs at full speed on my machine and it doesn’t have any timing code in it. So clearly there are some inefficiencies in it.

As I’ve mentioned previously, the greatest moment of development (which also represented the end for the most part) was when my wife actually sat and played Super Mario Brothers 3 for 4 hours straight on it. The idea that kept me going after I had it “working” was that for her, SMB3 was what it meant to have a Nintendo. Unfortunately, at that time I didn’t have the gamepad adapter so she had to use the keyboard. By the time I got game controller stuff working, she and I were basically over it. Such is life.

Anyhow, you can download it here.

It is also available on github now: https://github.com/jdewald/qjnes

Note that to use it easily, you should have Ant installed, but it’s not required. Please put any comments here if you do download it and have questions about usage, why it sucks, why it’s cool, or literally anything at all.

June 2, 2007

Playing around with RSS

Filed under: coding, meta, technology — Josh DeWald @ 7:31 pm

I finally got around to doing some non-work coding after going to Google Developer Day 2007 (in London). One of the big themes was ‘mashups’, which have become pretty common. Anyhow, I’ve never been much of a web developer, but I’m a huge user of Google Reader and probably add at least 1 feed a day. Anyhow, while I was there I remembered that I’ve been wanting to “classify” the data in them so I can group them together, maybe pull some trends out.

I’m not really anywhere near that yet, but I’ve got a “feed analysis” toy up on my site. When you’re there you’ll quickly see how much I’m *not* a web developer. You can just enter the URL to an RSS feed (by default it’s just the feed from my blog) and it’ll try to extract the “interesting” phrases and sentences from it. I’m not quite sure where I want to go with this, but I hope to keep tinkering with it enough that it becomes something  useful for me. I believe there are already similar tools out there, but it’s still fun to play with.

Would love to hear from anybody on what types of features you’re looking for in terms of feed grouping/trending. Right now it can really only serve as a sort of ‘auto-tagging’ tool. I’m interested in document classification, but am fairly new to it, so as my naivety goes down, so should the tool.

May 21, 2007

Sometimes you just need to read the code (RTFC)

Filed under: coding — Josh DeWald @ 4:54 pm

Someone asked Raymond a question (that dealt with MFC code that he’d never seen or known the workings of) and he solves it by going to the code (which the person asking has access to as well).

Honestly, that’s what you have to do sometimes. In a perfect world, every system will be 100% documented (and the documentation will be easy to find… which is half the battle). But how often does that actually happen? In this particular case, part of the question *is* documented and clearly available.

The code will always tell you exactly what the system is doing (not to be confused with what it *should* be doing), and the code never lies. Every developer should be capable of finding answers to their problems by reading the code in question, assuming they have access to it. I know that sometimes you really just want the answer in a quick way (after all, time is money and all that), especially if someone knows the answer off hand. But you’ll be more knowledgeable about the system you’re working in, in addition to being able to honestly say you’ve looked as deep as you could to solve your problem. You might even find bugs!

Much of the time that someone asked me a question about our system I end up… looking at the code. I’ve done it enough times that I happen to know where to look but I don’t necessarily know the answer off hand. But when I started out, I had obviously never seen the code base (in fact, I’d never even coded in the language it was written in) but reading the code taught me the system. Often the reason I was in the code was to troubleshoot a problem, so I had to figure out what the system was *supposed* to be doing, so that I could make it do that.

Perhaps a new phrase is in order, RTFC. Note that that ‘F’ in that phrase should never been taken as harshly as the spoken version actually sound, but if you can’t help it… RTC.

Update: Apparently RTFC has been coined previously.

May 20, 2007

Never Finished

Filed under: coding — Josh DeWald @ 9:57 am

or… Zeno’s Paradox as an Analog to Software Development

Ask any developer out there if a program is ever finished and they’ll tell you “No, of course not, I still need to…”. But, ask any developer out there if the program is almost finished and, assuming that the development cycle has progressed far enough along, their answer will invariably be “Yes, all I have to do…”. They may even quantify it: “80% complete”. Ask them a couple of days, weeks, months (depending on the magnitude of the project) later and you will get a similar response, but with a different percentage, say 90%. And so forth… but never 100%.

No real point here I suppose, but just the observation that it sounds remarkably like Zeno’s Paradox of Motion. I particularly like the version, apparently invented by Philip K. Dick, about a frog jumping out of a well: every jump takes him halfway out so therefore he can never get out, because there’s always another half (of the previous jump) to go.

And so it is with software development.

« Newer PostsOlder Posts »

Blog at WordPress.com.