Programming

After 38 years of glory, the long run of Dr. Dobb's has come to an end

After 38 years of glory, the long run of Dr. Dobb's has come to an end:

Like many of you, I grew up reading Dr. Dobb’s. For me, as I suspect it was for many of you, Dr. Dobb’s Journal was the lifeline to a thorough understanding of programming. I recall that when the magazine appeared in my mailbox, all other activity for the day came to a sudden stop and the remaining hours were spent blissfully poring over article after article, soaking in the information. I learned C from Allen Holub’s C Chest column, operating systems from the 18-part series on 386BSD, video programming from Michael Abrash’s Black Book, and data compression from Mark Nelson. And so on — each month brought new, enabling insights and explanations of often arcane topics.

I was a regular reader for most of the 90s and beyond. The era of blogs is what killed both BYTE and Dr. Dobbs.

Your 60-Hour Work Week is Not a Badge of Honour

Your 60-Hour Work Week is Not a Badge of Honour:

If you’re working 60 hours a week, something has broken down organizationally. You are doing two people’s jobs. You aren’t telling your boss you’re overworked (or maybe he/she doesn’t care). You are probably a pinch point, a bottleneck. You are far less productive. You are frantically swimming against the current, just trying to keep your head above water. These signs? They are not the signs of a healthy business or work environment.

This is basically 80% of the IT industry. About 1/3 of the people working 60 hour weeks are management bottlenecks that provide little to no value to software produced.

Simulation attempts to show why the rich get richer in unregulated markets.

Simulation attempts to show why the rich get richer in unregulated markets.:

This is a simulation of an economic marketplace in which there is a population of actors, each of which has a level of wealth (a single number) that changes over time.

Interesting work that reminds me of story about Milton Friedman’s grad students playing monopoly and modifying the rules to see how it changes outcome. They actually worked out a redistribution system that keeps people in the game by taxing wealthy players when they pass go and putting that money in free parking. The poorest players would then get a cut from free parking. That change kept the game going much longer then it normally would.

Evidence suggesting that young computer programmers have "bilingual brains"

Evidence suggesting that young computer programmers have "bilingual brains"

If computer programming languages are languages, then people who spoke one language and could programme to a high standard should be bilingual. Research has suggested that bilingual people perform faster than monolingual people at tasks requiring executive control - that is, tasks involving the ability to pay attention to important information and ignore irrelevant information (for a review of the "robust" evidence for this, see Hilchey & Klein, 2011). So, I set out to find out whether computer programmers were better at these tasks too.

Worth a read. It makes sense. But it makes me wonder what else counts as a language?

Tweets for 2012-06-05

  1. sdenaro: RT @iRajanand: “The program and the correctness proof grow hand in hand.” - Edsger Dijkstra #Programming #Quote

Tweets for 2012-05-30

  1. sdenaro: RT @TheRichardLewis: I never take enough credit for my failings.
  2. sdenaro: RT @iRajanand: “A program is never less than 90% complete, and never more than 95% complete.” - Terry Baker #Programming #Quote

Rock Star Developer

When I hear the term rock-star developer I assume they will work on one successful project, run up huge bills, trash the place and then leave to work on vanity projects that never deliver on their full potential.

It is no longer possible for me to edit lisp like code without thinking of inception.

23618 line Java class. Three methods with over 2000 lines. Wow.

AI Takes On Pac-Man

AI takes on Pac-Man - well, in fact it plays both sides. An annual competition challenges participants to write Java programs to control Pac-Man or the ghosts. It might not be chess, but it pits machine against machine, with algorithms going head-to-head as the AI ghosts try and eat AI Pac-Man.”

From AI Takes On Pac-Man

Reminds me of core wars. But the use of pac man is really nice.

VB6 to rise from dead as Open Source to eat brains of new generation of programmers

“Microsoft told a group of MVPs today at Tech-Ed that it plans to take Visual Basic 6 open source and will release the source code on CodePlex. A source at the event said that Microsoft is planning to release only the VB6 language on codeplex - not Visual Studio or related tools.”

From VB6 to rise from dead as Open Source to eat brains of new generation of programmers


That should have been the headline. VB is awful. Basic is a relic of the 70s and has no place as a programming language, not even as an introductory language.


Sorting algorythmes as preformed by hungarian folk dancers

making Java code pretty

Want to see what Java would look like it if were more like Python and less like C?

  1. Open your IDE or Editor, pick any large Java class
  2. Reformat code to sun standards. In IntelliJ it’s ctrl-alt-L
  3. Compress down the code so there are no braces on empty lines and no extra whitespace
  4. So back into settings and change the colors so all curly-braces { } and semicolons ; are the same color as the default background color

Stand back and marvel.

Disappointed to learn that FLX-CAP on the network diagram doesn’t refer to a Flux Capacitor.

Even though "ls -l" displays a files permissions as "-rw-r--r--", you can't use "-rw-r--r--" in a chmod command

Even though “ls -l” displays a files permissions as “-rw-r—r—”, you can’t use “-rw-r—r—” in a chmod command. This is probably one of the most obvious but overlooked UI inconsistencies in Unix that nobody has fixed after all these years. Instead we force people to learn octal and type 0644. Meanwhile every book on Unix/Linux spends pages explaining octal just for this purpose. Time would have been better spent contributing a patch to chmod.

From Everything Sysadmin: Random technical tips, thoughts and rants

This is one of those oddball UNIX things that no one seems motivated to fix. Kind of how case sensitivity flag is either -f or -s or -i or -c depending on the command, its mode and what you mean by case sensitivity.

Nine traits of the veteran Unix admin

Unix boxes don’t need reboots. Unless there’s absolutely no other option, we’ll spend hours fixing a problem with a running system than give it a reboot. Our thinking here is there’s no reason why a reboot should ever be necessary other than kernel or hardware changes, and a reboot is simply another temporary approach to fixing the problem. If the problem occurred once and was “fixed” by a reboot, it’ll happen again. We’d rather fix the problem than simply pull the plug and wait for the next time.

From Nine traits of the veteran Unix admin

I’ve seen admins start a Virtual machine and route services to that virtual machine while they fix the host server just to avoid having to reboot.

Fusion Tables Will Be Available in Google Docs

Fusion Tables is an interesting service launched last year in Google Labs to help users manage large data sets. “Fusion Tables is not a traditional database system focusing on complicated SQL queries and transaction processing. Instead, the focus is on fusing data management and collaboration: merging multiple data sources, discussion of the data, querying, visualization, and Web publishing,” explains Google.

From Fusion Tables Will Be Available in Google Docs

Looks really cool. A database system in the cloud.

Oracle To Monetize Java VM

jtotheh writes “According to the Register, Oracle is going to make two tiers of Java Virtual Machine - a free one and a premium paid one. ‘Adam Messinger, Oracle vice president of development, told QCon that Oracle plans to offer a “premium” edition of the JDK in addition to the open-source JDK. Both, it seems, will be based on a converged JRockit VM and the Hotspot JVM from Sun Microsystems. The converged JVM will be released under the OpenJDK project. … Messinger didn’t explain how the premium JVM would differ to the free version, but the premium edition will likely see performance tuning and tie-ins to Oracle’s middleware.’”


From Oracle To Monetize Java VM

Everyone was expecting this.

Bee Solves Travelling Salesman Problem

Researchers at Queen Mary, University of London and Royal Holloway have discovered that bees learn to fly the shortest possible route between flowers even if they discover the flowers in a different order. This ‘Travelling Salesman Problem’ often takes supercomputers days to solve, but Bees are now the first animals proven to do it. Computer-controlled artificial flowers were used to track the bee’s path and found they quickly learned the shortest route. Since a bee’s brain is only the size of a pinhead, researchers are hoping to identify the neural circuitry required and use that understanding to construct their own systems that rival the computational power of existing machines.

From Bee Solves Travelling Salesman Problem

Worth a read. Doubly so if you have ever taken an algorithms course.

Mirah: Taking Performance to the Next Level with Java's Ruby - O'Reilly Broadcast

Mirah is an attempt to take the Ruby language, make some minimal changes to the language and create a new language which can be compiled to bytecode. Mirah’s challenge is to take Ruby, make minor modifications to the language, but not too many to change the ‘Rubyness’ of the language: the simplicity and usability of Ruby.

Much of the benefit of Mirah over similar languages comes down to being so lightweight. In Groovy, Scala, JRuby, Clojure, or Jython, the minute you write “Hello, world”, you’ve shackled yourself to a runtime library. In Mirah, “Hello, world” is just as terse as in JRuby, but has the added benefit of not foisting any dependencies on you; source file goes in, class file comes out, and that’s it. I believe the JVM needs a new dependency-free language, and Mirah is my attempt to deliver one.

I like the idea of Mirah but there are a couple of things that come to mind.

  • Are those runtimes really that much of a problem?
  • Is in-lining the runtime really an improvement over distributing a jar? After all, a distributed jar can be upgraded without recompilation and that wouldn’t be possible with mirah
  • Why start with Ruby for that matter? Would Groovy be a better starting point for a runtime free JVM language?

A regular expression to check for prime numbers

While browsing today, I found this page which thoroughly describes the use of the regular expression /^1?$|^(11+?)\1+$/ in Perl to check if a number is prime or not!!!

To be frank, I was skeptical. The regular expression looks like magic! And I wanted to understand it better. I rewrote it in Ruby using irb and I tested it:


From A regular expression to check for prime numbers

Amazing. I’ve seen some really hairy regex code but that takes the cake.

One thought on the iPad

It is thoroughly disappointing to think of what a wonderful platform the iPad would be for a programming environment like Scratch and how unlikely it is that Apple will update its developer agreements to allow Scratch to run on the iPad.

Scratch on the iPad could be BASIC for a whole new generation of kids.

One thought on the iPad

It is thoroughly disappointing to think of what a wonderful platform the iPad would be for a programming environment like Scratch and how unlikely it is that Apple will update its developer agreements to allow Scratch to run on the iPad.

Scratch on the iPad could be BASIC for a whole new generation of kids.

Programmer's Font

If you do any programming at all. And by that I mean anything. HTML, Java, C/C++, Ruby, PHP, Javascript et al, do yourself a favor and download a programmer’s font. I’ve recently switched from ProFont to Inconsolata. Why? For one thing, a real programmer’s font differentiates Zero from O, 1 from i or l and has more readable punctuation.

Bad Program

no-its-not

If this is what you see when your program is running on a dual core machine, please don’t try and convince me that it multi-tasks. I don’t need to see the source. I don’t want to debate it.

web development crap

If you are paid to do web development and you are currently using any of the following in HTML you create, you have to quit job.

  1. Frames
  2. Tables for page layout (still ok for data and some other uses)
  3. Font, color, or alignment attributes in html tags
  4. 1px spacer gifs
  5. Under construction images
  6. mailto: links
  7. Hidden form elements
  8. More than four url parameters in a link
And as a reminder, buttons are verbs and links are nouns. Things like search, cancel, save and upload should be buttons. People places and things should be links. Buttons should never look like links and links should never look like buttons.
If you’ve broken more than three of these rules in the past month, you’re not allowed on the internet anymore. Go back to AOL and stay there until you learn how to use CSS and DIVs.

23 Programming Languages compared through their Amazon book sales

Saw this link: 23 Programming Languages compared through their Amazon book sales and found it rather interesting.

Not sure what it proves. On the one hand, it might show programmer interest. I know a lot of people are really into Ruby. It also makes it clear that Java/C/C++/C# and VB are still dominant. Still, I wonder how much this may be influenced by existing code bases. Ruby being number #3 with so little legacy code is really interesting. I’m going to have to give it another look. Also, the poster was nice enough to list the problems with his survey, which is really nice.

A Programming Language Like Playing With Blocks

Scratch is a creativity tool from the M.I.T. Media Lab that turns abstract programming concepts like recursion into snap-together puzzle pieces. It is like a multimedia sandbox, where children 8 and up are welcomed as media producers, following the same philosophical blueprint that inspired software projects like Logo and Squeak.
A Programming Language Like Playing With Blocks - New York Times

I played with scratch last night and was totally amazed at how good it is. First off, it doesn’t just teach “programming”. It teaches much of the principals of Comp Sci. Second, you don’t need to know anything about computer programming to pick it up.

log4j macro for eclipse

A lot of the code I am working with is filled with this line.

public static Logger logger = Logger.getLogger(RequestProcessorMgr.class);

The problem is that only one of the classes (RequestProcessorMgr) is actually using the correct class name. The rest are using the wrong class name. This is the problem with cut-copy-paste programming. Just because the code works in one part of the program, doesn’t mean it will work anywhere else. Plus, when you copy code; you copy bugs too. This is self plagiary. So if you’re going to plagiarize, don’t self plagiarize. At least put in the effort to copy from someone smarter than you.

So this is what I did.

  1. In eclipse. Window->preferences
  2. In the preferences dialog, pick “java” then “editor” then “templates”
  3. Click on “new”
  4. Enter “log4j” for “name”
  5. Enter “Just say no to incorrect loggers” for “Description”
  6. Enter public static Logger logger = Logger.getLogger(${enclosing_type}.class); as the pattern
  7. The default context should be Java. Change this if it isn’t correct
  8. Click Apply. Save.

Now, when you type log4j and hit ctrl-space you can insert a log4j property that will correctly log messages from your class.

Now back to bug fixing.

Joda Time

Joda-Time provides a quality replacement for the Java date and time classes. The design allows for multiple calendar systems, while still providing a simple API. The ‘default’ calendar is the ISO8601 standard which is used by XML. The Gregorian, Julian, Buddhist, Coptic and Ethiopic systems are also included, and we welcome further additions. Supporting classes include time zone, duration, format and parsing.
From Java date and time API - Home - Joda Time

Its been a long running annoyance of mine that out of the box, Java makes it easier to calculate the day the Eastern Orthodox church will celebrate Easter than the day a bond will mature. Because we all know there are more people using Java in monasteries than on Wall Street.

Joda is damn nice. No longer do you have to deal with months numbered 0 to 11 while the days of the week numbered 1 to 7. And a simple bond yield Calendar took about 20 minutes to put together.

Migrating to Spring

A really great article on Migrating to Spring.

This is a really nice nuts and bolts description on how to port a typical Java web application to make use of Spring’s IoC and service templates. If you do Java Web development and you aren’t using Spring; you really need to consider it.

Spring 2.0 Final Released

More here: Spring 2.0 Final Released!

I took longer to download Spring than to port my Springframework 1.2.8 App to use Spring 2.0. No performance changes to report, but I can now try rebuilding it as a JDK1.5 App. Once I update my code to use the new Generics + Collections idioms, I should see a few gains by reducing a lot of the clutter that goes with using pre-JDK1.5 collections.

I’ve managed to get other developers here to use Spring to manage their applications. The selling point was the way I added confirmation email support to a set of forms in one mid-size app. I defined an interface called EmailService and implemented an a type for each of the three forms to add. I then added one line of code for each form in application-Context.xml and a whopping five lines of code in Formhandler. Now when an edit in one of those three form is saved, and the server agrees that the edit was successful; the user and his manager gets a summery email. Doing this without Spring would have resulted in at least five times more code.

Practically Groovy

Often, programmers turn to languages like Groovy for building quick utilities, rapidly writing test code, and even for creating components that make up larger Java applications because of Groovy’s innate ability to remove much of the noise and complexity that accompanies typical Java-based systems. Groovy’s concise, yet flexible syntax frees developers from normal Java constructs that are required for code compilation but don’t necessarily help express what the program is really trying to accomplish. What’s more, Groovy’s relaxed typing removes perceived code complexity through the reduction of interfaces and super classes, which are required in normal Java applications to support common behavior among distinct concrete types.
From Practically Groovy: Reduce code noise with Groovy

The bigest problem with Groovy is the name. Most Java programmers aren’t going to get just how like Java it is from a name so far removed from the Java naming conventions. A reasonably skilled Java programmer can pick up Groovy in about an hour, and begin to reliably guess on what the right syntax would be after ten to twenty hours of use. The same can not be said about Ruby to Jython; both of which are really nice and easy to use languages. They just have a different feel than Java. The obvious name for Groovy would be JavaScript. Sadly that name has already been taken by a language that has nothing to do with Java. The next obvious name would be Dynamic Java. Sadly this is a lie in fact despite being honest in its intentions. Groovy is not that much more dynamic than regular Java. So we are stuck with Sun adding features (like closures) to Java, that already exist in Groovy. And the Java syntax for closures is likely to be as ugly as Java syntax for generics. What about Java3? That won’t work as a name either as it assumes (and wrongly so) that Groovy is a replacement for Java. It isn’t and can never be. Java’s static typing compromises, while annoying; makes it much easier for applications to safely scale.

My solution: Rename Groovy JavaGroovy. Yes the name sucks. I’m not going to defend that name on suck value. I’m going to defend it on the grounds that it lets users know that it is based on Java technologies and it adds to the Java language.

Practically Groovy

Often, programmers turn to languages like Groovy for building quick utilities, rapidly writing test code, and even for creating components that make up larger Java applications because of Groovy’s innate ability to remove much of the noise and complexity that accompanies typical Java-based systems. Groovy’s concise, yet flexible syntax frees developers from normal Java constructs that are required for code compilation but don’t necessarily help express what the program is really trying to accomplish. What’s more, Groovy’s relaxed typing removes perceived code complexity through the reduction of interfaces and super classes, which are required in normal Java applications to support common behavior among distinct concrete types.
From Practically Groovy: Reduce code noise with Groovy

The bigest problem with Groovy is the name. Most Java programmers aren’t going to get just how like Java it is from a name so far removed from the Java naming conventions. A reasonably skilled Java programmer can pick up Groovy in about an hour, and begin to reliably guess on what the right syntax would be after ten to twenty hours of use. The same can not be said about Ruby to Jython; both of which are really nice and easy to use languages. They just have a different feel than Java. The obvious name for Groovy would be JavaScript. Sadly that name has already been taken by a language that has nothing to do with Java. The next obvious name would be Dynamic Java. Sadly this is a lie in fact despite being honest in its intentions. Groovy is not that much more dynamic than regular Java. So we are stuck with Sun adding features (like closures) to Java, that already exist in Groovy. And the Java syntax for closures is likely to be as ugly as Java syntax for generics. What about Java3? That won’t work as a name either as it assumes (and wrongly so) that Groovy is a replacement for Java. It isn’t and can never be. Java’s static typing compromises, while annoying; makes it much easier for applications to safely scale.

My solution: Rename Groovy JavaGroovy. Yes the name sucks. I’m not going to defend that name on suck value. I’m going to defend it on the grounds that it lets users know that it is based on Java technologies and it adds to the Java language.

Why Johnny can't code

The “scripting” languages that serve as entry-level tools for today’s aspiring programmers — like Perl and Python — don’t make this experience accessible to students in the same way. BASIC was close enough to the algorithm that you could actually follow the reasoning of the machine as it made choices and followed logical pathways. Repeating this point for emphasis: You could even do it all yourself, following along on paper, for a few iterations, verifying that the dot on the screen was moving by the sheer power of mathematics, alone. Wow! (Indeed, I would love to sit with my son and write “Pong” from scratch. The rule set — the math — is so simple. And he would never see the world the same, no matter how many higher-level languages he then moves on to.)
From Salon.com Technology

I have to disagree on their assessment of scripting languages. Both python and ruby have an interactive command line mode that is very similar to the old-school basic I grew up with. The real problem is that the really cool stuff is all web based, so tinkering in basic has been replaced with tinkering with HTML, JavaScript and PHP. Just look at the what people are doing to their livejournal and myspace pages. That’s where the newbies are learning to code.

Today@UCI: Press Releases:

Performing what a team of dedicated and bleary-eyed newspaper librarians would need months to do, scientists at UC Irvine have used an up-and-coming technology to complete in hours a complex topic analysis of 330,000 stories published primarily by The New York Times.
From Today@UCI: Press Releases:

In the future, How you know will be as important as What you know and Who you know.

cylons

Knowing that my software errors haven’t lead to the destruction of mankind does wonders for my self esteem. Well, they haven’t yet lead to the destruction of mankind.

playsh

Now, thanks to a new software-collaboration tool, you and your intrepid party of fellow hackers can navigate your labyrinth of code and slay its dastardly bugs, all in a dungeonlike world similar to an old-school text adventure.
Called playsh, the new tool is a collaborative programming environment based on the multi-user domains, or MUDs, so popular online in the early 1990s.
From Wired News

This reminded me of the help desk guy who once referred to the users as coming after him in wave after wave like the aliens in space invaders. Now any developer can have that kind of fun.

computer scientists are usually depicted as geeks

In many popular movies, computer scientists are usually depicted as geeks with pocket protectors who are severely socially inept.
Susanne Hambrusch, head of the department of computer science, named this portrayal as one of the main reasons why less females are declaring computer science as their major.
“We brought in 155 freshman students this year and only four of them are females,” Hambrusch said. “Out of all of the undergraduate computer science majors we have, only 6 percent of them are women.”
From The Exponent

If you want to convince people that Comp-Sci isn’t just for geeks, maybe you should start be not naming your Magazine The Exponent. But I think this goes far beyond just this. There seems to be a lot of anti-intellectualism in our culture today, and it shows up in a bias against Science in general. How often do we hear the TV talking heads rail against The Elites in their Ivory Towers? The only science careers that don’t seem to suffer from this hostility are nurses and pharmacists. If they realy want to get more women in the Sciences, there needs to be a counter to the anti-intellectualism.

JavaBlackBelt

JavaBlackBelt is a community for Java & open source skills assessment. Everybody is welcome to take existing and build new exams.
This is the place where Java developers have their technology knowledge and development abilities recognized. It is dedicated to technical quizzes about Java related technologies.
From JavaBlackBelt

If someone told me they had a java blackbelt while I was interviewing them for a job; I’m not sure I could wait until the interview was over before I started laughing at them.

joel on java

Instead what I’d like to claim is that Java is not, generally, a hard enough programming language that it can be used to discriminate between great programmers and mediocre programmers. It may be a fine language to work in, but that’s not today’s topic. I would even go so far as to say that the fact that Java is not hard enough is a feature, not a bug, but it does have this one problem.
From Joel Spolsky

With respect to Mr.Spolsky, does anyone actually think that you can separate the good programmers from the mediocre ones in a Programming 101 type class? I think that’s a really silly idea. It takes years to become competent at the task of writing software. In a 101 type class you generally write small one-off programs that do not need do be maintained, in intervals of a week, with a user base of near zero. This is an atypical development environment.

joel on java

Instead what I’d like to claim is that Java is not, generally, a hard enough programming language that it can be used to discriminate between great programmers and mediocre programmers. It may be a fine language to work in, but that’s not today’s topic. I would even go so far as to say that the fact that Java is not hard enough is a feature, not a bug, but it does have this one problem.
From Joel Spolsky

With respect to Mr.Spolsky, does anyone actually think that you can separate the good programmers from the mediocre ones in a Programming 101 type class? I think that’s a really silly idea. It takes years to become competent at the task of writing software. In a 101 type class you generally write small one-off programs that do not need do be maintained, in intervals of a week, with a user base of near zero. This is an atypical development environment.

the departure of the hyper-enthusiasts

The Java hyper-enthusiasts have left the building, leaving a significant contingent of Java programmers behind, blinking in the bright lights without the constant drumbeat of boosterism.
From The departure of the hyper-enthusiasts

Not sure why the departure of the self tittled cool kids makes any difference for the legions of Java programmers that have keep in mind such things as deadlines, support and user expectations when they choose what tools to use. As it is, Java’s tool support keeps getting better. Sure, Ruby is cool. And there are some really nice Ruby tools out there. But it isn’t better enough to make switching worth it.