Software Engineering discussion

8 views
Beautiful Code > A Regular Expression Matcher

Comments Showing 1-3 of 3 (3 new)    post a comment »
dateUp arrow    newest »

message 1: by [deleted user] (new)

To All: If you are reading faster than I am (or reading out of order) and you want to comment on a chapter without a created topic, feel free to go ahead and create a topic for a chapter. -- Brad

I like small code examples that illustrate a variety of principles, and this regular expression matcher does just that. It would be fun to try to write this in Haskell.


message 2: by Steph (new)

Steph (spthomp) | 20 comments I never used a regular expression matcher - at least not formally. This chapter is a good example of tight code. Actually its like a well-written piece of music. There are no superfluous notes. Every line serves a specific need and to remove even one "note" will bring diminishment. (Salieri in the movie Amadeus)

I wish I had the time to code and run these examples.


message 3: by Erik (new)

Erik | 165 comments I agree complete RegEx libraries are very large, so it's great to see this compact edition that cover the most used cases.

To me, RegEx syntax feels like a "little language". It's a great skill to have basic understanding with, because it can be applied within other languages and for so many diverse tasks.

At a BBQ this weekend, my friend and I were talking about grep. He brought up AWK, which was great since we had just read about that in the previous book. That experience had made reading this chapter have an extra level of meaning for me.

It's certainly a delicate balance between compacting code and making it understandable. I think everyone is a little different in this area too. It's the artistic part of writing code. Personally, I don't need or like heavy commenting, but I am a fan of over things (e.g. giving literals and variables descriptive names).

I've worked for companies that enforce coding conventions and ones that don't care much. I don't think there's a right and wrong, but some people take this issue pretty seriously (even religious like).


back to top