Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Learning curve and title (in)appropriateness #12

Open
shreyasminocha opened this issue May 1, 2020 · 0 comments
Open

Learning curve and title (in)appropriateness #12

shreyasminocha opened this issue May 1, 2020 · 0 comments

Comments

@shreyasminocha
Copy link
Owner

This is not a book for regular folk.

A regular HN reader, sure. A technically inclined interested party who wants to break the ice with > Regexes, sure. But not regular folk.

Here is what I'm talking about:

Introduction

Regular expressions (“regexes”) allow defining a pattern

Ok, with you so far. As a layman, though, I would be very much be looking for you to expand on what you mean by 'pattern'.

and executing it against strings.

"Executing" gets a wrinkled brow. "Strings" gets a squinty eye. "executing against strings" and you've lost me. There's now too much new information in this sentence for me to be on board with it. If I knew what all those terms meant and the context with which they are meaningful, I probably wouldn't be trying to read 'RegEx for Regular Folk'.

Substrings which match the pattern are termed “matches”.

As above, but it's also slightly confusing here that we're defining matches and we haven't even talked about what a pattern is yet. As such, I can't even visualise or conceptualise what I would be matching or similar. If I press on regardless, this is just some unresolved debt that I will have to reconcile later or I will just get frustrated and put the book down.

A regular expression is a sequence of characters that define a search pattern.

Ah, good, we're defining a pattern after we've already described a 'match'.

Regex finds utility in:

input validation

And straight out the bat we're hit with a term that is only going to be relevant for techie people. Unless you are aiming this at techie people. But aren't we aiming this at 'regular folk'?

The above is really just my long drawn out beef with 'x for the masses', 'y for mere mortals' and the like. For me the best explanation of regular expressions comes from Al Sweigart in 'Automate the Boring Stuff with Python' [1]. He not only gives a pretty thorough explanation of pattern matching before bringing in any domain-specific terms, but he also motivates why you would want to pattern match in the first place. He gives context for circumstances under which you might reach for regex as a tool.

I'm looking through the later pages of this book and as a techperson I'm thinking 'this is beautiful. I can see the examples clearly, there is a clear correlation between the visuals and the exercise.' I'm also thinking as a folk person 'when the hell will I need a match? Under what circumstances and I going to need to know that there is one 'p' in 'grape' but two 'p's in 'apple'? What use is writing a pattern to match against certain fruits and utility items?

So yes, basically, after all that I can summarise "good book, bad title".

[1] https://automatetheboringstuff.com

Zhyl on HN

@shreyasminocha shreyasminocha pinned this issue May 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant