When you don’t know the language…

internal static short uiShiftRightBy8(short x)
        {
            short iNew;
            iNew = (short)((x & 0x7FFF) / 256);
            if( (x & 0x8000) != 0)
                iNew = (short)(iNew | 0x80);

            return iNew;
        }

 

AHHHHHHH!!!!*

Nevermind that this was public even though it was used only once by the class in which it was defined. Nevermind that this was not marked static even though it uses no member functions. (Also nevermind that I made it internal instead of private so I could test it and make sure it was as stupid as I thought.)

When you learn a programming language, even when you can get things done in it, it still adds tremendous value to you as a programmer to READ A FRAKKING BOOK on the language. The above code works, absolutely. It does exactly what the writer intended. When the #1 concern when writing software is “do whatever is needed to ship it now, and you have no time to better yourself” you get this code. IMO maintainability should be #2 concern directly following “does it work?”

I’ve entirely removed the above code and replaced it with the operator and value it implements: >> 8

Yes it really is Shift Right by 8. Yes, someone didn’t know about the >> operator. Yes I wasted time reading code that uses this method. Yes I don’t want to think about the performance characteristic of this in a tight loop in critical systems.

*my coworkers laughed when I said AHHHHHHH!!! outloud. At least bad code provides us with solid entertainment.

Speculations about .NET 4.0

I found this in my Live Writer drafts. I figured I should send it, since its been a month and I haven’t thought of anything to add to it.

*insert timewarp to March 18th, 2008*

I was at the Visual Studio 2008 launch in Detroit today. This was my 3rd Microsoft Launch event. The first being Visual Studio 2005 and the second being Vista/Office2k7. As a developer the Vista launch was really the .NET 3.0 launch to me.

One thing I’ve learned that I don’t do well and I need to do better is future think. What is next?

  • ASP.NET 3.5 “extensions” will be known as ASP.NET 4.0
    • ASP.NET MVC (see MonoRail)
    • ASP.NET Dynamic Data (see Rails scaffolding or MonoRail scaffolding)
    • ASP.NET AJAX (browser history, but I expect more here)
    • ADO.NET Entity Framework (see NHibernate)
    • ADO.NET Data Services (many projects to see here, snooze is one)
    • Silverlight Controls for ASP.NET (I expect much more here)
  • Full development support for Silverlight will ship along with this release.
  • WPF finally get an editable Grid. It won’t be named DataGrid, DataGridView or GridView(exists in WPF as a ListView mode). It may be named DataViewGrid or GridDataView.
  • A WPF “Dynamic Data” library complements the ASP.NET extension.
  • The System.Core.Enumerable class gets a Each extension method. Its name endlessly confuses developers who don’t understand why it wasn’t there in 3.5 and who don’t know why it isn’t ForEach like Array and List<>. Developers start calling Microsoft’s naming difference a “catch up to Ruby”.
  • A handful of new Workflow activities are released but no one knows what they are, what they do, or how do to use them.
  • Cardspace continues and adds even easier support for OpenID but no one knows what they are, what they do, or how do to use them.
  • Like the 3.0 release the languages and compilers don’t change.
  • a DI/IoC container with a subset of the features of Windsor, Spring.net, StructureMap or even EntLib ObjectBuilder is included!
  • DLR still won’t ship. No IronPython. No IronRuby. Python and Ruby will remain the most common languages used in demo for Silverlight.
  • Visual Source Safe is still the recommended version control system if you can’t afford Team Foundation Server. WTF?
  • There will be some hidden PerfCounter, WMI, awesomeness. It won’t be documented very well.
  • Hibernate and NHibernate users everywhere are stunned and gape mouthed when they see Entity Framework. Then they fall out of their chair laughing. “We hate maintaining our single HBM files, you want to maintain 3 uglier XML files (CDSL, MSL, SSDL)?” Microsoft answers these cries with “use the designer”, but the power developers want to do things that are only possible in the XML that the designer cannot do.

History Blog Meme

Joe made me do it.

[jrwren@utonium:$] history 1000 | awk ‘{a[$2]++}END{for(i in a){print a[i] ” ” i}}’ | sort -rn | head
77 ls
38 growisofs
38 df
35 sudo
29 man
23 mv
20 x=2;y=2;while
19 cat
17 rm
16 zip

I am Speaking at the Central Ohio Day Of Dot Net

I’m excited to be talking about building DSLs with Boo.

Central Ohio Day of .NET

I actually had the pleasure of giving this talk at the Ann Arbor Computer Society last Wednesday. I was very anxious because it seems like a complex topic and I wasn’t sure how well I would be able to deliver it or how well it would be received. I’m happy to report that it was both well delivered(toot-toot) and well received. I’m now much more at ease going into Central Ohio Day Of Dot Net.

I’m looking forward to attending MUG this evening and giving a 10 minute introduction to boo. Initially, my wife vetoed my attendance, but after my name was out in the email, I convinced her that I needed to go.

Google Alerts Reminds Me of Who I Was And Who I Want to Become

Like any good Leo, I have a vanity google alert setup on my name. Leos are supposedly vain and if I am to be a good Leo, then I must vanity search myself often. Today, this link came up on my google alert. It isn’t new. It is old. It is from 2003.

from http://unix.derkeiler.com/Mailing-Lists/Tru64-UNIX-Managers/2003-05/0197.html

Date: Wed, 21 May 2003 14:42:56 -0400
To: tru64-unix-managers@ornl.gov

Hello,

I’m looking for instructions for upgrading firmware on an HSZ50. HP
says it cannot be done, but I thought maybe someone knew otherwise.

I’m also looking for vendors who sell version 5.7Z memory cards of the
HSZ firmware.

Thanks

--
Jay R. Wren

In 2003 I didn’t know that I was a programmer. My title was “systems programmer” and we always joked that the title was a carry over from when any computer operator was a “programmer”. It turns out that much of my Systems Administration work in that role was not too much different from the jobs of many programmers.

I thought that real programmers followed all those software engineering things that I had heard a little bit about when I was on college. I thought that real programmers didn’t just throw code together like I was doing at the time. I turns out that I was wrong.

Of course life is a journey in which the destination is in constant change. I never did become what I wanted to be 5 years ago. I’m sure that my current destination will change over the next five years.

Please Put Uninstall Links In The Start Menu

start -> control panel (wait 8 seconds) -> visual scan what I want to click on for ~ 15seconds and find “uninstall a program” -> wait ~13 seconds for the Programs list to complete loading. Use the search (hurray) functionality of vista to find the program I want to uninstall.  Highlight and click uninstall.

This is a too common task for me to do. It takes long enough that I avoid doing it. It should be something I can just do and accomplish without thinking about it.

I admit I don’t have the fastest computer in the world. A Dell Latitude D820 with 2.5G of ram running Vista Business edition. I don’t have a lot of crap installed, but I do have tons of tiny files in the form of source code, mostly from open source projects, littering my hard drive filling up my MFT. I think the fragmented MFT causes a lot of my slowness.

Regardless, the remove program process would be far faster and a better experience for me if I could simply browse start->programs-> <insert program here> -> uninstall.

*this post was inspired by Jeff Atwood.