The Stack Overflow Podcast

If you could fix any software or technology, what would you change?

Episode Summary

We review the things about programming and tech that drive us nuts. If we had the chance to do it all over again, how would we build Regex, CSS, or Bluetooth?

Episode Notes

Paul spent the weekend building a parser, cause who doesn't? He needed a Regex, found one on Stack Overflow, looked over the characters, and realized this is not the way to get folks interested or excited about code. "You come across a problem and you think to yourself, I know I'll use a regular expression. Now you have two problems." 

This sets Sara off on a tangent about CSS. What's wrong with CSS in her opinion. Well, all of it. She shares a few thoughts on how it could have been built right. 

Ben dives into the endless annoyances Bluetooth has been bringing to his life recently. When you have four people in a family sharing six mobile devices and five sets of headphones, audio signals are constantly getting piped to the wrong ears. Now his car wants to connect. When Bluetooth tells you it's forgetting a device, how come it never keeps it promise?

Our lifeboat badge of the week goes to Zero Piraeus for answering the question: Why must dictionary keys be immutable? He provided his answer in the form an elegant short essay, and it's definitely worth checking out.

Episode Transcription

Paul Ford You come across a problem and you think to yourself, ''I know I'll use a regular expression.'' Now you have two problems.

[INTRO MUSIC]

Ben Popper Are you struggling to deploy cloud native applications to a hybrid cloud? Do you want to become familiar with Kubernetes and Istio? IBM Cloud has a set of free, hands on training, ebooks, and an always on free tier of services to help you learn. Visit IBM.biz/StackOverflow. To learn more, that's IBM.biz/Stack Overflow. 

BP Hello, everybody, and welcome to the Stack Overflow podcast. I'm Ben Popper, Director of Content here at Stack Overflow with my wonderful co hosts, Paul and Sara.

PF Hellooo Ben! Hellooo Sara!

Sara Chipps Heyyy!

BP Hi Paul. Hi Sara.

PF The world's still here. Here we go.

BP Paul, why don't you cue this one up? Since it was your idea? Tell me about regex.

PF I just realized we've never, I don't think we've ever fully complained about regular expressions on the show. 

SC Yeah! That's an important part. 

PF That's just--Sara, where did you, where did you learn regular expressions?

SC Where did I learn regular expressions? When I was working in VB. Very in yester-year, very yonder-yore. And here's a decision I made early on in my career, and this is a decision every programmer needs to make for themselves, is I'm not going to memorize regexs. I'm just gonna google it every time.

PF Every time!

SC Yeah, what about you? I saw you talking about it. You seem like a memorizer. You seem like you may be able to write some. 

01:41

PF No. I learned, my first serious language was Perl, which is a is all about regex. So for many, many years, I reached for them. And then there's, there's a lot of luring culture, I mean, a few recommendations, we should put them in the show notes. But Jamie Zawinski was one of the originators of Netscape, wrote, there's a great line, which is like you come across a problem and you think to yourself, ''I know I'll use a regular expression.'' Now you have two problems. [Ben & Sara laugh] And I don't know if he first said it or if he popularized it, but it is--regex are halfway to parsers. Right. And they're, they're amazing for a few things. They're amazing at shell script level for just like catching patterns and text and doing things or using a set script to replace things. You know, Perl is funny now, because I think people reach for it in embarrassment. But my God, if you need to, like fix 50,000 files in some way, it is just A plus. But yeah, over the weekend, I was messing around with something and I found a regex that was like--and of course I hit Stack. And like, because what I was trying to do was backtrack, because I was trying to parse, writing a parser. But I needed to match quoted strings where you would have like, it'd be like single quote, blah, blah, blah, backslash single quote, blah, blah, blah, single quote, right? So it's, it's actually a hard thing to match. And I was I was hitting a wall, and I found the regex for it. And it's just an atrocity. Like, it's just horrible. I would never show anyone this and say, ''Here's programming'' because they never want to do it. It's, it's backtracking, like two backtracks, question mark, exclamation point, slash, slash, and you're just there's no letters. Just, there's nothing. There's nothing that looks like a human could ever make sense of this. And so yeah, I mean, I don't know is there? What are our choices? What can we do? Do we get better at parsing? Do you just learn more regex? What do you think?

SC So the question is, do we improve regex or keep regex? Is that what you're saying?

PF I'm just making conversation at this point. I just wanted to complain about regex.

SC Yeah, I think, right. Like of the things, it kind of just works, and it's in a, in a non annoying way. And so I think of the priorities of things to fix, CSS is number one. [Paul laughs] and regex doesn't make the top.

03:58

PF Alright, let's say I want to do this. I want to throw away the regex conversation and stop there and talk about the priority of the things we need to fix. So you say CSS?

SC Number one.

PF What's, what's the most wrong about CSS?

SC What's the most wrong with CSS?

PF Mhmm. Mhmm.

SC All of it. [Ben laughs] But who--like what float? Right float? What does that mean? Like, what is the box model? Why do we do it this way? This seems dumb.

PF It is grisly. And it's also just like, I think what happened too, there was a rough moment where in the interest of accessibility people got very punitive. And and so like, really the right approach and the standards bodies move slowly so the right approach to me, you know, we've basically backed into with the new grid model it's very tables plus like it is it.

SC Yeah! CSS grid is tables. 

PF But we already knew tables. And so part of me is like, wow, that is incredibly powerful, but also completely impenetrable. Tables have the glorious value of being really dumb. And yeah, you can put tables inside of tables. And so I think what I would really rather see, this is always a wrestling match in standards bodies is for some codification and simplification of the bad things people are doing towards the interests of accessibility, like, you know, okay, well, you if you're all going to do tables, and you'd like to be extensible, blah, blah, blah, we're going to tell you how to do it in a way that you can have your grid but not mess up the accessibility of the page, and then we'll ratify that. Which I think is some of it's not entirely off for what they did. But it's just, it's very crusty now. It's very powerful, but it's very crusty.

SC Yeah. And I think there's just like, I think CSS is what happens when you design by committee. I wouldn't, if you like, took a step back and start over with the web, I don't think you do all these things. I think that's I think the most annoying thing about CSS is I can't say, ''I want this like a third of the way down the page, always. Or sometimes.'' It's just ridiculous. So I think that's number one. What's number one on your list?

06:05

PF You know, what else is justification, like nice justified text with hyphens, which is something that's been pretty much available since around 1982, good open algorithms for doing it automatically, the Liang algorithm, etc, etc. who still struggle, I think you can do it now. I kind of gave up about five years ago, I went back recently, I think it's mostly in all the browsers, but they don't commit you know, every you know how sometimes in CSS, you'll see, you'll go to one of the pages like the quirks mode pages. And you can tell like, they're really, they're not committed to this. You're you're still where you were 15 years ago. Yeah. Okay. So CSS. That's your number one, you would fix CSS.

SC Number one. Yeah. 

PF Ah, man. And what's your number two?

SC Is it general technology?

PF Sure why not. It's our podcast.

SC Number two. I can't print. [Ben chuckles] I can't print. No one can print. If you want to print things, you just can't print them.

PF Printing to a printer. 

SC Printing to a printer. Number two on things that need to be fixed. 

PF It was when they got rid of the wires, they were like, ''Nah, we're all good. You can print over WiFi.'' Yeah, yeah. And its also every time.

SC Without fail.

PF Like it's like somebody every time you print a document, someone comes and hits your computer, he's had it with a shovel. And it's like, ''Oh, man, I don't know what happened. I was sitting here and I was gonna go to produce some document using ink. And I don't know what happened. Never do that again!''

SC That took me an hour and a half. I don't know why that took me and an hour and a half.

PF And I love the Mac is brutal, right? Because the Mac has all those beautiful little printer icons. like they've rendered all the printer and you're like, ''Well, clearly, clearly they know what's going on.'' Not a chance.

SC Yeah, no, no, I install my printer drivers once a month. My MacBook just forget. It's like ''I didn't, I didn't like this.'' Same printer.

PF No, no, no, you're absolutely right. What I like too, is that the process of printing increasingly seems to involve, like you have to log into your router. Identify the printer, and then sometimes tell the IP address too. I just it's not good printings bad. I have one that'll be controversial. JSON.

08:14

SC Interesting. Wow!

PF Yeah. Because it's just like, it's it's just JavaScript. And like, it's not I mean, YAML is worse, right? Like.

SC YAML is much worse. Yeah.

PF XML is, I understand why people hate XML. It's for documents. It was for documents. It wasn't for data. But what I miss about it was the absolute clarity of the data definition. So internationalization was built in, attributes and namespaces. And they were, they were not attractive, they were sometimes difficult to work with. And when they were loaded into memory in an XSLT, parser, the object model was 12 times in memory, the size of the actual data, which meant, which meant it's less of a deal, it's less of a big deal now, but when you had 128 megs in your machine, and you're like, Oh, I want this 1010 meg document near, near near near near to that plus, and you're sitting there, you're trying to hammer that dash MX into the into Java, trying to find the limit where your whole machine doesn't melt down. So okay, those are bad days, JSON is much lighter, it's much better that way. But the thing about things like s expressions and so on, like it's just so it'd be so much more clear commenting, internationalization, namespacing, things like that. It is, it is hard. I mean, then again, everything now reads it. And it's de facto, and there's workarounds and so on. So I accept that we live on a on a house made of sand. But yeah, I would, I would rethink JSON to be a much tighter sort of more lispy style.

SC Yeah, it is really elegant until I guess you actually need to do big things.

PF Yeah, as well. And then frankly, then you go over to protocol buffers and things like that you go over and do what Google does.

SC Okay, next on the list.

BP For me, I think these days is Bluetooth is destroying me.

10:01

SC Ohhh good one!

BP I got a car that has Apple play on it, you're supposed to be able to plug in the phone. And then it shows all your apps right up on the thing. Yeah. But I made the mistake of also pairing my phone to my Bluetooth. And so now if I get in the car and the Bluetooth is on, then the apple play won't work. If my wife gets in the car, and her Bluetooth is on the app, so I have we often turn off our Bluetooth before getting in the car, which just feels crushing. And I also have this thing where like, the Bluetooth is automatically synced to all of these different devices. So like, I'll be listening to music, and then my son will take my phone, he'll be doing something and I'll turn on a pair of headphones. And then suddenly, I'm listening to him play Minecraft and he's in another room and everybody's shouting at each other. It's just like, I know Bluetooth is trying to help. But the automatic connections that it makes and remembers and forgets is it's killing me right now. 

SC Yeah, that's a big one.

PF Bluetooth is heartbreak. It's just never, it's another one to where everyone's like working great. Everything's good. We figured it out. And then you you have the experience over and over. This is gaslighting, right, like this is just the tech industry. [Paul & Sara laugh]

SC We were never connected. 

PF Yeah. What do you mean?

SC I was never connected to that. 

PF Or it's like, ''Hey, I thought you said you were done with those headphones.'' Well, we're just friends. We just sometimes. There's like I said, there's a strong connection there you that doesn't go away in one day. And you're like--

BP You promised me you'd forget. You promised me.

PF You said, I told you, I said we're gonna forget those headphones. And you looked at me and you said, ''We're not ever connecting to those headphones again.'' Oh, and here we are, I walk in on you and you're connected to those headphones. And Bluetooth is just like, ''Man, I was named after a Viking. You know what this is like.

SC Yeah. Okay, two more, I think that gets us to 10. Maybe, I haven't been counting. Okay, the big one. The first one is like kind of particular to, well, if you're at Stack, you'll understand. And this is maybe controversial and apologies for all the folks listening that work on this. But ASP.NET is a...so here's, here's what happened.

12:05

PF What is ASP.NET? Can anyone tell me?

SC ASP.NET is a front end framework for Microsoft applications. So C sharp, you know, F sharp, all the sharps, you know, and other back ends, you can use it with lots of different backends, actually. But the thing that they did here is, and this is something that Microsoft does in general, and it has its like really pros and really cons. You see it with Java two, I think it's just those big enterprise languages and frameworks is that with ASP. NET, there's so much you can do in the front end. And it kind of removes the component, the way you think about HTML, CSS, JavaScript, where you're kind of like choosing your flavor, as you're deciding what to add. There's a lot of functionality, but it's like too much. There's you can do too much. There's too many things.

PF Yeah, I mean, that need for simple is so great when you're trying to do anything. And I'm looking at the ASP, I'm looking at the ASP. NET webforms Wikipedia page right now. [Paul chuckles] Just one, one component of this bad guy and like, whew, it's just, I've got like, 20 file extensions alone.

SC Yeah, it's a lot.

PF Yeah. I mean, web forms are also a mess, right? Like that. We're just trying to drag the 90s into 2020, towards 2030. And to the point that we've dropped an entire virtual machine into the browser and said, ''Okay, we give up you guys take it from here'' right? Like, we're just, I started reading up on flutter, right, and flutter is a, so it's the language Dart plus a set, essentially, you know, SDKs, and components that are very cross platform. So it can look like iOS, it can look like Android, apparently, it's a very good Android and iOS development environment, people really love it. But when you get to its web view, it's like rendering on a canvas with Web GL. And that's a lot, like that means you can't and you can't cut and paste. It's like, no, you got to be able to cut, no, you can't can cut and paste. So like, you know, everybody's trying, but it's gonna be sad. I'd hate to lose the web. And the things that the web lets you do behind essentially dynamic, exciting canvases that provide perfect fidelity. So it's gonna we're gonna be wrestling with that probably forever for as long as I live.

14:27

SC Yeah, it's true. You know, what a real mistake we made, I think is I don't have a solution here. But a real mistake we made is making it so you can't replace things like web forums without a quorum of people who don't like to quorum. Yeah, who don't like to agree on things. Yeah, so it's just it's kind of near impossible.

[MUSIC]

BP Alright, y'all. It's that time of the week. Paul, I have a lifeboat here I think you'll enjoy. ''Why is it necessary prediction can be immutable? I'm looking for a simple, clear reason why keys and Python dictionaries have that restriction.''

PF You know, and asked six years ago, and there's just this lovely essay in response. And the short answer is that it pre calculates integer keys and hashes those for very fast dictionary lookup, and that you, you lose that speed if you went immutable. So but just a good answer, check that one. I'll put that in the show notes. Good, good work.

BP It's kind of like having all your CDs neatly alphabetized rather than stacked randomly on their cases or on top of your speakers. That's a metaphor I can get behind. 

PF Good lifebotin'. 

BP Alright, everybody. Thanks for tuning in. I'm Ben Popper, Director of Content here at Stack Overflow. You can find me on Twitter @BenPopper, you can email us podcast@stackoverflow.com and we would love to hear from you!

SC And I'm Sara Chipps, the Director of Community here at Stack Overflow and you can find me on GitHub @SaraJo.

15:54

PF And I'm Paul Ford, friend of Stack Overflow, check out my company Postlight a Postlight.com. Bye friends!

 

[OUTRO MUSIC]