Tag Archive for 'software'

How to convert a software installation into a Subversion checkout

Say you have some web software such as WordPress, MediaWiki, or Gallery installed, and you used a tarball and not Subversion. Now, you want to manage the installation using Subversion, but you don’t want to jump through hoops running diffs and moving files around.

Here’s how to do it (thanks to Asheesh for the recipe).

  1. Check out the software somewhere.
  2. (cd $PATH_TO_NON_SVN_DIR ; tar cf - . ) | (cd $PATH_TO_SVN_DIR ; tar xvf -)

This will “overlay” the non-svn-dir over the new checkout, leaving your existing installation untouched.

Interview with Allan Odgaard, creator of TextMate

A couple months ago, Allan Odgaard, creator of the OS X text editor TextMate, mentioned on his blog that he was going to be traveling to the US and passing through New York. I emailed him to see if he would be interested in doing an interview while he was in town, and he kindly accepted.

Why don’t you quickly tell us about TextMate, what it is, and how long it’s been around.

TextMate is a text editor used for structural text — that means programming languages mainly — but it also has a lot of usage in the LaTeX community and Markdown and stuff like that. It has existed for roughly three years. What sets it apart is probably that it’s very easy to customize. Similar to Emacs and vi it can be customized, but unlike Emacs and vi, at least in my humble opinion, it’s very easy to do these customizations, and it’s also very easy to distribute the customizations. That has really built up a community around the text editor, which means it’s suited for a lot of tasks that I haven’t really developed the program for, but which other users have developed it for.

Emacs and vi have been around for decades, and they have their own userbases of people who like to customize them their own ways, and then there are all the language and platform-specific IDEs. You got into the text editor business, where it’s not obvious that there’s an opportunity in that field where you can make everyone happy, but it seem like you’ve hit a sweet spot. And now that you’ve done it, it seems kind of obvious — I can’t imagine programming without TextMate. When you started making TextMate, how certain were you that this sweet spot was there, and how did you envision TextMate fitting into that spectrum?

I did it for myself, and I was using Objective-C at the time, and that’s sort of the market I had in mind — people like myself needing an Objective-C editor. I was rather pessimistic because we have Xcode which is one of the IDEs built for Objective-C. And I met David [Heinemeier Hansson]– he was doing Ruby on Rails at the time, which wasn’t public at the time — and he needed an IDE for Ruby on Rails. I didn’t want to hardcode the editor for a specific purpose. At the time I did see the potential in making things customizable, so rather than write the features David wanted, write it so that he could add them himself, and I could add my Objective-C functions myself. So I did have that in mind, that it was supposed to be customized for the different domains, but I had no idea that there was actually that many domains out there — something which became apparent very quickly because I think it was a month later and there were bundles for Lisp, Erlang, all sorts of languages which didn’t have a dedicated IDE. So initially it picked up all the languages that had no IDE, and later it actually started to compete with the languages that did have an IDE. But I didn’t foresee that, not at all.

When did you meet David?

Our friendship goes back to a computer copy party in 1995– are you familiar with the term copy party?

No.

It goes back from before the internet. We actually met with our computers and floppy disks, and then we copied software because we couldn’t get it from the internet– that’s the origin of these copy parties. They quickly developed into demo parties, where you had demo competitions. So i met him in 95 the first time, but we didn’t really become friends at the time. But he became friends with some of my friends, and I met him again I think in 2001– he had some RAM, I had just bought a mac, and my RAM didn’t work in my Mac –

*laughs* Are you serious?

*chuckles* yeah. So we met at a mutual friend’s place, and I had this RAM which didn’t work in my Macintosh, and he had some RAM which did. So he offered to switch, and I got back to his place, and I saw all these books in his bookshelf, and I was very impressed, and thought “oh you read all this literature? You’ve really developed since I met you like, 6 years ago” (I didn’t say that) but *chuckles* that was my thought. So we hit it off, and we have been regular friends since then.

How early did he start telling you about Rails?

From the start — he told everybody about Rails, so of course that included me.

Did he think that Rails was going to be big back then?

I think he did. I think he’s… he’s very good at marketing, and I think he knew that he’s very good at marketing, so I think he knew that he did have something good back then, and if he was able to market it successfully, it would be big. So I don’t think he ever imagined it would be as big as it is now, but I do think he had an idea that it would be big. And i saw him at Roskilde University Center — that’s the first lecture he actually gave on rails (it’s in Danish, so probably few have seen it) — but he really did a very good presentation back then, and I was — and I don’t do web development stuff — but I was swayed after seeing that.

Is TextMate today what you thought it would be when you started it, in terms of functionality, or popularity?

Neither, I think. Well actually if you take functionality first, I’ve always seen TextMate as an ongoing project; I know that there won’t be a time when I’m out of ideas, things can always be better. But the functionality I initially had envisioned was like, a parallel to the current development. I hadn’t really realized the power of the declarative aspect — the semantic aspect — of the scope selectors; how much power that actually gives. 2.0 will be sort of a redesign. Well, not a redesign, but the entire infrastructure will be much better. It’s difficult to say this in few words; it’s the same featureset as 1.0, but in a way where I actually know that these are the features I want, so it’s designed better, so things fit better together. That’s a long way of saying: no, I didn’t really have a roadmap.

So you didn’t realize how powerful the scope selectors would be.

No not at all. So [in TextMate 2], more will be based on scope selectors, and more will be based on context. Currently, a scope selector is just a way to pinpoint a context, but the context presently is limited to where you are in the document. You can’t select which project you are in. Am I in a standalone Ruby file, or a Ruby file in a Rails project? That’s also the context. Am I in a Ruby file which is under Subversion control? That’s also the context. [So, compared to TextMate 1], there is a lot more context which the scope selector should also be able to select out. Even context like, is there a selection in the current buffer when I press this key? That can also affect things. Those are things I really realized in retrospect.

I see things kind of creeping into the bundles — more and more sophisticated use of scope selectors if you hit “show scope” you sometimes see 4 or 5 levels of scope — for example SQL strings in PHP are scoped as SQL and are highlighted accordingly, but if you have a PHP variable in there, that’s scoped properly too — it’s just gorgeous. It’s a very sophisticated interaction one has with a text document. When you’re programming you know that the text has all this meaning. When you become a programmer, and as you become a better and better programmer, you become more aware of the different levels of meaning in a text document, and I think TextMate really brings that out.

And the more TextMate knows about your document, the more functionality you can actually hook up to it. For example commenting stuff– no matter which context you are in the commenting stuff will always do the right thing, as long as TextMate understands which context it’s in.

And how does TextMate’s popularity compare to your expectations when you began building it?

My goal, initially, was to break even. I was like, I’m doing this for fun, and in the worst case, I will get a good editor out of it, and the case I hoped for was to break even, so I could make a living out of it. And, it has gone a lot better than that. But I’m a pessimist. *chuckles*

The extensibility of TextMate is very obviously a lot of its power. I think a lot of people who make software, whether they are big companies or independent developers, often think very hard about how extensible their product is going to be, because, if a feature is missing, then they can sell it to the user in a future version. So, with a product as extensible as TextMate, you can’t sell those features to people. They can either make them themselves, or your bundle community is making them. What’s your attitude towards that, and how confident were you that you could still sell the product even though it was so flexible?

I think that there are always features one can add, as I said earlier. And the customization infrastructure, that can also be vastly improved. That has never been a concern — on the contrary. The fact that people can do the features themselves, or get another person’s bundle, that’s great, because then I can spend the time on the things I think are important. Rethinking the infrastructure, or being obsessed with Objective-C for example. For example, I don’t do HTML, if I ever do stuff for the web I mostly do Markdown or something like that — and people write me and say “Wouldn’t it be great if HTML mode had this and this and this…”. And I can say “You use HTML, tell me”. *chuckles*

So you can make an editor that is good for every language, but you don’t have to know every language yourself.

Yeah. And actually, a very cool thing, about this sharing of the customizations, sometimes I do have to build something in PHP or Rails or some third language, and then I start to learn how many neat things there are in TextMate for that particular mode. Like I had to do a presentation in LaTeX Beamer, and I had never used Beamer before, and it was like, when I do ‘frame’, it completes it, and when i do ‘itemize’, it adds in which slide the item should appear on, and it’s like, “I don’t have to read the manual for this language.” *laughs*

What kind of relationship do you have with the bundle maintainers?

We have an IRC channel, and most of them are frequently there, we talk a lot together. They have a bigger chance of influencing the future direction of TextMate because I know that these guys know what they are talking about, because they are actually using the infrastructure.

How do you develop a relationship with someone, to where you can give them commit access to one of the bundles?

That has changed over time. Initially I hand-picked a few people who had been sending me bundles by email, and gave them commit access. And then I basically started to open up. Whenever somebody had a bundle for some language, he just got commit access to that bundle. But I’m starting to close down again where if you have a bundle, it will be added under the review folder, and they get commit access to that review folder, and they will get some review comments, and they have to fix stuff, and when things are in order, it will be moved to the official place, and then they can get commit access to the official place. But the existing bundles, they still can’t get access to them unless they show themselves worthy.

But I really wanna move to a distributed version control system, because this centralized thing, it puts so much administrative overhead on me, and I think it’s not ideal for the way things are working. People are sending patches to the mailing list, and then somebody with commit access to that bundle has to apply it. Sometimes one person writes a bundle, then he loses interest in that particular language or that particular task, somebody else does a lot of work with that bundle, but that person doesn’t have commit access. So, I want to move to a distributed revision control system.

How would that be structured?

I’m still not entirely sure, but ideally, each person will basically just — if he has improvements to a bundle, he will just publish it. I think I will invest in a server where I will give people all the accounts they want, for publishing bundles. But it will be under their own account. So everybody can take a public bundle, make changes to it, and publish it under his account. And then users can choose which version of each bundle they want. I will compose a list of who is doing the best work on each bundle, and those will be the official bundles included with TextMate.

But users are really free to pick whatever version they want to take. And then it becomes easy to see that– we have for example the blogging bundle, which is stale from the original contributer, but this other guy’s bundle is like, doing a lot of stuff, if I check it out and think it actually looks reasonable, so maybe I should move his bundle to be the official one. But he will still work on it on his private account, and only he will have commit access, so if somebody contributes, well they will have to contact him, or if he is not responding to his emails, then they will just fork his bundle and publish that. At least that will move all the administrative work away from me, and to the [individual bundle developers].

How do you think that open source culture, or open source patterns of development, have influenced TextMate, either in its bundle system, or your approach to developing TextMate?

Well the bundle system is an open source project with a central repository. It’s an open source project like any other open source project. TextMate itself — the only thing I have from open source is “release early, release often”. I try to do frequent releases. Another thing, and open source may have pioneered this to some extent, but I think it’s common sense — try to have a dialogue with your users, through the mailing list, through the blog. Actually read what users are writing on the mailing list, and interact yourself on the mailing list. So you can parallel there between TextMate and open source.

Well, you have a very active presence in the support of your software. and that’s something that I’ve pretty much only seen in open source. I mean you have a channel on freenode. How many commercial products have a channel on freenode? I think that’s a very strong influence from open source. And you’re always on the IRC channel! Do you ever feel overwhelmed?

Well I do feel overwhelmed, but actually not by the IRC channel or the mailing list, that’s actually great input. I do feel overwhelmed by users like, just going to the contact page and firing off an email and asking some stupid question. That’s what I feel overwhelmed about, but the IRC channel and the mailing list, that’s really no problem. I actually want to move all the dumb questions to the mailing list, so somebody else can say “this is stated in the documentation here”. *chuckles*

So you enjoy the community in the IRC channel.

Very much. And also, I’ve had lots of good TV show recommendations and stuff like that out of it. *laughs*

Do you always use TextMate to develop TextMate?

Yeah, yeah, always. *laughs* Initially I did use Xcode, and even after the release of TextMate, I think it took around 3 months before I switched to TextMate.

When was that?

Well I released it in October 2004. Chris Thomas, one of the users whose contributions I really like — he is the one doing most of the Subversion bundle — he did an Xcode build command, which did a very nice graphical output for the Xcode build process, and that’s actually when I switched to using TextMate.

*laughs* Is there anything from Xcode that you miss?

No not at all. But I haven’t used Xcode for like, three years. It didn’t have completion back then, and it didn’t have a lot of things back then. It probably has gotten a lot of new features. We also have Joachim Mårtensson, he’s doing completion for Objective-C in TextMate so I’m not really missing Xcode, no.

I’ve never done Objective-C but — doesn’t Xcode have pretty advanced breakpoint features?

I’m not a user of debuggers. But that’s what some of the people using TextMate for Objective-C development are telling me, that it should have debugger support. Not many of them, but some of them. So I imagine if you are used to using a debugger that would be something you would miss.

When you’re developing TextMate, do you do unit testing?

No. I have tried it a little but… the problem is that with a desktop application you have state, and each user action is actually just mutating the state, this global state. So it’s so darn hard to do unit tests. You can do unit tests for the algorithm, but I have been programming since I was 12, I can write an algorithm without needing to do a lot of unit tests and without breaking it like two days after. And I have tried, because there is a lot — or there was a lot of buzz about unit testing, it seems to have died out a little bit — but I have tried to apply it. But it’s like, writing the unit tests is like harder than writing the code itself, because you have this state, and then you want to simulate the user as mutating the state in all sorts of ways, and…

*laughs* I know Allan. I know it’s hard, but you’re still supposed to do it. Does DHH disagree with you?

*laughs* Oh I think he does. But I think if I bring it up with him, he would say, “Oh yeah, but enterprise programing is something else”. So we don’t really disagree, we agree that we have different domains.

How MVC is TextMate?

I would say, a lot because the Cocoa framework is really MVC. So you have your views, you have your controller, and you have your model. But in TextMate, the view and the model is strangely tied together. If you do something like, if you enable soft wrap, that’s a change in the view, but you really need to be able to break these lines, and you have spellcheck involved in that, and syntax highlighting and stuff like that. So, you have many view-actions on a model. Syntax highlighting itself is also a view thing, but it is too hard core to be in a view, it really needs a model.

It seems that it’s easier to test projects that are very strongly MVC because you know exactly where the thresholds of state are, which is certainly the case with Rails, to the extreme. Writing tests in Rails is childsplay. Whereas I’ve tried, many times, I’ve sat down and I’m like “I’m going to write a test suite for WordPress”, and like, it never happens. There are globals all over the place, which is, from the history of the PHP coding style, it’s practical in certain ways, relative to the history of the project– it’s nothing to be ashamed of necessarily. But like you said there is just so much state that you have to maintain in order to test things consistently.

And another thing, I’m using something called generic programming, which is a way to abstract the algorithm away from the data storage. And that’s something I’m very fond of. I think it’s mainly in C++ where you really have this paradigm. So, for example, I mentioned the soft wrap– something that wraps text at a certain column. We can do an algorithm for that, and that algorithm doesn’t really need to know about the storage of our actual text. And we can do another algorithm for the syntax highlighting. We can do another algorithm for the spellchecking. I really like to take out these algorithms which can be tested in isolation. You wouldn’t really call that a model. I’m not really sure what you would call it. But that’s how I separate things. I try to abstract the algorithm away from the data storage. The thing is all these algorithms actually work on the data storage, which is really something which is going to be visualized, so you could call that the view, but you could also call it the model, but if it’s the model, well, when you render the text isn’t that the view, and…

Are you considering any other projects?

*chuckles* No comments. I’m considering another project… umm.. how many will see this? *laughs*

Millions.

Actually, I’m considering a joint venture with another guy, and my hope is that I will take more of an architect guidance role, and he will do more of the coding, because I have plenty on my plate, with respect to coding. And it is macintosh software. And, yeah, let’s leave it at that. *chuckles*

Well.. is it software engineering software? Or you don’t want to say any more–

No I don’t want to say any more. It’s mostly because people will start writing me letters wanting to be a beta tester. *chuckles* So don’t write me asking to be a beta tester…

He’s making tax software. You don’t want to test it.

Yeah. *laughs* And also I don’t want the hype either.

You said you never really dabbled with web. Are there any other technologies that you like dabbling with?

Well actually I did do a few web apps, for example I did my own ticket system. Actually what’s the question, are there technologies I /don’t/ want to dabble with?

No– *laughs* Well if there are any technologies you want to stay away from, if you have some strong feelings about that…

Windows maybe? *laughs*

No like, have you ever tried out 3D, or–

Oh okay, yeah — I did a master’s thesis in computer science, and one part of the course is that you have to do a ray tracer, another is you have to do a 3D renderer, and you have to do a multitasking kernel–

So this was a very broad curriculum.

Yeah, it’s different courses; we have one kernel course, one compiler course where we have to do a compiler. So, related to that, I have been through all the various subjects in computer science, and I have used some of it since. I think the thing that probably interests me the most is probably compilers. Even though, it might seem a little boring, but it’s also very interesting…

Well I went to Rice where we have a lot of languages and compilers in the curriculum so, I think it’s cool too.

I’m actually using, for the scope selectors in TextMate and the snippets, I’m actually using actual grammars for that. I’m using ANTLR. This also means the snippets will have a little bit more syntax in the next version, because it’s so much easier to just add it to the grammar file, than actually have to code your own parser. Initially I did code my own parser for snippets but when you want to nest things, it gets really hairy.

You said you implemented your own ticket system. What was your motivation for doing that instead of using an existing tool?

I did evaluate various existing tools. One problem is that the sign up screen for filing a ticket was too complex, I figured. But the main problem is that I get, on average, at least a few tickets a day. And each time I have to log into some website and click and click and close and write some reason and close and click and reload and stuff like that. So, that was just, too slow for me. What I wanted was a mail interface. So I get an email, that says, new ticket, this is what it’s about, and if I want to, for example, tell the user I need steps to reproduce, I just wanna reply to it, and say “steps to reproduce”. If I want to close a ticket as a duplicate, or close it as some other thing, I want to reply and then just write tag:close, and then it gets tagged as closed so now this ticket is closed. I can handle everything in mail. The motivation really was that I want to cut down my own workflow. In all the systems I looked at, I had to go into a webpage and click so many times… and for me that’s enough motivation to write my own system.

So you interact with your issue tracking system–

Via my mailer mainly, yes. It is of course backed by a database. And another thing I wanted: when I release a new version of TextMate, I mention which tickets in the release notes are handled. And that automatically closes these tickets and sends out email notifications to people involved and people who have commented on these tickets. That was another integration I wanted. So I actually don’t have to close the tickets that I’m actually fixing in TextMate. So it was really just to cut down my own work.

What do think of the ecosystem of software engineering tools, like trac, and even subversion– do you use subvesion?

Yeah, I do.

Is there anything you see that you really wish was improved? It’s a very general question…

Subversion I’m very happy with. I recently started to look into the distributed systems. But Subversion works very nice, and has a very transparent model. It’s like, it’s a file system, but each change you do has a timeline, and that’s so simple to understand. The problem is that, you only do things that you would normally do with a filesystem. Where, with something like the distributed systems, you actually think outside the filesystem. You actually start to do the branches where a branch is not just copying a folder. So, that really opened my eyes, but I’m not unhappy with Subversion. It could support branches better, but maybe that’s because the model they have is not really ideal for branching in the first place. So I’m happy with Subversion. Trac, well I haven’t really used Trac extensively, but if I had to use it for a ticket system, which is the main thing I would use it for, it would have to have a mail interface. *chuckles*

Why isn’t there a damn stop button in the global search dialog box? *laughs* I just had to ask you.

*laughs* That’s only because the implementation currently in TextMate is the first implementation I wrote, prior to the first release, and I haven’t touched it since. In retrospect, seeing how long the wait for 2 has been, I probably should have redone the Search in Project, but it will be much better in 2, and it will be incremental and stuff like that.

If you wanted to add a stop button to Search in Project in TextMate 1, how long do you think it would take you?

*exhales, thinks*

I’ll pay for it.

It would probably…. more than a day. The problem is that, in desktop applications, as soon as you have to do two things at the same time, you have to involve threads, and as soon as you involve threads you have locking on shared data, and race conditions, and unexplainable crashes because of timings, so it’s really like…

Sure. [I wasn't buying it, but moved on] The bundles in TextMate are very powerful, and once you know the commands you want to use, it’s pretty easy, and if you know exactly what you’re looking for it’s very easy, because you have command-control-t…

*chuckles* Yeah.

…but it’s not very approachable, for new users–

I definitely agree

–it’s kind of weird… you click in the bundles menus, and it’s not clear how to explore what’s in there… How do you see that experience, the interaction with the bundles, evolving?

Well, I’m not really happy with the current state of affairs. The main hurdle in this is that, you have… for example in Markdown, the primary action in Markdown is probably preview. The primary action in Ruby is probably run. The primary action in C++ is probably compile. So if we want to do a toolbar, how do we do this toolbar? Do we have a run, a compile, and preview, or do we have one button with this primary action which changes. If we do this one button which changes, how do we allow bundles to say “this is my primary function”. That’s sort of the hurdle. Want I want to do, and I will talk specifics here, I want to introduce a tagging system for bundle items, so you can say, “this is the context help item”, “this is the run item”, tag it like that. And then I want to do a query language — because we know writing language parsers is cool — I want to do a query language where you can simply query the bundles, where you can say, “in this given scope, give me whatever action matches this tag”, and you can do boolean logic, where you can say “I want to run or preview or compile”, and you can use parentheses, and you can use boolean ‘and’, and you can say, for example, “give me the first match”, or you can say “give me a menu if multiple things are matching”.

That’s how I want to approach it. I want to have the toolbars, I want to have the palettes, and I want to base things on these queries. And I also want to take this to the actual current menus, because currently all the bundles are in their own separate space under the bundle menu. And some of the items don’t really belong there. For example, it’s very unintuitive that a lot of the text actions– like “strip trailing white space” in the text bundle, is under the bundles menu. Users expect that to be, maybe in the edit menu. But at the same time, I also want consistency in the menu system. But that’s the direction I’m going in.

So you’re adding toolbars and palettes. How do you think people will respond to that? Right now, the TextMate community is so– there’s not a single toolbar–

The good thing is that on OS X you can hide the toolbar. I think I will probably have the toolbar hidden by default. But then you can enable the toolbar, and whatever file you open, you will see actions which make sense for that file. For example you open a Ruby file, you will see “oh I can run this, by just clicking here”. Those are the things people currently don’t discover, but they should be able to discover with the toolbar.

Right okay, so, a highly context-sensitive toolbar.

Exactly, yeah.

Will it also change with context within the document?

Yeah, and that’s a bit of a problem I think, but on the other hand, if you are in an HTML file, and you go into the PHP part, the online help will change. Some of the time, the label will be the same, the action will just be changed. For example, you have help, and you can do help on a tag, or you can do help on a PHP function name. And even though the actual command calls for the help toolbar button will change, the toolbar button will be the same, stay the same, have the same key, have the same label.

So for example, you could have a preview. For example in LaTeX, it’s actually typeset in LaTeX, you can go into a listing environment, which is a source code listing you can have in LaTex, and if you go into a listing environment you could actually have that changed to a “run”. That’s something I still need to work out. Overall I think the concept will be much better than the current one.

What kind of palettes will there be?

Actually palettes are something I don’t really like, myself, so I will just make it like, you can do the palettes you want to do using this query language, and I don’t care, and there will be none by default.

But it’s going to be part of the infrastructure.

Yeah, it will. So I will just build an infrastructure with palettes, using this query language that I am introducing anyway, because I want do the toolbar, I don’t really want to do the palettes, but the palettes are more or less for free, and then I will see how people use them.

Well that’s all I’ve got. Thanks a lot.

Thanks.




Close
Powered by ShareThis