The Stack Overflow Podcast

We're building a web app, got any advice?

Episode Summary

This week, we're chatting about how cron jobs work under the hood, Ben sets out to build a simple web app for his local dog park, and we discuss why our Director of Design chose to change careers and take a role as an associate software developer.

Episode Notes

Thanks to Marceli Wac for sending us a question about cron jobs. We love getting mail from listeners and try our best to read interesting questions on the show. 

The goal for Ben's app is simple: let anyone register their intention to show up to the dog park at a certain time so that strangers can have a better chance of arriving at the same time and get some exercise for the pups. What's the simplest web app that would collect the least personal information and reset every 24 hours. Bonus points if we can do it without a database! 

Kristina Lustig, a veteran Stacker, wrote a great blog post for us: I followed my dreams and got demoted to software developer. 

Our lifeboat of the week goes to Mike Nakis, who answered the question: What is the difference between memberwise copy, bitwise copy, shallow copy and deep copy?

Episode Transcription

Paul Ford What is sadder than a lonely dog at the dog park?

[INTRO MUSIC]

Ben Popper Are you ready to start writing your tech story? Join an Ironhack boot camp and learn the skills you need to pursue a meaningful career in tech. Visit ironhack.com/write-your-story to find out more. Let's write your story. 

BP Hello! 

Sara Chipps Hello!

BP Good morning everybody! Hi Paul, Hi Sara.

SC We're back!

PF Back once again. 

BP Back once again. I woke up this morning to see that Tesla has put $1.5 billion of their holdings into bitcoin. So...

PF Oh, cool. So the energy that they put back into our ecosystem, they can take out in CPU cycles, GPU cycles. 

BP Yeah, there was a tweet. And this is very funny. It said, like, "I just saw Tesla invested all this money. Finally, I can stop worrying that Bitcoin is bad for the environment. Wouldn't have done this if it wasn't" because they're like a clean tech company. That's what this means.

SC Wow, look at the Bitcoins. 

PF I'll tell you no one makes it look less fun to be the richest person in the world that Elon Musk, like that just looks no fun.

BP We had meme stocks and meme stocks came along and took over the market. And now we have I think Tesla is a fun meme company.

PF It's literally you have the coolest sort of girlfriend, spouse, you have a new baby to add to all the other babies, you have all the money in the world. And then you go on Twitter. And sometimes I put Google Calendar notices in for years ahead. And they'll be like, don't talk to anyone. It'll be just sort of like like reminders to wind yourself down and disappear. At a certain point, I have a reminder for when I'm like in my 70s to just like, be done by now. Right? Because the people who hang out, it's a bad seen, just a little distraction with Elon Musk, a good news. Congratulations, Tesla and Bitcoin happy for everybody.

BP So I always encourage people to send us email and guess what? It's happening. So wanted to send a shout out to Marcella Wac. So I'm doing my best here. "While working on CI for my project, I had to run a command line that will execute with a delay, ie sleep. This obviously keeps the terminal window busy preventing me from entering other commands, which somehow steered my mom to thinking about cron jobs, how do they actually work under the hood without having to run all the time, or there's some timer set which magically execute commands when needed, or a system that runs in the background constantly checking for jobs that need to be executed? That sounds inefficient!"

PF One of my favorite things to do is read unix source code.

SC Yeah, I know Paul, yeah. [Sara laughs]

BP In your chair on the reMarkable 2, we know.

PF Listen, I mean, checkout calendars, calendar cal, that's my favorite because there actually is like, the little gap in the 1700s. When they change the whole calendar, you can find it there. They they went there. Pretty exciting. That's the word I use, Sara. So I was like, let's go read the source code for cut cron. And I typed in how does cron work and what comes up, but Stack Overflow?

SC So I was interested to learn about--so I was like, well, that's one of those things you don't think about regex just happens for you.

PF Ah, it's been there for probably since the 70s. It just is so cron is the classic utility. It has this weird little syntax and it runs recurring tasks. So it's great for rotating and G zipping your log files every night at 4am. 

SC Yeah. And it brought me back to the days of writing shell scripts, which I feel like programmers used to do a lot more or did I just--was I just surrounded by them at the time?

PF [Paul speaks in older voice] No, no, Sara. 

SC Back in our day..

PF Shell scripts...[Paul laughs] Listen, shell scripts are low code. And everyone should learn at least one shell I would suggest fish, fish is good shell. Shell scripts are wonderful, they come in, you know, everybody's like, well, we need to reinvent add in a second run run under node in a multi something dimensional something. But it actually you can do such good stuff by just writing lots of little programs, stitching them together. And then going home. It's batches. It's little batches. Right? Anyway, and pipes, these are good things, use them, use them to get things done. Yeah, but no, no, I might as well script my pulumi.

SC So we learned about cron tab with a Stack Overflow post that you shared. So I had never heard of this before. And it's very interesting. crontab is a database that runs on startup of your machine that contains the cron jobs that need to be run.

PF That's right. So and everybody every user in a Unix system because it used to be that it system would have multiple users instead of being one of you know, 150th of a user of hosting Netflix video, would be able to add their jobs to the machine and then the machine. The thing I love about Unix in general--[Sara laughs]

SC How much time do you have? [Paul & Ben laugh]

PF Yeah, seriously. I'm about to ruin the party. Again! Don't invite him. So the thing I love is that you sit there and you go like, boy, how could they have done that incredible magic? What a weird thing that must have been to come up with. And then if you look at the source code, you're like, yeah, this is dog simple. This is what I would think it was like, it's almost never surprising. So how does cron schedule jobs? It takes a database, and it makes it into a set of commands that it can easily reference. And then every minute, it says, Hey, anything should run now? And you know, it does a little query and the query is like, yep, I got these, you know, rotate the log files time, it's 4am on a Thursday, and it goes, cool, going to do it. And then that's it. That's the whole thing. And that's kind of what you'd come--if I if I locked you in a room, not like SAW style. Just like, let's get some work done. And I said, Hey, could you figure out a way to internal to schedule cron jobs? I think you'd pretty much come up with this, right?

SC Yeah, that's right. Like if, if I didn't have StackOverflow, and I had to design it.

PF No it'd be like, hey, I need a I need a little database, I need a format for representing recurring tasks. So that's give me five asterixis and cross my fingers. They're great websites, there's like, I think it's like crontab.guru.

SC Ohhh, anything dot guru is very encouraging. 

PF Crontab.guru! Look at that. I remembered a URL like animal from 1999.

BP It was the .guru, that stuck it in your mind, admit it.

PF Oh it is! I am the dog on the internet. I didn't even know I could remember URLs anymore. I thought you just had to go through Facebook. And so it will help you with crontab syntax. And there's you know, there's also like, at yearly at reboot, there's all this non standard crontab syntax, which I'm sure is sure there's a lot of discussion about that. So crontab.guru will help you set up the syntax. And then you need to parse the syntax into something that is easy to look at every minute, then you know, how long a minute is, and you just you're like, hey, this runs all the time. Never stop.

SC A computer is just a very fancy clock is something that you learn.

PF My best line as a writer ever is just a computer is a clock with benefits. 

SC Yeah!!

PF That's the only that's the only thing where I'm like, yep, that's I will stand by that until I die. Meanwhile, about 400 emails are about to come in.

BP Speaking of small little databases, I had an idea over the weekend. It's the first time I've had an idea for like a web app that I actually would want to build. I had suggested to someone when I was looking for a tutor, like I'll do a to do list and they were like everybody does the to do list. Like, this is so boring. I'm not even I don't even want to teach it to you. But around here I live there's a couple of really nice dog parks, but you got to get in your car and drive there. You know, it's a hassle, especially in the snow. And you're kind of hoping that when you show up, somebody else will be there with a dog.

PF Oh! 'Cause you're not in New York City anymore where there are dog parks all over the place.

SC Oh that makes sense, that was very confusing to me. Okay. 

BP Yeah, so people come from far and wide. Sometimes they drive half an hour and they're sort of just like, you know, crossing their fingers and hoping that they'll have some good dog playmates for their dog. So you can make friends and text people but you know, that's a bit of a you know, that's that can maybe is too much for some people, they want to just have casual hang and so I thought what if I just drew up a webpage that's a 24 hour calendar that resets every night at midnight, in our little timezone and you can say, I'm going to be at the dog park for this half an hour this hour. This is my dog, you can you know, and then people will know when you're going to be there and you can go meet them. And they I guess the goal is to have as little personal information on there as possible. Like just wipe at the at the end of every day. But you know, I'm sure later on it could be full featured or whatever. But what would I need to build this and what languages would you recommend what technology you recommend?

PF First of all, before we get there this needs a cute name.

SC And some branding.

PF We need a name for this. Yeah, that's where I that's where I personally would start. Let's see Pup Finder? Nah.

BP Canine Calendar...

PF Park Woof? ParkWoof.biz? 

SC ParkWoof.biz! [Ben laughs]

PF Oh, no, no! Something with packs.

BP Oh, yeah. 

PF Park Pack! Let's see ParkPack.com is not 403 forbidden nginx so I think you could totally--let's see, what are some other ones? Dot horse. Hold on, we're gonna we're gonna let's get you because this is really what matters. Let's get you the URL. And then you know, implementation is trivial. That's what I'll tell you as an engineer. Park pack. This the best part right because you haven't done any work. 

SC I think it's catchier if it's Tinder for dogs, you know, right?

PF But then you're swiping.

SC There is the swiping. 

PF Look, we're gonna hire a branding firm. It's gonna cost about $30,000 to $40,000, it's not gonna be, it's not the good stuff. Yep. Get the logo you know, but ParkPack.club is available. Anyway. Regardless, Sara, what do you think? So what do we got--let's actually get the use case right really quickly. So as a user, I just want love. So I want to come in and what do I really want here? Like, right? I want to know, I mean, we could go all the way out to jobs to be done like the, you know.

BP I think there's two things you want, I think you want to hit this service and see immediately, the calendar, what hours today, will other dogs be there, and then you want to just have one other option, which is like 'reserve a time' or like, you know, 'add a time' and you quickly--

PF Because there's no maximum here. It's not like vaccines, it's like you could have, if 100 dogs want to show up, that's actually wonderful. 

BP It's wonderful. I mean, like, yeah, the more complex would like, and then if you don't show up, you get a bad rating. And then people can, you know, change it.

PF This is your as a client, I'm gonna tell you just yeah, stop right there. So okay, simplest experience that I can imagine would be going to the dog park, I'm going to register interest. Do I have to give you any information? Or can I just click and say, 'I'm gonna be there'?

BP I was thinking the only information you have to give is like, the name of your dog or a picture of your dog, not even your own information. 

PF Don't even do a picture. Name is so good. So I think it's just like-oh, do we care that dogs are big or little?

BP I thought, well, that was initially it could be like, name, size and temperament are the three the three things I was thinking.

SC Are people honest about their--I don't have a dog. Are people like, are they like, 'my dog is actually a ginormous jerk'? [Ben laughs]

PF Well they always underplay it. If somebody is like, 'Yeah, he can be a little rough around children.' It means like, keep children 150 feet away from this dog. 

BP I mean, right? Temperament is kind of, yeah, people are always gonna say they're always gonna hedge on that one a little bit. So maybe just name and size and then you're--

PF We're already down the rabbit hole. All we want to do, I wouldn't even do size, like, let's just start with like, so first of all, you need to put a calendar on a screen. You're not not doing an app, you're gonna do mobile, web and web.

SC Yup, yup. 

PF How far ahead would people normally schedule their dogs? 

SC Good question.

BP I want to say that that's what I was thinking. It's like, Oh, you could look down the week. But I want to just do it by the day, because a lot of it is weather dependent. So it's just like, am I going to be there today? You just check it in the morning.

PF Okay, so in the morning, oh, I gotta take Ruffles for a run. I want to take them to the dog park that will bring his joy will bring meaning to my life. How? When does the dog park open? When does it close?

BP It's like eight in the morning till sundown.

PF Alright, so let's just be easy. And say eight to eight, right? 

SC Yeah, 'cause sundown is a tough one. 

PF Yeah, and dogs. Dogs can play in the dark. They're, they're smart. Okay, so let me give you the absolute simplest thing that I can see. And then I want to I want to hear what Sara says. So first of all, no authentication, no login, nothing. I am going to allow tremendous amounts of abuse to this website, even though but you can't really do too much with it. So the absolute simplest, I wouldn't even take the dog's name, what I would do is just make an app that lists every morning at 8am automatically lists half hour bundles, right? So 8-8:30, 9-9:30, in blue underlined text. And then if somebody clicks on one of them, then that counter goes up. And a number appears to the right of that time letting people know how many dogs might be showing up around them.

SC That's so elegant. I love that. Because you don't need to know names. You're not near up thinking--

PF Why?

BP Because like, yeah, I think if you've gotten to the point where you know the dog's name, and you know that you're friends with their dog, then you you're probably going to throw out a text like, yeah, maybe, you know, this is like, I want to go and meet strangers--is that's that's the challenge is you're hoping to meet just randoms.

PF I mean, let's be clear. If you show up with a Chihuahua, and they show up with, you know, a Rottweiler, the Rottweiler gets a snack. It's wonderful. No, I mean, it's there is you're gonna have a fun conversation, like, well, let's see how these guys do together. And then, you know, the Chihuahua bosses around the Rottweiler and a hilarious memory is made. That's the absolute simplest, right? Like, what's great here is that, all you have to do is one stateful transaction, which is like, you know, where you're gonna, they're gonna click and you're gonna say, 'Okay, for that time on this day, right, increment by one.' Now, there's all sorts of problems. Somebody could be like, I'm going to pretend to have 100 dogs and just hammer that button. So now you're like, do I let him click twice? Is there a cookie where it gets wacky here? So the less you do, the better because now it's like, well, you're gonna give him cookies? Well, do you have GDPR concerns? You know, it's just like, but you're not tracking any. So what you're doing here that I love is that it's a very Webby transactional website. It doesn't, it can just be pages, right? You don't even need this for the live stuff. Now, second thing you could do is get a dog's name, which actually is sort of nice and hit, you know, stopping nobody's going to enter a dog's name 100 times, but they can click 100 times. So it's a nice sort of like gating mechanism. And you get to know the different dogs and so on and so forth. So that that's what I would actually want to build, which is somebody can put a dog's name in. You're actually, you'd probably want to give them a cookie where the dog's name pops up every time they try to enter that, but you don't need to know anything about who they are. So that would be the experience like comm, I have a list of times, I click one of the times, it's half hour blocks, and it gives me a little pop up and says, 'What's your dog's name?' Or takes me to a page where I fill that out. And then I would just the page Ever After we just list all the dogs underneath the different times, I wouldn't even like no more interaction. If I come to the page, I can see that seven dogs are gonna be there at 10:30am. And it's Rex, Fido, Allen, Kevin, Kevin. And then actually three Kevin's which is not a bug, there's actually three dogs named Kevin in our community. So that's, that's what I do. Sara, where's your brain go?

SC Ah, my brain goes to immediately goes to not to the user experience. But how to make this. This is good. We make a good team, because now we can move past the user experience part, which sounds like we've kind of nailed something close to it.

BP We've got a rough MVP. Yeah.

SC Yeah. And I was just thinking, like, how can Ben store this data in a non painful way where it doesn't have to set up this whole database? And I think you could just do, like, regardless of the language that you're using, it seems like if it's just one day worth of data, you could just do like a JSON file and just rewrite it all the time.

PF Yeah, that's exactly right. If you want an archive, you could have it or you could say the hell of it. And just yeah, every morning at eight, you start over? You don't need the database here.

SC That's convenient.

PF Yeah, all you need to do, now all you need to do right on the server, is figure out how to open a file with data in it. Yeah, change that data, and then save that file. And you might need to generate the file each morning. So you would generate it by stepping through, you know, 12 hours and half hour intervals and setting those times up. So it's like you're making you're making the data that would make the page and every time you change the page, because you're never going to get a situation with this where people are like, smashing your database, right? Yes, it'd be, you're always going to have that couple of milliseconds leeway.

BP I mean, yeah, for whatever reason, this somehow ends up being the object of a trolling and we get overloaded. That'll be a good story, too. I'm not too worried about it. There's only 2000 people in my whole town. So I don't think it's gonna be a problem. But we'll see.

PF I like Sara's idea of avoiding a database quite a bit. 

SC Yeah, you can also like, just check to see like, when a user comes on, you can just check to see 'Oh, is there a file for today?' 'No file? We will create it.'

BP This is great, because I didn't think that there was gonna be one of the challenging parts. Okay, cool. Alright, I'm gonna set a set myself on this path,

PF All you need to do is figure out how to write and read a JSON file on the server. It doesn't even have to be JSON, it could be CSV, like your very simple zone. It's actually it's really good to start there, Ben, because the databases should come after flat files. In my opinion, you should learn like kind of what the data is a little bit and loaded in and out and serialize it and mess with that stuff. Before you actually get into the more complicated schema based stuff. If you're if you're a newbie programmer, it's it's good stuff to understand what those pieces are made of.

BP Well, I'm glad we've put this little flag in the ground. And I'm gonna report back after a couple weeks and let you know how it's going. Because, this is the first thing I felt like, genuinely compelled to do not like the, I really should get better at coding, because it's embarrassing after a year and a half of this podcast. But like, I could use this product. So maybe that'll be the motivation I need.

PF How are you going to market it?

SC Yeah!

BP I was thinking laminated signs at the dog park.

PF Ohhhh! That's good. That's good. 

BP There's also a group, I could throw up a post on the Facebook group.

PF Hmm. I, you know, I would have spent $30,000 on Google ads, but you know.

SC They can be really targeted.

PF Your plan might be smarter. Yeah, maybe it might be a lot wiser to actually, you know, meet them where they are not do a big halftime show. Alright. This is exciting. I mean, part of me too, I want to get the dog's names. So I think you might want to hold on to that. Maybe what you do is, you know, historical information is good to get rid of here. Nobody needs to know when the dogs were at the dog park historically, because that is something that you can use to stalk someone.

SC Yeah, and the names aren't important. 

BP And I don't want people IDing each other right by the dog name. They less PI, the better. 

PF I mean, the other thing I would say is like the two things to always think about when you're structuring this stuff are like, can I make this accessible, nice, plain HTML kind of stuff is very accessible, pages are very accessible. So if somebody is like, just you know, has various needs, like as simple as possible is really good here. And the other thing is the question I just asked, which Sara like, like, how could this be abused in such a way that people safety would be a risk? I mean, if you were really, if someone was stalking and they wanted to know when someone was going to be at the dog run, and they knew the name of their dog. So if you really want to take care of people, you wouldn't ask them, you would just say like, you know, optional. Enter the name of your dog.

BP Yeah. And I liked your setup where it's like you check the time, and it tells you how many dogs are going to be there as opposed to write like a calendar where you might like, sort of look around for somebody. I like that idea a lot.

PF Yeah, I mean, actually, like, if people want to give you the name of their dog, because they don't care who knows, which small town probably very nice. But if somebody is just like, 'I'd like to see dogs, but I really don't want that guy at the store who keeps telling me weird things whenever I go to checkout to know about my dog' Or, you know, whatever, 'My husband and I are in a custody battle for our sharpay. And I don't want to deal with it.' You want to actually cover that use case, it's amazing how quickly that will come up. If you don't pre address it. Like you've got five minutes from launch to you've created an unsafe situation with any website in 2021.

BP 'Cause that's what I was like, why don't I just create a public Google Calendar and throw that up and people can get on it? But then I was like, yeah, I don't want people to be using their actual emails. 

PF This is right. It's a decentralized network for dogs to connect.

SC For dogs to connect. Even though we don't like dog Tinder.

BP Well, registering gets you a Pupcoin, Sara, so you get one Pupcoin every time you put yourself on the calendar. Those can be redeemed later.

SC Dogecoin or Pupcoin?

BP I can still afford to give those out. They're only like five cents each.

PF So really, I mean, this is it's dog net, is what you're creating here. It's a butt sniffing network. You're the hub to allow for pheromonal exchange between emotionally needy animals.

BP Now it sounds like I need this needs to be age appropriate. Are you 18?

PF Or is your dog 2.5? 'Cause that's 18 in dog years, everybody.

SC Yeah, this is making me think of this great performance artist. And one of the things he did is go to a local dog park and post a big sign that said 'Dog fight tonight. 7pm. Small dogs only' And just like a bunch of pictures of a bunch of like tiny dogs, it apparently came down very quickly. But there's a precedent for setting signs at the dog park is what I'm saying.

PF I mean, that's deeply uncool, but also hilarious. Like, I think that's, you know, we're all there. Don't fight dogs. That is an official policy of the Stack Overflow Podcast, no dog fights.

BP I want to give a quick shout out to a post that went up on the blog this week. It has a fantastic title: How I Got Demoted to Software Developer to Follow my Dreams. It's from Christina Lustig, our former director of design, who over the years just felt like she really enjoyed coding, engineering problem solving. And she kind of started getting into this with some of the folks on our team who were on that side of the house, and eventually decided she wanted to move over. And so did that, which was pretty brave. I mean, you know, obviously, she had a job here that would allow her to do that, which is pretty cool for Stack Overflow to be flexible. But it's a very cool piece about, yeah, making a pretty significant career change, going sort of, you know, over to a different department. And yeah, I think we'll try and have her on the show soon to chat through it.

PF I mean, those moves are hard.

SC Very hard, very hard to be new at something as an adult. Like, it's hard to it's hard to not be the one when you've been the one that knows all the things, it's hard to go to the opposite.

PF First of all, this is a good move. When you when you take the move, this piece is good. And you should when you take the move back, you have to do it strategically and wisely. And not everybody can do it, especially if there's a salary cut. But I've never heard anyone go 'wow, I took a step backwards in my career in order to learn more. And boy that was that a mistake?' I've just never heard it actually. Usually, I think it's something that people consider very deeply. So no one does it lightly. But getting that broadening that understanding and being able to connect to disciplines is always a superpower. But it does take like a year to develop the superpower. We're not really an industry that's like, 'Hey, you should switch everything.' Right? Like that's not actually, we act like we might be. But we're not.

SC Forward momentum is like a really tough thing to we know, when you put a lot of work into a career, it can be really scary.

PF That position of total humility, when you're entering a new discipline is incredibly informative. It's actually a very healthy thing to do as an adult. I talk a big game, but I've done it a couple times. And I mean, it's sucks, you're an idiot. You're used to feeling competent and skill. You know, I remember like some of my first professional consulting experiences and just like, you know, some CTO sitting me down and I, you know, just getting up and feeling like I'd lost an entire layer of skin. Oh, I you know, I shouldn't have advised you that way. Yeah, I think Mongo is very interesting. You learn quickly. What's it what what you think is interesting and what the real job is, and it is, but it's so informative. It's so good. So that's great. Congratulations! 

[MUSIC]

BP The lifeboat of the week! This question is still open. So awarded to Mike Nakis, who has now gotten up to a score of 20 or more on Stack Overflow proper. 'What is the difference between memberwise copy, bitwise copy, shallow copy and deep copy?' So I'll put it in the show notes. Y'all can go check out Mike's answer, which is gotten a good score, and maybe we can accept it. And we can close up a question. 

SC That's great.

PF Woo!

PF Doing our part. Alright, everybody. Thanks so much for tuning in. Thanks for emailing us. We got some really nice tweets and DMs this week. We're glad that the show is making people feel good. And we're always open for suggestions of topics or anything else.

SC Yeah!

PF Yeah. Love those questions. Especially if you find any really banana cake stack stuff. Boy, we want to know.

BP Yeah, exactly. Print those out and physically mail them to Paul. They're close to his heart.

PF Please. 

BP I'm Ben Popper, Director of Content here at Stack Overflow. You can always find me on Twitter @BenPopper and email us podcast@stackoverflow.com. 

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

PF And I'm Paul Ford, friend of Stack Overflow. I'm the co founder of a company called Postlight, we're an agency that builds software. If you're an engineer, love to hear from you. Also, if you're a designer or product manager, I think I've used up all of my credits for promoting. Nonetheless, get in touch. Postlight.com/careers. Come on, do it! Do it! We're growing! The company's growing! What you were going to say something? Apply to Postlight!

BP I'm fading you out right now. You're getting faded out. 

PF Please!

[OUTRO MUSIC]