logo

NJP

The PhxDev Show - Commenting Code

Import · Jun 09, 2022 · video

[Music] and now the host of the phoenix dev show mark scott [Music] come along every time i just get a little dance going like it just gets me amped i don't know i just like that kind of stuff like i don't know if it was if it was punk rock that might be better but i'm telling you it's hard it's hard to find it's hard to find a bug rock band that's putting anything out there for for for non-copyrighted use you know you got to do this this is a call you got a call to action anybody who's in a band who can do punk rock kind of like cover music for mark do it up get in touch yeah yeah all right well welcome everybody um this is the phoenix dev show i am your host mark scott also known as phoenix dev um sweaty dev today it's very hot in phoenix it's incredible why do you live there i thought that place was called the surface of the sun yeah yeah you don't have to shovel it though like it's it's not that bad like at least you don't have to do anything you just stay inside it is the lazy man's um paradise i guess you could say because you know there's no beaches you know there's no like you know seagulls or anything to make a mess in your hat like on you know like stoops and stuff in your house there's no there's no hurricanes or natural disasters like do you guys even use like cooking pans can you guys just cook outside on the on the cars no but you know what's funny we don't we i there's a moratorium all summer now in my house about cooking indoors like we have to either cook on the grill use like the the ninja foodie or something like we have to use some other you can't use the oven it heats the whole house up i'm in an old house and and my ac units are not they're just they're man they're doing their damnedest but they're they're just barely keeping it together so yeah i um yeah yeah it's it's gonna upgrade those ac units no i don't come on i rent like i'm done like i'm gonna go buy a brand new house that someone already put like you know ac units on because that's expensive around here all right yeah but you know um a terrible a terrible segue i've got uh which i think we're famous for but uh i was gonna ask you a question uh and we were kind of discussing it before we jumped on here but but you know is have we come have we come full circle jace like are we now the people who are making the news like if i talk about it on this stream does it become servicenow news like is it servicenow news how does that how does that feedback loop actually work wait uh i mean it's not going to be recursive to get recursive you have to draw a comic no i'm not gonna well first of all jeff pierce could do that i'm not doing that stuff like no no i can't do it um but i'll tell you what like i've got a question for you and if i say it so like i'm going to cut it i will cut this out and i will share it so that it becomes a sound bite right like one of our shirts all right but if that happens if i mark scott phoenix dev say this into the servicenow ecosystem does that make it service now news i mean maybe okay like i mean people say a lot of things you know you know and i just try to keep the stuff relevant to servicenow in a little tiny five minute clip that is helpful for people every week but if it helps people like let's say it helps service now people sure okay why not okay so here it is here it is all right that was my cut mark by the way that was that's where i noticed okay here it is that's my leading device there you go right i'm trying to make this on the fly people it's it's it's going very poorly but um here's the thing domino's the pizza chain has 50 off all week any pizza nationwide is this sponsored by domino's no no one's sponsoring this this is out of the kindness of my own damn heart right like it's kind of be a service now person influence or whatever the terrible word is that i don't even want to admit right i'm like then i'm gonna i'm gonna lead i'm gonna lead with some hard-hitting journalism and if you want half off of pizza domino's has a deal all week right i know a better deal in town yeah what a great segue what what what deal could you possibly know jase there's a hundred percent off deal happening right now it's free free it's free right you just gotta go to my website and click on i'm just kidding it's uh the csa certificate yeah yes the big big big news it's the summer of certification that's that's what i'm declaring it yeah summer certification um so you say all summer long free until august 31st which by the way if if deadlines if deadlines kind of make you nervous dare i remind thee deltas are due people deltas are due like make sure you're getting your deltas done i actually had a little but this time though you can miss it for the csa because you can just get the csa again no don't that's terrible it's much easier to get a delta like done than it is do you get like an achievement for so many deltas getting done yeah you get you get the you get the satisfaction of a continuing certification my friend like that's that's the achievement i don't know and you know what oh man yeah i mean maybe maybe that's a great one i'll bring it up you know you're talking to the right person like i'll break it up like if we do this um yeah but deltas are due you can do it don't try to cheat like this person you can do it on your own right don't write the person in your clip i thought you're talking about me yeah sorry no the people no i'm look see oh no i just double clicked obey myself full screen and that's not that's exactly the opposite of what see look now i'm just going to take it over right that it's like no it's me it's all the stuff in mind but i don't i don't know i haven't been interested in doing that recently but i do have i've got what so yeah you you already stole my thunder dude like here i've got a whole graphic for this like oh i'm i didn't i didn't know you're gonna go into it i mean i should have known i mean no come on like half the time half the time half the time the show is barely keeping it together right i mean there's a whole bunch of other non-service now proper free stuff out too though yeah well okay again what an excellent segue into something that i've been building which i think i wanted to just let everybody else know right and you had actually viewed this with me yesterday did i yeah you took a look at it um i i'm gonna try to put together a doc okay a dock of interview questions common interview questions that people may encounter right as they're preparing for jobs and servicenow right and i've i've broken it out in a couple different like here here it is for devs here it is for admins and here it is for both right you know what what would be each um i will be releasing that as kind of like a pdf as a version one i think definitely you know i haven't gotten any outside consult on this yet so there may be questions that you know burning questions that are very good servicenow questions that people uh would like to add to that document but i'm going to release it out to the community absolutely for free so anybody that's interested in using that document to either conduct their interviews or prepare themselves for interviews are more than welcome to uh and i'll throw a link on my website and down below in the show notes there um but that's not what we're here to talk about is it jayce um [Music] i don't know what are we here to talk about there uh mark wow please introduce the show let's introduce the show maybe the two of us can stop talking for so long um comments not not not youtube comments i'm talking like i'm talking about the youtube comments quite fun did you read the youtube by tim yeah tim tim's tim's lighting it up i mean thank you tim for your your one comment servicenow is no longer an igsn platform it is now a penguin penguins are in fact amazing if you didn't know it's breaking news you heard it here folks like i probably know you'll probably hear about jason's news thing first i think i think this show does better in syndication than it does live honestly people will see um anyway uh no comments comments so uh first of all if you are in chat please do leave a comment because it's oddly silent today but uh commenting code did you oh no jace just fell off um commenting code is incredibly important um especially as you start writing more and more complicated code or particularly if you are giving code to someone else to maintain um you you need to document it and i argue uh very much so that the documented code is comments like i i can't have one without the other right i can i can write the in exposition in word all day long but really it's the code that is going to tell me you know how things are going the thing is sometimes i don't know like you don't really really know uh and you have to dig in there for for for getting the logic just right that's where i find comments to be incredibly insightful right um i write myself comments all the time um i write other people comments all the time i refer to other people in my comments all the time um but yeah i'm i'm excited jase we're just gonna like let's let's dive into this first of all do you have and i know this sounds totally just off the wall do you have a favorite comment that you've ever left in code um i have comments i regret oh well we don't have to go into that here but i mean no i don't have a favorite comment okay but generally my comments that i enjoy the most are the ones that tell me why i shouldn't edit this code or why i should like where the problem is with the code before i get there like leaving a slash slash to do you never finish this past you apologizes like right right like that's the worst best comment i i i very frequently uh write i call them time travel comments because i'm talking to my future self right where i'm like and i and when i say when i say i'm talking to my future self i literally mean hi future mark dash like this is what this thing is actually doing and why you did it because i'm gonna forget right and that to me that that comment is a reminder in my own words that maybe like here's here's how you can get yourself out of trouble um but you you touched on something just slightly about like commenting code that kind of has the like like that like don't touch this like here be dragon's kind of code right and and my favorite is i think it came out of microsoft where it said um only god and i knew who or what what this code did when i wrote it and now only god knows if if you've spent more than like one hour here like up uptick the incrementer and it was up to like 36 hours or something like that where it was like yeah sometimes like in this stroke of sheer brilliance you have this idea and you put it together and you get it working and then you come back a week later you're like what was i doing you have no idea what that was yeah yeah you're absolutely right like i don't think i've ever left myself a cryptic message like that but i know i definitely apologize to my future self occasionally but not by name i tomorrow like i just apologize to who might ever come across the comments okay okay yeah if i leave my name in there people reach out to me and i don't mind that yeah but i find nine times out of ten it's me reading it again you know what i mean like i i might write it to someone else but it's me like it's me again and and a funny funny funny thing happened after i uh started at servicenow about a year and a half after i started at servicenow someone someone i will not name names of who or what or what the situation was but they reached out to me and said thank you so much for commenting this and it was a paragraph it was a full-on paragraph of like why i did what i did but it was in snarky like like this is the stupidest thing i've ever seen and now i have to go and deal with this and instead of doing this like thing that i tried to optimize it's like i just i just did it this way and i wrote this like kind of half snarky comment because i was really it was really late at night yeah that was like one of my favorites the other one was i use do you use emojis in your comments i i want to but i'm afraid the servicenow backend won't like them because it's not ecmas6 it's ecma5 and not all utf character support it works back there i don't think you know you'd be surprised as someone i would be personally as someone who has personally encoded a table flip emoji into a script include i can tell you sir that they are supported can i just really back up a second emojis right have you aren't they crazy how they like make them connected like you have like the hand like emoji like the thumb emoji connected to like the dark skin tone emoji makes a star dark skin tone thumbs up like that's amazing wow that's crazy i didn't know that like that's how the people work so if you have like a man and a man it's two men emojis together if you have a family it's a man a woman a daughter a son or whatever if you look at the encoding it is it is amazing like weird but amazing yeah i've there's a couple of places where i found it makes regex really hard well absolutely right because it's like you put the two-man unicode characters together and it replaces it and makes it like one unicode oh man i just did that post right like you know ever the times i've had to learn regex the times i've had to use regex it's the same picture and it's like the times regex was the answer zero never regex is never the answer sorry no it's sometimes it is but usually it's not um yeah i so back to the comments right and i i usually have to comment my regex very well because i don't ever go back and you know there's there's a couple of tools that i like to use that we you know it's on that post maybe we'll do a whole episode on that but um back to comments right so you know how frequently would you say you find yourself so like if i'm in if i'm on a script of let's say 100 lines you know what percent of those lines are comments i mean i i just try to add comments where it's unclear what's happening like it is it i don't need to comment like every single if or switch but if the switch or if isn't clear like i i now i'm taking the approach of declaring variables that make things really clear so like instead of uh if first name is jace and if last name is benson then i don't know send him a snarky email right instead i would make a variable is jase benson okay okay and then i just do if is jace benson send snarky email which reads way easier as opposed to having like all the conditions in the if block see and i'm i'm with you there to a point i think you you mean uh uh andrew aubry door we're talking about the there's a there was a debate about um you know using using variable names as documentation basically not and i'm i'm going extreme right but i'm saying like there's there's a case to be made that your variable names could potentially document your code for you is jason doesn't i mean it tells me what it is it tells me it's a boolean right like it like i should be able to check true or false i i argue that why am i checking is jase benson right is where i would probably put a code in like sorry a comment i put comments in the code at that point it's like what in what case do i need to be checking for this and why right to me like in six months i may not remember that there was a business requirement that required this to happen and i'm like looking at this weird string and it's like why did i do this again and that's where i think my comments come in i mean i think a lot of the complexity when debugging that stuff when we're in like the in the code of it is like understanding the code like i read online and you know who knows statistics are ridiculous online nobody knows what they mean but i've read a line like coders and i i think it's true i spend more time reading code than i spend writing code yeah so you want that reading experience to be exquisite the best it can be and so if you have to like constantly remember like oh yeah so var first name is jace do this like and then you have like if you have like 15 of these if it ifs right like i i don't know it just makes it more concise and easier to read less mental load i and like sorry i once i once met a person sorry i don't even want to put a sex to this person because they make my blood seed like i met a person that said they didn't like comments because it made the code rest less readable like how to make anything readable yeah i'm like i'm like i could i could write a string of random characters right it's like how readable is that like at some point you got to put something in the code but his the the that person's like they were beating that drum man like like comments comments are just it's it it does you know it's bad formatting in the code i'm like who are you like what what planet did you grow up on like i don't understand um i don't know i i've just always thought that it was it was like necessary right like i didn't ever have a choice because there were times like i don't know i like maybe this is the maybe this is the hack that most people don't realize like i don't know most of the time like the thing that got me back up to speed on like oh yeah i remember what you were doing six months ago when you're trying to fix that bug and then you broke everything for six months then you had to come back to it and it's like this is this is this is how you're gonna do that right if i to your point have to read through my code every single time i don't know i just feel like i you know i needed it to be faster right like i i i i made up for my ineptitude with my note-taking like that's that's how i felt i i think i think you can't be extreme on either side of this argument you can't be everything requires no comments and the code should become itself that that obviously doesn't work right there's subtle right i mean it does work if you follow like something like uh what is that um like the code commenting convention where you declare like this function has this like the js what is it js docs right and then you could have like a like a document reader actually read it and build documentation that's awesome right yeah and typescript gets way closer to that then we then we'll get there with jstocs yeah but you know we're not using technically that's actually i found something very interesting about js docs out so let's let's let's switch over to js docs just because it makes sense i love that stocks i'm i am i mean a huge i like javascript because it's so loosey-goosey right like js docs to me is so much fun because like there's no real wrong way to do it like you can implement three or four different parameters and just say hey everyone has to do you know function name parameters and return statement right like that's like the bare minimum of things that you can put in there um and it's so much fun to look at but i was actually doing so i did a little bit of research so i should have added that to the stream here we go um i did a little bit of research on js docs okay and jsbox actually is pretty cool and if you i agree i want to pull something out here an early example of javadoc-like syntax document that's what we're talking about so we're talking about so javadoc is actually like how java pulls all of the stuff out and makes their documentation and and they base js stocks off of javadocs right it was released in 1999 with netscape mozilla project rhino does anyone know why rhino is so interesting oh chuck wants to jump on i just sent him a link yeah i mean if you don't know servicenow's javascript engine on the server side uses rhino js or a fourth theory of rhino js last i knew it was running either 1.5 or 1.7 um obviously there's been updates to it with the announcement from knowledge22 in australia they said that they're going to start supporting more es6 features s6 or es well yeah i'm excited for that stuff isn't that funny isn't that going to be cool i mean that's going to be game changing like i mean it will be for the people that write code right yeah yeah i mean i i guess it comes down on like where you land on like who's doing the coding right the low code stuff nobody's it's all abstracted away you know right which is great which is absolutely great i mean in my opinion i think it's great like with the low cost stuff abstracted away and even andrew was talking about like flow designer um uh like low code no code where do you put comments in um yeah i mean i can tell you where some of the stuff goes in i haven't done a lot with the with flow designer like i've done you know probably as much as anybody else on flow designer but like for request items you can add like a log statement in there to like say here's a log yeah that doesn't actually log a thing to try to act like a comment so let's but um but i wanna i wanna make sure we make the connection and i'm gonna check onto the stream here hey chuck how you doing hey i'm am i the third caller is this the phrase that pays you are the third caller congratulations you win the 50 off domino's coupon for the week any pizza you want 50 off doesn't he have to bring a box in to get that though i thought you had to bring a box and get the coupon this is the stoop why is it stuck in my brain i have no idea if domino's has a week-long thing where you can get pizza for half off that's right i thought you had to bring a box into the office like you had to give them like a cardboard box like kind of like the chipotle free i don't know no anyway so thanks for letting me derail your conversation right yeah am i the third call like like it didn't take that much chuck like it really didn't it's it's not it's not hard to do so jason i already talked today yeah there you go it's true we did yeah we recorded an episode of breakpoint what that's awesome that's so cool you could say that that might be newsworthy it'll come out on the 29th of june so somebody's watching this later yeah wow that's really cool um so anyway so what i wanted to bring up with sn docs right so uh sn docs is servicenow's answer right to jstocks which is javascript's answer to javadocs right so we've we've come all the way around full circle almost with this um but what it does i've never used sn doc me neither i if it's the answer what was the question what no what no way this is the answer to that i've when when i comment i i do like a js doc's light i don't make sure that my functions have like you say a description input input parameters return values sometimes if i'm really lucky i say these are the objects that it also uses like this dot some function name so that i can remember dependencies but i am by no means you know adhering to the the wikipedia page that you had or i would have 90 comments and 10 no it's and and i'm not into that either right like there you get it gets crazy you can go to you know the js docs like website it gives you the full specification it's nuts there's a lot of stuff that goes into it and i would never expect anyone to put every single one of them in that being said though if you if your organization does have some sort of coding standards please follow them if they don't make something up and something is better than nothing here's a free one you're more than welcome to have it right like like right this is google's standard and they're just like here have or i don't think it's google standard but it is a standard and everyone just kind of adheres to that and what's funny is when you talk to someone like chuck who's like well i do like you know js doc's light with sn docs right i can go and yank all that stuff out and basically make this documentation up at the top right and and chuck didn't even know that like he he's like oh i agree with this right here it's like yeah this actually generates documentation yeah have you used this mark where does it go and i mean like do you just get a big html field after you run something on your script include or what okay so i've never i've never seen this before and yet here it is on our own developer portal who wrote this portal so oh must be a joker it's gotta be a josh or a dave this is old hat um i you know honestly i don't know i think there's a kb or i think it spits out a kb article if i well that would be interesting can you scroll down a little bit here i just want to i just want to see what it says curse you for ruining my weekend yeah right it's a share yeah it's a share it's a share uh app oh okay so it's not an api that we'd find on no no no no okay is it is it a service now supported share item though or is that a customer it's not sheriff she's probably not supported no oh my like like like everything on this show it is about a very much so a separation of uh responsibilities here so no it's not but i have i have um i've never actually outputted to the ui what i've been able to do is when we've done the the the the js docs stuff uh it it just becomes so much more formattable in in within the code that we didn't even need like we would just take this out and put it into wikis right yeah we find wikis that would format it the way we wanted it and have it you know available for everybody so yeah because our problem was once it was outputted we didn't know which instance to put it into right like do you take js do you take sn docs with you to production i probably wouldn't right and so that was that was where we kind of stopped but yeah it's it i mean it potentially could output like this i i think that's pretty cool um yeah so sn doc on the share portal is was written or contributed by callum ridley yeah interesting the the the hero the hero we deserve i guess i don't know how old is this though nowadays though it's like this here it could be could be helpful if you want to like enforce like that code consistency um mark r uh rothfur how do you say his last name ruth the one who's always about the instant scan stuff mark ruth yeah i think he's all about like using instant skin like to help everybody make everything better like if you want to ensure you have good comments add an instant scan to check your custom stuff to make sure it has comments in it where you expect them to be and that means i can't imagine writing a script that reads your code to determine not it's commented you can say hey do comments exist but how could you tell it to verify that like that parameter was documented because if you did it in js docs syntax or s and doc syntax that's what we can check off of yeah yeah and fine finding all the different ways people can comment well there's slash slash but there's also a series of slash lashes star slash on the same line or there's like yikes yeah i've i've written one of those before yeah we were talking about this earlier jace it's one of those things that one i didn't do for fun i did it because i had to but now that i've done it like i'm never doing that again never do that again yeah i mean i can't imagine i mean you talk about regex being a nightmare right like that's exactly what you're getting into at that point right that's exactly what it was yeah yeah i mean and and that was kind of i mean honestly it's i'm because i know those matching patterns go into some of those health scan things where i'm like some some regex wizard somewhere knows how to do this it is not i uh but yeah so what we did with our scans because that's what that's that's how that's how now learning goes to production right we have to go through the security scans we then go through our health scans with our own you know everything that we go through because it's just part of our test automation the documentation the the comments is part of that because it is in sn docs slash js docs format we can write those equators in it yeah and then okay that makes sense i suppose if you wanted to enforce like those compliment but somebody could just write an sn docs thing that doesn't actually map to the actual code i mean sure but you would imagine someone that's going to be that that's going to get caught in code review hopefully code review hopefully should get caught in code review um but you know you would imagine that's where that's going to first of all is going to flag well i don't know you're right i i'm just saying like you can't rely on the code to do all the work for you that's like absolutely that's where a human gets involved with code review but yeah this is getting out of hand like this is taking out my alternate personality dude john chase wears sunglasses at night i love it like that's gonna be that should be the new like theme like it should just be like you and like some like 80s like like with the like the sunset in the background and like the palm trees going and it's just you just like yeah like i need a cowboy hat to go with it so when i'm talking about doing bad stuff you know it's like i mean like oh man the cowboy hat the sunglasses you could totally it doesn't have to be 80s anything now you could just go we we can start as easy top cover band we got two beards and then yeah i'll just there you go misty hill with the short wood or whatever it was like one of them wow oh man oh boy this guy this went down again yeah no it's okay i like getting derailed this is fun um yeah i i mean the i mean go ahead chuck what how do you comment your low code solutions you read a lot more than i do uh depending on how low you're talking uh you know i i often start my things as low code but then i add more code when i found out that i need more code you know like let's let's take you know conflict checking in in the loner app for example sure i i rewrote that for a live demo at uh knowledge and i'll tell you there's a lot of stuff in that original app that i wrote in 2010 that could be turned into low code and i can do it in probably a tenth of the time that i could but you get up to a certain point like conflict checking right first when you're making the reservation to say hey our what resources are available in that magical reference qualifier that says what's checked out what's not checked out what's available etc etc and then when you submit to say look i i saw that it was available is it still available or did somebody beat me to the punch on that thing so there's there's no way around that you have to do some glide query checking uh all the rest of it like the notifications and the schedule jobs and stuff that's all that's all codeless now yeah but uh there's there's certain things that you gotta script and and i do put in the comments in the coded spot i i would say to make a short a long answer out of your short question if it's if it's more than about five to ten lines of code i better have some comments and they're explaining to some poor sucker later on what i did but maybe somehow oh you like put annotations on it so like i know way back when when legacy workflow was the thing i would add branches that didn't actually branch anywhere just to indicate hey this section does this thing what a mess that's right i think one of those crazy homes that are on like there's a staircase going to know where i get it legacy workflow is not the desired thing anymore but i'm just saying like that was a way that was a way that you know i indicated to my future self like if i get in here and there's a problem with uh i don't know access to no val netware email client sorry it was from a long time ago just my memories that's where it's from like i can see jace writing a a flow with a spoke now to know about nowhere with nobel number like oh yeah there's a popular one holy crap there's another one like maybe it's access to i don't know i you know to like a jabber client or something who knows right not just naming randomly i would say at a minimum please please please use the description fields for your flow so you can indicate the purpose of them and if you're getting into you know technically flows aren't supposed to be that complex anyway but if you're starting to get a more complex one yeah those annotations at the beginning or they go alongside or just below your your actions and in logic that makes a lot of sense use them if you think if you you think to yourself you know am i going to be able to decipher this in six months or a year when i got to come back and maintain this and if i ever want to get out of this job and get promoted into something else is somebody going to be able to follow along without calling me up and saying what are you doing here can you explain this or you know so yeah i was in a lab anything i was in a lab at k22 with carlene carter she was doing a thing on making one flow to rule them all and in that in that thing she had a thing where you clicked you moved your mouse just barely above the line in the flow designer to add a stage yes right can you do that in non-item workflows not item designers oh wait can you put stages on non i think i not necessarily for the stage itself but for that kind of stuff i'm pretty sure you can you can at the bare minimum you can put an annotation on almost anything in flow designer i think so yeah yeah i mean obviously the stage serves a different purpose than a comment obviously yeah but put an annotation on a log statement i logged this because i didn't know what was happening yeah and the annotation somebody says send log message yeah no i mean what i i love i saw i saw a piece of code that someone had shared it was uh it was someone had it was like it was like like javascript like logger so it was like the variable was named logger so the whole statement was like var logger equals new logger and then it was logger.getlogger like it was like what like oh yeah the comment was the code is that what you're saying yeah the code actually said like they're not the comment wasn't the code i'm i'm far away from comments now okay we've gone way far away off the reservation no i'm just kidding uh no it was they were sharing like like comments like that they thought was funny and that was like this thing right like it was like this logger log get logging like it just didn't make any sense like you couldn't say a logger right there yeah that's awesome um what was that ding was that you chuck um yeah but my sound board isn't like the active application so it takes like two minutes for it to register the key press on the ipad to play the sound on the computer so i just gave up you might hear another one later i don't know it's a mystery where that thing's coming back when we were talking about carlene carter i pushed the button we've got we got to make another uh dingable sound thing in between then and now let's address i gotta wake up the other machine that's what it is i gotta step off camera and wake it up let's address uh arsha's question here yes what do you guys typically put in your documentation when there isn't a description field on the given script on the update set itself or on the story um i challenge you to find me a script that doesn't have a comments or description field yeah they pretty much all have to do there's even there's even a description filled on business rules but it's not on the default form so that's one of the first things i always call out please bring that out ui actions maybe they have one yeah because it's a description of the ui action so yeah you could write it in there like it's not i guess you would say it's not necessarily like like directly into the code right because it might be more of a description of the ui action but yeah i'm with you chuck like the closest i can yeah where do you where do you put it you you should use the description field or comments i think it and that's what is on client scripts if i remember right i think there's like two styles put the put the comments in the code itself you know you've got a block of logic and if it's more than a five or six lines explain what that logic is doing even if it's a one liner that just says you know get user from client side or something from server you know just because somebody who comes along isn't gonna know what a glide ajax is in the first place and go what is this so you can explain in high level what you're doing and then they would know where to go to look to to decipher the rest his his it was oh we pulled clicked no description on portal pages css um but there's no code in pages yeah i'd argue you probably should go to widgets code well on pages you can have css overrides right okay right can you have the options too yeah i'm not known as css here's what i would say i would say as close to the code as possible and my my my thinking on that is i've been through a migration from you know what was it tfs to servicenow right where we were just like okay and here's where the stories aren't going to be anymore like in the morning you're just going to go into servicenow right and that's what we did and i argue that if you put it in the story if you put it in oh man please don't take this the wrong way with anybody that's listening that's a project manager i wouldn't put it in any i wouldn't put any of my technical documentation inside my project management software right like no get moved it can get like altered like you probably want to have your own tool other than the stories just anywhere other than the stories in my opinion i mean i think this touches on two things right one is well first i want to address the the comment thing on the update sets that philip brought up because i think it's all kind of related just to get all the stuff nearest to the code so arguably right if there isn't a comment on the record you can always comment the update set thing right which i know that they used to do at novant health um somebody used to say that they did this stuff with their peer reviews but if you can't comment the stuff there right maybe comment it near there like you're saying like the next nearest thing the next is there if i can put it yep right if you can't comment it there like i'm trying to think of like what types of documentation you might be putting into the portal page like maybe this page is for accessing the user profile and they should be able to set their password and supposed to use this stuff here and maybe that stuff doesn't belong in the comments maybe this stuff belongs in like some documentation of like yes how this thing works yes and i don't know like where to draw that line between documentation and commenting right i sometimes it's blurry i see it pretty earth i've got a pretty good like i think i've got a pretty good measuring stick of that because if it's if it's functional documentation like if i'm saying how this thing works that that goes somewhere else right like if i'm telling you technically like what you know like this widget loads this thing that you know there's a check box that does something special i don't that's what i'm going to write in there i'm not going to write like we made this widget and there being the comments or the documentation in the documentation it's functional it goes in some documentation whether that's you know a word doc or a knowledge base article or something that's somebody to learn how your system behaves if you're looking at the implementation that's what goes in the comments yep thank you chuck i started saying this and that and instead of what i was actually thinking words mark words no i mean i relax the this is complicated you should read up on it what the word there's a t-shirt right there this is complicated you should read up on it yeah chase is good for the quotes i love that one that's a good one yeah look for that i was trying to make a play on the javascript this oh you could put that in code oh yeah this knot is complicated equals you parenthesis read up on it it's kind of it's kind of like the whole check with pradeep thing right like where it's like if this is complicated it's like just ask jason like what no no don't put that in your code trust me i might not know the answer i mean so i i have a thing where i forget these answers on purpose i just remember how i would solve it and i try to solve it that way every time yeah because i mean and you know i think i think you hold a very interesting distinct both of you i think hold very interesting distinctions if i i've probably linked to both both either a video or a blog post of yours jace or something some i've probably both of you individually have had comments linked to your content because i'm like oh yeah this is right i figured this out right and yeah go watch this video or read this blog article or something this thing yeah yeah yeah like so first of all thank you for whatever those are i couldn't think of anything off top of my head but i'm sure there's something but uh yeah i think it's interesting like when it comes full circle right where where sometimes i find things that jace has written where i'm like what the hell like he was telling me about this like six months ago right and then like i do a search and it's like there's there's there's the thing that jace wrote and it's like i'm putting that in the comments because i'm not looking for it a second time like it's it's yeah i i say put anything in your comments that could help you even if it seems stupid yeah yeah that brings up another one that i started about a year ago is uh put a comment in there about the story that you're implementing because you're going to get into this maintenance mode later on and go why did i put that there that doesn't look like it even belongs there well if you got a little moniker to yourself that says slash slash s-t-r-y blah blah blah you know what to go reference that unwinds your memory and goes oh yeah that was a fix for this right and you know you may have thought of a different way to do it now maybe better maybe not but at least you've got that that fingerprint there that says look i was jacking with this code one day to fix this problem otherwise i've come back to code later on that doesn't have that i go what this this doesn't look right doesn't make sense but you know in some drug-induced haze i must have fixed it so not saying i do drugging no don't do drugs kids don't do it sober chuck thanks you later right well and and it's funny that you said that because that's exactly what i was going to kind of pounce on it's like i've had a couple of beers and and figured something out right kind of like like it just shakes something loose i don't know what it is i'm not creativity juice yeah yeah it's that social lubricant slash creativity juice right um like it shook something loose and then i went like i went and wrote like you know it's like a beautiful mind like it's coming out of me and like just i'm writing it all over the place and then like the next morning i wake up and i take an aspirin because i'm now over the age of 25 and like what happened like where did this like where did this come from and i have no idea and and it's the comments and i'm telling you if it's not a habit when you're this is going to be this is the worst advice i've ever seen it's not a habit when you're sober you're never going to think of it when you're when you're in the bag right it's so bad but it's true like i mean the reason i'm so diabolical about my comments is so that when i have a couple of beers i make sure i know what's going on oh it's terrible yep i mean it's all about just being nice to your future self yeah and in the future others yeah yeah i mean but if you're nice to your future self you're just inherently going to be nice to the others i don't know i'm my own worst enemy well i mean if you're writing nicely to yourself hey you need to fix this later right no no i'm abusive to my former self or to my future self where i'm like hey you idiot don't touch this ever again like that's that's tuesday mark's problem right right right i mean i've written that whole that i've written that like good luck dude like i don't know like i i think i have some of those comments in my old code you know what's funny is when you're writing code in 1995 2020 seems like an awful long way away and i i actually have a long time friend and co-worker that has the dubious job of maintaining this 25 year old code and something stopped working and he came across one of those kind of good luck dude messages and we talked every month and i laughed so hard i haven't been in that company in 12 years holding the back i can still i can still remember holding the bag i i still remember i told my juniors about this this project it was a bad project we were way behind it was all the stuff but i remember just hammering like literally we i was having to do some like reflection and crazy like cs stuff to get all these objects and it was in my c-sharp days and i remember just saying this code is so inefficient it makes me cry but the deadline is tomorrow this is me crying but this is me crying even worse if i don't make sense there's no emojis in there i had the crying emojis in there like i was like this is me crying but there's nothing i can do about it right yeah and there's nothing wrong with putting like uh another thing that i like to do is you know in javascript it would say to do colon leave yourself little notes of hey if i get time to come back here i want to fix this or i want to add this functionality it's not really a backlog you know stories but it's a it's a it's a little nice reminder that you know we should do this one day right to do make this more efficient or to do when we get to es6 let's collapse this stuff something like that is is very nice yeah well especially now when you're going to have to go and finding all that code where it's like oh now we got to go refactor all that right the my for me um the the to do the slash slash to do like i have it i usually have it as a keyboard shortcut right like i know i have in every editor i have memorized like i have you might be using it too much if you're using no no no because i use it i use it as my pause write code here later yeah to do like it's just like i don't know if you guys know this but when you become an architect all you do is just stub out to do's and then hand it to developers like that's it that's all we do like come on um wow that doesn't leave that much for creativity does it i know right it's like to do right this line to do right the next line like uncomment this line this stuff just writes itself fellas like i don't know why you guys are having a problem with it um i swear like someone on my team is going to be like what are you like what are you talking about what do you say you do for the company what would you say you do here bob um uh i totally just recovered i was going with this but like get it again ring the bell yeah dude ring the bell um the the the junior so i just told them the story about you know the crying and all the stuff but um you know moving moving forward right moving forward to like what's the what's the next thing i got to do like i'll put a to-do in if if someone comes and bothers me right like like someone comes and bothers me i hit like my special little magic keyboard command and i know exactly what line i was because there's a to-do sitting there right that's a good idea right like it was it's a weird hack i know it is but like i don't know you've ever you remember what was it uh who did who did this can i go back to some second i don't understand why do you add a marker when somebody bothers you so you can read because getting back into that train of thought you want to leave a little mnemonic to say i was doing this or i was thinking this or here's what was next yeah here's the next one if you go oh i'm in the middle obviously i don't do this and you and you have to go to a meeting or something you're like oh that 30 minutes went really fast i'm but i've got another hour this afternoon i just want to leave a placeholder because i've come back and gone what was i doing here i sound like you should use a second short shortcut for that there i feel like yeah no it was it is well no he's gonna start talking to his phone now stop remember to comment yeah right well but not yeah remember comment like like uh uh uh uh the snl 967 get user from database the it guy was like move right like people would come to my desk right remember people would come to my desk and they'd be and i'd be like hold on like i'd be like wait a minute it's like i had to stop and put my to-do in there like yeah what's up like i felt like a jerk i felt like such a jerk because i always told people like hold on like if it works if it works you're not a jerk it works if it works you're not a jerk there that's a good one there's another tear you get one of those there we go um yeah one up uh yeah but it it's it look if if it if it works for you and if it if it's not stupid right that if it works for you it's not stupid and that's that's kind of my thing like i found those little hacks with comments putting the to-do's in where i could always come back to it and especially especially especially for the people that i think are transitioning from traditional servicenow development right into like let's say taking the a deep dive into like getting vs code set up right we've got multiple files open it it can get a little intimidating putting those to-do's in and saying here's where i was right they're good markers right so that oh yeah that's a great idea when you're when you're working between files whether it's in studio or vs code and you're jumping around going well i need to build this i mean i often build things in reverse order i do like you start at the high level and say well this needs to call these other three functions well those aren't even written yet but they can act as a placeholder exactly so that that's another way to do it is is because my yeah the thought process always goes from highest to lowest level and you finally you know it's like oh i need a widget widget needs uh you know server script server script needs to call the html html is going to call client script and client script has to go back and do a rest call with rest call needs a scripted rest api script address api needs to call into the script include script include holy smokes how do you unwind that where do i start so you gotta maybe mentally draw out this little stack of who's doing what and there was there was one place i forget it was in the gamification or or what it was might have been in some cleanup stuff on the karaoke app that it got really really nasty like this scheduled job is calling this flow and the flow was calling this other stuff and i if i didn't document that i knew i was like toast in a week so and i and i had to go back and reference that again like what were the seven steps to get this thing working and there it was like oh thank you former soberself yeah yeah i i i like uh with the with even with the um the the studio right with going back and forth i i wonder because this happens to me every once in a while i don't know if this happens to you guys this is a little off topic do you guys ever like go through the list of things you need to build out to get like not feature complete but just to get started where you're like just to get let's say i i don't know maybe this week i learned way too much about something called the faceted search widget and it was just like there was just so much stuff to like get to the point where i actually could just pipe some results into the faceted search widget right and like do you do you ever find yourself getting frustrated we're like man like there's so much stupid work i got to do before i can do the fun stuff like i don't know is that is that a unique feeling rarely really it's usually on a newer technology but you know if if you've been doing say service portal or ui builder for a while you kind of go yeah it's part and parcel and you know what that stack looks like so it's not as daunting anymore but yeah there's times where i've had to draw pictures and go oh this calls that and that calls that and sure my my my peak frustration which is probably why i jumped serviced out was i do remember when i was wiring c sharp into like um uh sql and sword procedures and writing every every getter and accessor and every ever like plumbing it all the way through from the database all the way through to the front end and it was just like this sucks man i don't want to keep doing this like i just keep copying and then that was a really well placed two minute ago sound effect sad trombone do you have do you have like a like a like i i have some sound effects but uh here you to know what my sound effects are oh it didn't work it's andrew going all right i have the standard four or five oh boy i gotta get mine up and running you know the one thing one thing this stream has been lacking has not been preparation or you know any forethought or anything no it's it's sound effects it's production gimmicks that's right we just gotta make it look fun turn this into a wacky morning show one way or another i know people are jumping on the faceted search train i i am in no no no near like my fauceted it's been out for a long time it has app oh my one of my associate software oh no what happened you're back now your internet connection may be unstable i i still want a t-shirt that says that i'm surprised i haven't seen one from zoom days yet oh he froze again he did freeze again let's all freeze when he comes back and that's how you lose viewers i can't do it that's how you lose dead air so jace how about those comments yeah i mean like i like comments from the peanut gallery like that's not what we're talking about though way too much um ironically his his logo in the background if you can't see it is slash slash phxdev no right right i wrote it up in the beginning darn it there we are we're not close we're not i mean it's your show you you're wrong everything just breaks and like it just turns off and i'm like bye like i had the most guests on the show ever like three weeks ago right and then everything just turned off and i was like oh cool why it's like the old days with a pay phone you have to keep paying 25 cents oh i didn't put i did not put the diamond and it just turned off like yeah leaky whatever um comments from the peanut gallery there it is um yeah a fasted search that's how we're doing um we're gonna do the new search results so one of my associate software engineers is doing all the um ai search stuff for uh now learning which is really neat um and you know those widgets are pretty cool and some of them are even seismic which is neat because we're getting into that territory so yeah but anyway um yeah i i i l let's round it out with the comments i think comments are like way more important than i think a lot of people realize right it's it's very stylistic it's very much up to your personality and and kind of how you're doing things in your job uh but i think to me the the the takeaway from this one is i think the more you you can you can't have too many comments i i wouldn't challenge the right person with that i i think you can i think that was yeah just to close it out fella like that was something we got to keep going yeah i'm gonna close with if you're doing a personal project put in comments you'll thank yourself later if you're doing a multi-person project you're not a developer if you're not putting in comments for you and for the others you you have to it's just it it's it's irresponsible if you don't if yeah if yeah if you have a if you have a code reviews process like they you should be calling out your co-workers if it's not clear what it's doing it can't without comments like it just can't i'm sorry guys like could that be valid comments not like slash blah blah comment right there but there has to be some i mean that'll pass the inside checker i know it'd be blah blah at comment no that's that yeah like like we don't already have processes that are going through and making sure that there isn't anything terrible in any of the stuff that we're already putting out yeah like yeah like tagging people or whatever like it's great like i i think i do it right go with what works for you and your organization right in your particular style do not put your name on any of these comments it will hurt you for the rest of your life oh you totally agree oh yeah no yeah i i mean your name will be there in the history forever forever yeah yeah it'll be like in a source code history or or something like that but if it's in the comments man you're going to get calls at 15 years about stuff you really don't even have a clue about today i mean to be fair though every time i've gotten comments or gotten reached out to you about code i left my name in like that it's always been a great interaction phil so there's another t-shirt yeah there you go i kind of like that one that one's good i think i think we have a sticker idea for our next set of stickers i'm thinking about it all right i mean it goes with the logo for phx dev slash to do watch phxdev oh there you go dammit jace like why why do you like why do you we encourage each other way too much it's not good my wife's gonna stop enabling him yeah don't like i'm i'm already trying not to like make myself a custom hat like because i've been getting like enjoying the hats recently but yeah um anyway jace chuck thank you so much for jumping on um i didn't even open the q a today because we just kept going like i didn't want to didn't want to derail us too much but um yeah fred luddy woes here i love that um anyway uh yeah so uh jace chuck i'll throw to you and and let you kind of pitch what you're selling json i'll throw you throw you up there first let us know sure come check out me on monday at youtube.com jacenow and and we'll watch the news together well you'll watch me aggregate the news that i've aggregated from news.js.pro awesome chuck i'll throw it to you if you get you got anything going on right now uh you know just the usual feeding the machine i am boning up on knowledge for the tokyo release we'll have our tech now for that on august 4th which is early availability day on your pdis so hopefully i'll really be excited about that the rest of my stuff you can find family food fun all kinds of stuff at chuck tomasi.com i just added some pictures from knowledge22 as well oh wow very cool um yeah that sorry go ahead jason that actually did you just drop the release date of the tokyo for pdis yes august 4th okay he's gotta update his he's gotta update his document he's got a document of the release date because i i yeah i've checked him off on that this is crazy we've been we've been syncing up i have i have all the uh every every official ga date from aspen i think i have most of the ea dates since like geneva or something and and and with that with with the coming of tokyo reminder one more time deltas are due so get your deltas done get your you know get get your csa for free this summer you know uh there's a lot of great stuff going wait if you don't have your delta and the csas are for free you shouldn't have any reason not to have a csa by the end of the summer right right like anyone listening to this right now should be able to get a csa like this hold on got a question if you have a csa right now and you don't want to pay for the delta can you just do the certification again for free yeah we're trying to watch people 200 bucks all the training again this is my stream this is how dare you with your gotcha journalism come on no i'm just trying to save everybody a few more dollars that's all trying to get those new folks have a gofundme page for delta come on like you know it's it's it no i don't think you're gonna game the system that way but if somebody you know oh somebody will i guarantee you somebody will i'm i'm going to tell you guys right now it is much easier to go and take the delta than it is to go and take a web assessor exam because and i don't know if how many like because i got my cad like live i think i went to like a testing no i i got it at knowledge 17 or 18. i don't know where it was um like they make you like look you know your camera like if you're if you're in your room like they make you like show their bed like it's invasive just go take the deltas people like it's really not that big of a deal like just go do it come on please all the answers are in the release notes almost word for word by the way the web assessor exam not open book the delta exam open book like i don't know really nice jab jace nice jab you got him and i just never thought about it before but like it opens up other questions i want to ask but i probably shouldn't on stream that sounds like a good drop-off point let me just make this point known like you know there's someone there's a reason that i can afford all of this stuff and it just happens to be that i don't take uh questions like that on there so anyway moving totally off of that point thank you guys so much for being on thanks for having us thanks for your hard hitting questions chuck thank you for the backup because i'm so glad i wasn't the only employee on this one this is the one that's really putting the screws on like i don't know i don't know anyway next week look what you signed up for mark i know i know right yeah this is what i do in my free time um and yeah with my with friends like these guys i feel so sorry i'm chase i'm just hamming it up man like it's really not that big of a deal um next week a little bit of a surprise i don't want to ruin it uh the stream will be a little different i don't have a topic i don't want to tell anybody about right now um but yeah it's gonna be a lot of fun tune in next week same same bat time same day same bat channel um yeah uh so i i actually i came up i came up with a tagline at the end you guys want to hear my sale going all right do you want to go full screen no yeah i do actually now i got to do it for this night all right all right all right here we go all right tabs or spaces either way just remember kids trim your strings thanks everybody

View original source

https://www.youtube.com/watch?v=mXbPWcEIgls