Category Archives: programming

What I’m doing this summer at CDRH: overview

I’ve been here at CDRH (The Center for Digital Research in the Humanities) at the University of Nebraska-Lincoln since early May, and the time went by so quickly that I’m only writing about what I’m doing a few weeks before my internship ends! But I’m in the thick of things now, in terms of my main work, so this may be the perfect time to introduce it.

My job this summer is (mostly) to update TokenX for the Willa Cather Archive (you can find it from the “Text Analysis” link at http://cather.unl.edu). I’m updating it in two senses:

  1. Redesigning the basic interface. This means starting from scratch with a list of functions that TokenX performs, organizing them for user access, figuring out which categories will form the interface (and what to put under each), and then making a visual mockup of where all this will go.
  2. Taking this interface redesign to a new Web site for TokenX at the Cather Archive.* The site redesign mostly involves adapting the new interface for the Web. Concretely, I’m doing everything from the ground up with HTML5 and styles separated into CSS (and aiming for modularity, I’m using multiple stylesheets that style at different levels of functionality – for example, the color scheme, etc., is separated from the rest of the site to be modified or switched out easily). The goal is to avoid JavaScript completely, and I think we’re going to make it happen. We’re also aiming for text rather than images (for example, in menus) and keeping the site as basic and functional as possible. After all, this is an academic site and too much flashy will make people suspicious. 😀
  3. The exciting part: Implementing as much of TokenX with the new interface as I can in the time I’m here. Why is it exciting?
    • TokenX is written in XSLT, which tends to be mentioned in a cursory way as “stylesheets for XML” as though it’s like CSS. It’s not. It’s a functional programming language with syntax devised by a sadist. XSLT has a steep learning curve and I have had 9 weeks this summer to try my best to get over it before I leave CDRH. I’m doing my best and it’s going better than I ever imagined.
    • I’m also getting to learn how XSLT is often used to generate Web sites (which is what I’m doing): using Apache Cocoon. Another technology that I had no idea existed before this summer, and which is coming to feel surprisingly comfortable at this point.
    • I have never said so many times in a span of only two months, “I’m glad I had that four years of computer science curriculum in college. It’s paying off!” Given that I never went into software development after graduating, and haven’t done any non-trivial programming in quite a long time, I had mostly dismissed my education as something that could end up being so relevant to my work now. And honestly, I miss using it. This is awesome.

I’m getting toward the end of implementing all of the functionality of TokenX in XSLT for the new Web site, hooking that up with the XSLT that then generates the HTML that delivers it to the user. (To be more concrete for those interested in Cocoon, I’m writing a sitemap that first processes the requested XML file with the appropriate stylesheet for transformation results, then passing those results on to a series of formatting stylesheets that eventually produce the final HTML product.) And I’m about midway through the process of doing from Web prototype to basic site styling to more polished end result. I’ve got 2.5 weeks left now, and I’m on track to having it up and running pretty soon! I’ll keep you updated with comments about the process – both XSLT, and crafting the site with HTML5 and CSS – and maybe some screenshots.

* TokenX can be, and is, used for more than this collection at CDRH. Notably it’s used at the Walt Whitman Archive in basically the same way as Cather. But we have to start somewhere for now, and expand as we can later.

mac woe update: adobe drops flash for PPC

Sigh.

This article talks about much of my last post, with the focus not on Google Apps but on Adobe Flash: “Adobe Flash Has Left PowerPC Macs Behind

The reason I’m linking to this piece is that it makes an excellent point about “obsolete” PowerPC Macs (and even Intel Macs) not being so obsolete relative to their PC counterparts, but made so by Apple’s hardware decisions. Given that I haven’t owned a PC for at least 9 years, I had nothing to compare to, but this author points out that Apple dropping support for its older hardware sends perfectly good Macs to an early grave despite having the same or even better performance for still-supported older PCs.

On the Power Mac G5 and PowerBook G4:

While these highly capable PowerPC machines meet or exceed the Windows-based minimum hardware specifications required for the latest release of Flash Player, it matters not. Progress in the world of Mac OS X tends to make Apple hardware obsolete much faster than comparable Windows computers released in the same time frame.”

“I’m simply dumbfounded that fully capable PowerPC Macs continue to lose support and functionality with so many things that similarly aged (and often far older) Intel machines still receive” – as am I! Because I did not know that older Intel machines were supported for so long. Then again, this author makes the excellent point that support is being dropped for OS 10.4 but still retained for Windows XP.

It also makes me remember my general policy of “if it’s old and getting too slow, put Linux on it” because a Linux install will usually make most of the problems of an older Windows box magically go away. Indeed, Linux on older hardware is a good thing: but where is the support for older PowerPC platforms? In comparison, it isn’t really there.

It’s really too bad to see the end of this era. First the Dreamcast (an excellent RISC console that also runs Linux), now the Mac PPC line. It’s not that Intel/AMD architecture is superior: it’s just so common that it’s simpler to drop support for anything else. Unless there is another explanation?

and thinking about object-oriented programming

I may be enamored with functional programming right now, but I do remember that the first languages I really learned were C and C++. That ++ is one big difference. I was fortunate enough to be learning them at exactly the same time, and so “object oriented programming” meant a lot more to me than a buzzword.

I’ll share another link tonight, and this one is more of a read, but it’s an opportunity to ask something you don’t every day: how does object oriented programming work, and how is it implemented? For example, in ANSI-C?

Object-Oriented Programming with ANSI-C (Axel-Tobias Schreiner, English translation, PDF)

thinking in functional programming

My internship this summer gives me the opportunity to get acquainted with and even use some XSLT – misleadingly the “stylesheets” of XML.

XSLT has been hard to wrap my head around, not least because “stylesheets” and “used to format XML” make me think of CSS, not – well, functional programming. It’s been a good many years since I got to play around in Lisp, let alone make something with it, and this has brought me back to those two great semesters of AI electives that introduced me to this way of thinking. It took a few weeks to get into it, but once I “got” how Lisp worked at a more intuitive level, I remember my impression: I am thinking in a different way. It wasn’t just about programming, it was about problem solving, and about a way of looking at the world.

Diving into a functional programming language again has got me thinking about that experience. Learning how XSLT works has of course made me remember a time when Lisp made sense, because XSLT is functional programming. If I had been introduced to it in that way at the outset, it would have clicked much sooner. Now it makes me yearn a little for the time when I didn’t just know that I was working in a different way, but when that way came to make sense and I was able to start going somewhere with it.

But when I learned Lisp in the context of an AI (artificial intelligence) class, I didn’t learn it as “functional programming” then either. I wasn’t introduced to it in the context of lambda calculus, which I came to find much later – last semester – in a natural language processing course. I knew it was different, but I didn’t know how on a bigger picture level.

Now that I have that bigger picture, I am appreciating this way of thinking more and more.

Why is functional programming “hard”? Why is it something that I had to get used to for a time before it clicked? I have an answer this time – because I have been doing imperative programming for so long, because that’s how I was introduced to programming (I didn’t attend MIT after all), and because that has become the natural and intuitive way for me to solve a problem. But imperative programming isn’t a more natural way of thinking about things. It’s a different way. Obviously, these two ways of approaching problems have different applications, but the elegant and concise ways of approaching problems that functional programming offers are perhaps even more appealing to me now.

Because I am not an expert, I write this not to make a profound statement about how to approach problem solving, but to share a great article about where functional programming came from, why it’s so appealing, and the things it makes possible. I give you,

“Functional Programming For the Rest of Us.”

Take the 10 minutes to read this and enjoy!

on coding

I can’t count the number of times I’ve heard these in the past year:

“I want help learning how to code.”
“Will I have to learn to code?”
“Do digital humanities scholars need to know how to code?”
“How much do I need to know about coding?”

In every case, I’m left scratching my head: how can I begin to answer this question? What is “coding”?

The Problem

What I want to ask in these cases is simpler than you might think. I want to ask what the problem is. What is the solution that you need? Do you need to display data, to run numbers through formulas, to create a nice desktop software application with a GUI? What is the purpose? We can’t begin to answer these questions without the goal concretely in mind.

Coding

And here is the one word that has come to drive me up the wall. Coding. It’s everything and nothing. I’ve heard it used to refer to everything from HTML markup to large and complex software development projects. Coding is agnostic. It doesn’t specify what’s going on. “Learning to code” could be anywhere from “I want to learn the software development process” to learning the basics of a particular language (enough to get “Hello world?”), learning a language in depth, learning scripting languages for using databases on your Web site, or marking up text using HTML and creating CSS stylesheets to go along with them. But without saying any of these, “learning to code” has absolutely no meaning. There really is no such thing. Learning the fundamentals of good programming, possibly, but a tutorial of how to make a for loop Python is no such thing (and when I dissect the coding question, this is oddly what it ends up being much of the time).

A Little Rephrasing

Having discussed the problem with “coding,” let’s move foward and try to produce a real answer to those questions at the top.

Instead of thinking of this as a kind of mysterious and wide-ranging skill to pick up, that applies to creating things with the computer no matter what kind, I will rephrase it as this: creation. Problem solving through creating something to help you arrive at the solution. We build and create all kinds of things without a computer, without giving it any instructions. We make tools and write and draw. We give instructions to our subordinates.

Putting the two big pieces together: What is your problem, what is the goal, and what do you need to learn in order to create something that will solve the problem? Leave programming language and hardware requirements out of it. What do you need to get done?

Now this is the tough part, in my experience. You have a problem and a goal. (For example, “I have all this data, and I want to discover patterns in it. I want that to be displayed as a map.”) But you need the concrete steps in it. What exactly are we working with? What do we want to do with it? How on earth are we going to make that happen? Lay it out: step 1, step 2, and so on. How are they connected to each other? Annoyed as I was at having to diagram program flow charts when I was in college, I have really appreciated their value later on. Make a map of where you have to go in your solution, including all of the stops, in order to reach your goal.

Going Forward

From there, I don’t want to say that the “coding” that I think people are referring to is trivial per se, but the really difficult part has already been done once the problem is thought out and possible solutions mapped. Learning to implement the solution is orders of magnitude easier, in so many cases, than coming up with robust, quality solutions and the concrete steps needed to carry them out.

My advice to all of those with “coding” questions is this: to follow the above steps, and then go out and get a human or a book that is specialized in what you’d use to solve the problem. Google is your friend, if you don’t have an all-knowing expert at your disposal (and who does?). You are probably not the first person who has had to implement your solution concretely, using a specific technology. They may not have done it in your field, but think of the problem itself and not whether it’s processing data sets from history or from biology. Get a sense of how people approached it: visualization software? A specific programming language? None of the above?

Then go get the book or that human, and put in the time. Programming – not to mention Web design in these days of CSS (yes, I started in 1996, and never quite internalized anything after table-based layout) – has a learning curve. You are not the first one to encounter it, but you can overcome it too. Go through the examples and type them in and run them. Play around with them and modify them, then try to get why you broke it and how to fix it. Even better are books or very thorough tutorials on the Web (so few and far between) that take you through a project just like the one you’re working on.

How Much?

So, do you need to know how to code? Who knows. You need to be able to do – or hire someone to do – whatever the solution to your problem requires. Unless you are looking at a career in software development, no one is expecting you to become a programmer. Do you need help “learning how to code?” I hereby order you to never use that phrase again. You need help in figuring out which technology works for your problem and some advice about where to go to learn it. Now go, and enjoy this excuse for getting to learn something new and making something exciting!

Coda

Obviously, I have some personal bias here. I have a programming background, have done quite a bit of Web design and implementation (including sites that get their information from databases), and have used about 10 programming languages over the years. I’m not an expert in any of them. And I don’t always know what technology is going to help me solve my problem. What I learned, really, is that I’m going to have more or less of a learning curve, I’m going to do a lot of research figuring out what might help me the most, and that I might end up on a forum or emailing or calling someone with what I think is an embarrassingly dumb question. It happens. In fact, I just called up my brother and asked a really stupid question 2 weeks ago, but if I didn’t, it would have taken me weeks to figure out my small mistake that was killing everything. If it’s of any comfort, the first learning curve is going to be immensely harder than any of the ones that come after. Once you first “get it” from making a project work, you are going to have problem-solving and logic skills that will vastly improve your life.

So go forth and learn some new technologies! And never use the word “coding” again.

A Creative Endeavor

… or How I Will Drive Myself Slowly Over the Edge

So people talk about there being some kind of nuanced difference between nerd, geek, and dork. I’ve been sucked into it myself, sadly, and as a result I get a little defensive when I am called anything other than a nerd. By any criteria, I really am, and was way before it became ironic-cool to wear thick plastic glasses. (Just check out my fourth grade yearbook.)

I think my own personal nuance is the difference between dork (no social skills), geek (geeking out over things, becoming obsessed with things), and nerd (likes learning for its own sake and often enjoys academics as a hobby, leading to social ostracism and a joy of doing homework). Well, of course all of these things overlap in any person, but the traits of the last manifest quite clearly in me, for better or worse.

Case in point?

This summer I’m working at an internship in Lincoln, Nebraska, and had to pack one car and go (with all of my cat’s things too, so I lost some space). No bringing my ever-expanding book collection with me. I got a Kindle to read Gutenberg.org books on, but still, it would be nice to have some kind of summer project that isn’t a work assignment. A dual degree will do that to you: any kind of scheduled free time becomes exciting and a chance to either take on something with a limited deadline and feel satisfied, or lay around and do a lot of nothing. I try to do both.

So here is my project. I picked up a copy of Seven Languages in Seven Weeks and decided to work through it in the evenings after work. Yes. I am giving myself seven weeks of programming assignments. I’m going to be learning entirely new languages, some I have heard of and some I haven’t. I get a little cheating on one because I am semi-comfortable in Lisp. Still. I will learn a little of each: Ruby, Io, Prolog, Scala, Erlang, Haskell, and Clojure. I am excited about the prospect and not only do I want to learn because it’s fun and programming is fun for the brain (when it’s not hurting your brain, and when you’re not banging your head on the desk) – but also because I think it will be good for my creativity.

After all, creativity is not limited to one domain. Practicing writing helps me think more freely about photography, keeping a journal helps every aspect of my life, keeping daily notes about my dissertation inspires me to reexamine my artistic life (it helps that I write about authors and practices of writing). And there is something about exercising the brain with logic and problem-solving that is refreshing and at least interesting, and often rewarding, after you (I) spend almost all of my work life reading, and writing about stuff I read. Making art is one kind of problem-solving; programming is another.

Both are all about creativity and stretching the brain a little bit further.

But yes, it is seven weeks of daily programming in a set of languages I haven’t used before. I just taught myself Java in three days and then wrote a non-trivial application in it for a class project, and I’m somewhat exhausted. For my internship, my life is going to be all about getting better with XML and TEI, and then learning how to fit XSLT and XPath into the picture, while working with a servlet, which I have never even had to consider before. Good god, I am all about the computer this summer. It’s great.

I’ll have to stop the extracurricular programming if I feel a nervous breakdown coming on. Until then, onward to Prolog!