Client Perspectives

I’ve been trying to write a web application in my free time. It’s been going on at varying degrees of intensity for months now, and I’ve got virtually nothing to show for it. Part of that is due to a lack of time to devote to it; at best, I can add 2 hours to the top of my day by getting up early.

But the point of the post is really the other compounding factors that the various technologies impose on me, and how that relates to the client perspective in typical contracted software work.

My day job involves almost exclusively Microsoft technology; .NET in particular. We use Sharepoint to build client intranet applications, do custom C# development, etc.

In my hobby projects, I tend to play on a Linux platform with Lisp or C++ (although I certainly am no stranger to the Windows platform or other languages). The webapp I’m working on has been based on Weblocks, a continuations-based web framework for Common Lisp. I have an idea of what I want it to be and do, but Weblocks isn’t well documented and I’m not very experienced with it yet, so I come to it asking this question:

what can I do?

The framework is also pretty liberal, so even once I know what it provides, I still have the same question because the possibilities are limitless. In a way, this expanse is paralyzing: I have to spend a lot of cognitive energy figuring out among the zillion design choices at each step, in addition to learning a technology I’m inexperienced with. Consequently, it takes a really long time to get something working. However, once it starts to roll, it can roll fast because once I’ve made my design decisions and worked out my requirements (informal as they may be), I understand where I’m going and generally how to get there.

I have another hobby project, a Git client for Windows built in WPF and C#. With that project, I ask a different question:

How do I do that?

This is because of the nature of the platform. True of closed, proprietary platforms in general, but in particular of comprehensive frameworks like .NET, most of the design decisions have already been made. I don’t have to choose among the zillion ways to render a components in HTML/CSS/Javascript and process user activity – there’s already a mechanism just for that in ASP.NET called “web parts”. I don’t have to make a hundred design decisions about the desktop GUI framework to use and how to use it or roll my own or extend one, etc, because the Visual Studio and Blend designers support WPF. With this platform stack, the tradeoffs are reversed: I can get rolling on a project almost immediately, but at some point, things get really hard because of the box you find yourself in down the road (and at least part of the box is hidden from you because of the proprietary nature of the stack – the Sharepoint object model is a perfect example because it sucks). I once worked on a system that had it’s own threadpool because the .NET threadpool didn’t perform well enough, for example. That was not a quick project.

What struck me about this contrast was that I found myself empathizing with the position of a client.

As in the first case, the possibilities are endless – unmanageable – at first, and I didn’t know what I wanted, and nobody was there to tell me – but later on, the freedom in those design choices was favorable.

In the other case, I had some very concrete ideas about what I wanted because the technology limited my choices, but those limitations created pain points later on because they became very confining.

Conclusion? I don’t know, really. Each position has it’s advantages and drawbacks. I tend toward the former as a craftsman, but toward the latter as a consultant for a variety of reasons, including market inertia.

Posted in Uncategorized | Tagged , , | Leave a comment

Continuations

By training and experience, I’m largely an object-oriented programmer. I was a freshman comp. sci. student when the Java wave hit my university, so that’s what I was fed. I didn’t learn anything else but Java until the summer after my sophomore year; then, I was involved in a summer research program for which I used C++. Between then and the end of my undergraduate tenure, I had picked up more C++ and learned C (I should add here that my department was and is a very good c.s. department – they just didn’t use functional languages as teaching tools).

Where did that leave me? I knew how to write nice object hierarchies, tight structural/procedural code. However, Boost wasn’t a big deal yet, and I had only barely dabbled in anything else, so I was missing a huge piece of the puzzle: functional programming. I used lisp for a couple of programming assignments in graduate school because I wanted to learn the language – and I did learn the basics, but what I didn’t learn was important functional concepts.

Now, as a working professional programmer, I’m still trying to learn functional concepts. Some are pretty easy: immutability and recursive computation. These are very basic – even recursive functions were taught in Java programming classes.

But the most interesting element of functional programming is higher order functions, which are the basis for some very powerful forms of abstraction. This is what I was really missing in my repertoire.

So now, the point: I’ve been trying to learn a web framework called Weblocks. It’s freaking cool – but it makes heavy use of continuations for control flow (one of its major features). I had never learned about continuations before, so this was (and still is, to some degree) making it hard to learn the framework. So I was reading about continuations online (here ,here, and here) and came across a reference to Paul Graham’s book, On Lisp. I have a copy that I printed for myself, so I looked up the chapter on Continuations to gain some insight, and found the best explanation I’ve seen so far:

A continuation is a function representing the future of a computation. Whenever an expression is evaluated, something is waiting for the value it will return. For example, in

(/ (- x 1) 2)

when (- x 1) is evaluated, the outer / expression is waiting for the value, and something else is waiting for its value, and so on and so on, all the way back to the toplevel…

We can think of the continuation at any given time as a function of one argument. If the previous expression were typed into the toplevel, then when the subexpression (- x 1) was evaluated, the continuation would be:

(lambda (val) (/ val 2))

That is, the remainder of the computation could be duplicated by calling this function on the return value.

I found the little example shown here to be the best way try to explain continuations. Trying to understand the applications of continuations is a beast, and without this basic understanding it’s very easy to get lost.

Now…back to Weblocks…

Posted in Uncategorized | Tagged , , | Leave a comment

Visual Studio is a Pretender!

Can I just rant at you for a minute, gentle reader?

The editor in Visual Studio is from the stone ages. Really – it’s retarded (I don’t mean that in a derogatory sense – it really is retarded).

Sure, it does syntax highlighting, but really….so do the little code-paste tools like pastebin, and those little tools highlight for dozens of languages, so color me unimpressed.

Intellisense? Yup – very nifty, very advanced – oh, wait! Lisp environments have been doing “intellisense” for years decades.

What else….let’s see….feature or failure?

Visual Studio characteristic Feature/Failure Notes
consistency of indentation FAIL ever tried to use another editor to open files authored in Visual Studio?
efficient keyboard shortcuts FAIL the most often used shortcuts (navigation in text, for example) require me to move my hand off the home row
automatic indentation FAIL Are you kidding? Only if you happen to be typing in a magical combination of keystrokes that Microsoft decided was the one true way to type will auto-indentation be convenient.

These are just some very basic, fundamental things, and this list could go on – indeed, I might come back and add to it as I become more proficient with Visual Studio. As an experienced Emacs user, it’s quite painful. I tried to use the Emacs keyboard mode, but it was even more maddening than the other modes – they get the keystrokes wrong, and even when they get them right, they don’t work correctly! C-k is supposed to kill a line, but you have to type ‘k’ twice for the kill to happen, and if you try to yank it back in using C-y, you get the killed line twice! M-q doesn’t work, you don’t get registers, typing on top of a highlighted region doesn’t replace, it appends, and ‘C-x b’ doesn’t switch tabs in the editor.

For all the wonders of a modern IDE, can we just please, please have an editor that’s advanced past 1985?

Posted in Uncategorized | Tagged , | Leave a comment

Crack in the ‘Golden Spike’

I love the description Marty Manly uses over at ‘Jam Side Down’:

So you have Google with all the software needed to replace Outlook in every respect except syncing contact and calendars to an iPhone or a Blackberry and you have Apple with a great device and an opportunity to wean thousands of small and mid size companies off of Exchange offering an inadequate alternative to Exchange. Neither company has built a solution for real users. It’s as if the railroads had decided to end their tracks about a 100 yards from each other rather than meeting at Promontory Point and driving the golden spike. Dumb.

He’s soooooo right. Why can’t Apple support all the Google APIs that correspond to the functionality in Exchange server? It’s all there and free to build against, and for a small business, Google Apps + iPhone (with Google support) would be absolutely killer. I switched from a Blackberry (Pearl) to the iPhone 3G, and I’ll never look back, but having calendar, contacts, and mail all synced to my phone is just huge.

However…

I just got bombed in the way Marty says isn’t possible: Nuevasync stopped working correctly for me. It fails to synchronize my contacts, reporting that my google account has corrupt data. They advised me to export all my contacts, delete them, and re-import them. I followed the instructions and didn’t read the fine print: Google contact export doesn’t retain grouping metadata, so if you do what I did and just export ‘All Contacts’, you lose group metadata. Losing track of your groups is bad enough, but also: all your ‘Suggested Contacts’ also become ungrouped, so I had 500+ contacts, more than half of which were junk.

Anyway, after I re-imported my 500+ contact list (with no groups), Nuevasync still doesn’t work. I emailed their support address, and I got a form reply (which is typical, no problem there), but after several days, I didn’t get any further response from a staff member, so I emailed back again, and I still have yet to hear from them. In the meantime, I have zero contact data on my phone because all my contacts were previously synchronized (which was fabulous!).

I really just don’t know what to do at this point. I don’t want to switch to GooSync because a) it isn’t free, and b) there’s no way to try before you buy, and it looks like you have to download a special iPhone app for syncing. Does that integrate well with the Apple Contacts and Calendar apps? It doesn’t look like it from what I can tell, but….I can’t really tell unless I fork over $15 for the iPhone app and £20 for the SyncML service.

I really just want Nuevasync to help me, because their service worked like a charm up until this point.

Update: Through a comment on their blog, David indicated that there will be some kind of support in the status pages to help pinpoint exactly what data isn’t parsing correctly in the sync.

Posted in Uncategorized | Tagged , | Leave a comment

Lisping in Bed

I happen to have an ssh client on my iPhone 3G, and while I was in bed the other night I thought to try and log in to a box, fire up emacs and get a slime repl. It worked great, as you might expect, but it was still amusing.

Posted in Uncategorized | Tagged | Leave a comment

My Hiatus

Dear readers (all none of you), I’ve been away from my blog for a while now because of life circumstances that required my attention to be invested elsewhere. Hopefully, I will now be able to post something on a semi-regular basis. To explain somewhat:

I worked at a rather large defense contractor as a software engineer. I shan’t mention the name for a number of reasons; one being for my own protection; another being to make at least a nominal effort to not burn bridges.

The work was mostly rewarding. The technology there is quite interesting; in it is an intersection between technology that the commercial sector left behind, technology they’ll never have (with a few exceptions, like some of the more interesting telecoms). Even when compared to the telecoms, there is a segment of the tech there that will never see the light of day. As you might expect, there are both frustrations and excitement involved. For the second half of my tenure there, I began to be seriously frustrated with the corporate culture there; part of it was simply the reality of working for a giant company, and part of it was simply the reality of working for a defense contractor (which makes it like working for two giant companies simultaneously). But there was a third major part of it that was really starting to bother me: I was never going to be deeply involved in the essential business there, and thus my ability to do things I want to do in my career would be artificially limited. That company was a systems integrator, not a software company. To be sure, there were lots of interesting software projects, but that wasn’t the company’s essential business; more like a value-added service that went along with the main business.

There were other secondary issues as well. Most of that didn’t have to do with other people, except as it related to the environment and corporate culture. There were financial incentives to leave as well.

So I stuck to my work, and didn’t talk about leaving and kept it a secret that I was looking. I wasn’t looking hard, though. I was passively observing the local tech market, looking for a landing pad. I interviewed a couple of times, including once with a premier Valley firm. Ultimately though, I decided I didn’t want to become a Californicator. There were a couple of potential openings that I found through personal contacts, including one with my brother at his trading firm in New York. I pursued that option for a couple months and had it all settled out, and the credit market problems ended up closing that door for me. I went back to my contacts again, and it turned out that the timing was just right for me to join up with a small .NET/SharePoint consulting firm in Dallas, called Cogent, with whom I now work.

One of the benefits of working for Cogent is that they encourage the developers to write blogs and articles, because it increases their exposure, so I hope to be able to post at least a few times a month on topics of interest to me.

Posted in Uncategorized | Tagged , | Leave a comment

Dedicated window-buffer mapping with Emacs

I use CScope to navigate source code from within Emacs. It’s very, very useful and integrates will into Emacs. However, I’ve been wanting a way to control how cscope updates the buffer/window mappings as it locates search results for you. Sometimes, I like that CScope updates the buffer where I initiated the search to reflect the results, and it’s easy to get back to the point of origin using the C-c s u command.

However, sometimes I want CScope to leave my origin buffer alone and show the result location in another window so I can see both at the same time. It’s bothersome to have to arrange the buffers manually after performing a search, so I asked on stackoverflow.com, and voila! I got a good answer – create a simple keybinding to a function for dedicating a window/buffer mapping:

;; keybindings
(global-set-key [pause] 'toggle-window-dedicated)
 
;; buffer dedication (mostly for cscope
(defun toggle-window-dedicated ()
  "Toggle whether the current active window is dedicated"
  (interactive)
  (message
   (if (let (window (get-buffer-window (current-buffer)))
	 (set-window-dedicated-p window
				 (not (window-dedicated-p window))))
     "Window '%s' is dedicated"
     "Window '%s' is normal")
   (current-buffer)))

Now, using this, I can just hit the pause button on my keyboard when I want to pin down my main source buffer.

Posted in Uncategorized | Tagged , , | 1 Comment

pre-commit script for submodule hygiene

Our team at work is using git submodules to track re-usable code across projects, and it’s been pretty good so far, but we have hit minor snags along the way (such as the absence of a ‘git submodule rm’ command!). Another one is that using submodules adds a step to the sequence of things you have to do to publish changes: pushing submodule commits. It’s an easy thing to forget, but it’s a headache for anyone on the other end of a pull when git-checkout-index fails. This pre-commit hook script will cause the commit to fail if the commit contains new submodule moments and those moments are not present in the corresponding submodule origin.

#!/bin/sh
 
function array_has
{
    for item in $1
    do
	if [ "$item" = "$2" ]; then
	    return 1;
	fi
    done
 
    return 0;
}
 
diffs=`git diff --cached --name-only`
 
IFS=`echo -en "\n\b"`
for smstat in `git submodule 2>/dev/null`
do
    if [[ "$smstat" =~ '^\+(.*)' ]]; then
	smstat=${BASH_REMATCH[1]}
    fi
 
    head=$(echo $smstat | awk '{print $1}')
    path=$(echo $smstat | awk '{print $2}')
    moment=$(git ls-files -s $path | awk '{print $2}')
 
    array_has $diffs $path
    if [ $? ]; then
	pushd >/dev/null $path
	for rhead in $(git ls-remote -h origin 
	               | awk '{print $1}')
	do
	    if [ "$(git rev-list $moment ^$rhead)" 
		    != "" ] 
	    then
		unpub=1;
	    fi
	done
    fi
 
    if [[ $unpub -gt 0 ]]; then
	echo -n "ERROR: you are trying to commit "
	echo -n "unpublished changes to the $path "
	echo    "submodule."
	exit 1;
    fi
 
done
 
exit 0;
Posted in Uncategorized | Tagged | Leave a comment

submodule moment

Seems that new features and concepts appear in Git at such a steady pace that it’s difficult for the jargon to keep up. I don’t follow the git mailing list as closely as I should: it’s too high-traffic and I already don’t have enough time to do the work I have on my plate.

Right now what’s getting tongue-tied is referring to the commit-id of a submodule stored in the HEAD of a containing repository. As far as I know, there’s not a good, succinct and unambiguous term for this commit-id.

I have decided to call it the ‘submodule moment‘, because moment captures the ideas nicely:

  • a submodule at a particular point in its history (which we typically think of as linear in time)
  • a property of the submodule as it relates to it’s parent repository (a moment in mathematics is a statistical property of random variables)

More importantly, though, this term disambiguates itself from the other verbal references to commit identifiers.

Posted in Uncategorized | Tagged | Leave a comment

Extended Git Submodule Status

At work I’m involved in some projects that will very likely make heavy use of submodules. The reason is that submodules make it very convenient to make use of a set of “common” code without a ton of duplication. We’re currently breaking our “common” code into packages that can be included in a project independent of each other, and they will likely exist as submodules.

The challenge is that submodule support in Git isn’t quite as polished as you’d like it to be. What do you do if you have 20+ submodules, some of which may be on a branch and contain uncommitted changes that need to be dealt with? What if it’s been two weeks since you last looked at it?

One solution would be to write a git-all script like this (which is simpler than a real git-all would be, and may actually be incorrect):

#!/bin/sh
# git-all
 
for repo in $(find . -name '.git' -type d | xargs dirname); do
    pushd $repo >/dev/null
    git $*
    popd >/dev/null
done

We used this approach, particularly before the advent of git-submodule, and some projects still use it. It’s not a bad approach, but it’s not really what you want.

Here’s another solution that’s a little more integrated into git itself:

#!/bin/sh
# git-submodule-changes
 
. git-sh-setup
 
status=0
 
for sm in `git-submodule status 
              | sed 's/^[[:space:]]*\(.*\)/\1/' 
              | cut -d ' ' -f 2`; 
do
    pushd $sm >/dev/null
    substat=$(git-ls-files -d -m -o -s -u -t 
                  | cut -d ' ' -f 1 | sort | uniq)
    substat=$(echo $substat | tr -d '[[:space:]]')
 
    if [ "$substat" != "" ]; then
        status=1
    fi
 
    printf "%7s %s\n" "$substat" $sm
    popd >/dev/null
done
 
exit $status

I think this works better. An added benefit is that you can do line-based scripting with tools like grep, sed, and awk (and tons of other unix utilities) with it, because all the info appears on one line:

{master}$ git submodule-changes
      ? sub0
        sub1

This isn’t terribly illuminating, but the format is just “[HMRCK?] submodule-path” on each line. The optional codes are the single-character status codes from git-ls-files.

An even better solution would be to build this into git-submodule.sh, which I will look into as I get time.

Posted in Uncategorized | Tagged | Leave a comment