- Podcasts
- CyberSecurity Summary
- Get Programming with JavaScript
About this episodeA hands-on introduction to coding for beginners using the JS Bin online sandbox. The text utilizes a continuous project called The Crypt…
You can listen and download our episodes for free on more than 10 different platforms:
https://linktr.ee/cyber_security_summary
Get the Book now from Amazon:
https://www.amazon.com/dp/1617293105?lv=shuf&channelId=500&plpRedirect=mhFallback&linkCode=ll2&tag=cvthunderx-20&linkId=c643c5d42f29477fc559956697123470&language=en_US&gaOptInStatus=true&ref_=as_li_ss_tl
Discover our free courses in tech and cybersecurity, Start learning today:
https://linktr.ee/cybercode_academy
Transcript
From the publisherThis transcript comes from the podcast’s own feed, shown as the publisher wrote it.
Get Programming with JavaScript
Yeah, meaning you cannot learn the architecture of software by like passively reading a book or listening to some abstract lecture. Understanding code requires you to actually manipulate the logic yourself, your hands dirty. Exactly. You have to force your own brain to translate a human intention into a strict machine instruction.
That is a perfect analogy, and it's precisely why Larsen centers the initial experience around this tool called js bin jaspin. Yeah, Remy Sharp, who's the creator of jspin, he actually wrote the ForWord for the book, and he designed this tool as a totally online sandbox. It is a completely isolated, no mistakes barred development.
Yeah, and honestly, that stripped feedback is the only way to build resilience in programming. I mean, a machine cannot bridge the gap of human ambiguity, right doesn't know what you meant to say exactly. You delete a character, the system breaks, you put it back, the system runs perfectly. It forces you to adopt this standard of absolute precision. And that's the foundational mindset you have to have before you can even start designing complex systems like a game.
It does, which brings up the huge challenge of organization because in a massive code base, you might have thousands of these memory spaces, right, So Larsen really emphasizes using highly descriptive, human readable naming conventions for variables, like using camel case formatting, where the.
I've been there. It's not fun so clear. Naming acts as embedded documentation precisely, but even with descriptive names, having thousands of loose variables floating around the game engine just sounds like a nightmare. Yeah. Like, if we're building the crypt we have player names, health stats, inventory items, locations.
So applying that to the crypt let's say the player's name is Chondra and her health is fifty. Later on, when Candor takes damage from a trap, you don't have to go hunting for some loose health variable. You just use dot notation like player dot health to drill directly into that specific container and update the value exactly.
Okay, so objects keep our data perfectly organized in these little first aid kits. But data just sitting in a kit is completely static. I mean, a game where a player's stats just sit in memory isn't much of a game? Definitely not. How do we actually make the program act on this organized data over and over again?
And to print the title, directors and actors to the console it takes about five lines of code per movie. Honestly, isn't it just faster for me as a beginner to write those five lines, highlight them, and copy paste them two more times? It is tempting, right, Why introduce an entirely new architectural layer when copy paste solves my problem in ten seconds?
Well, copy pasting solves the immediate problem, sure, but it creates a long term architectural nightmare. How so it introduces massive redundancy. Let's trace the life cycle of that copied code. You've got your fifteen lines print in the three movies. But tomorrow you decide the output is hard to read. You want to insert a blank dashed line between each movie to separate them visually.
But looking at it, there is a potential flaw in how we've set this up so far. If our show movie info function relies on a variable that was defined somewhere else in that global warehouse we talked about, isn't that dangerous? Very dangerous? Like if the function is hardwired to look for a specific variable, what happens if that variable gets renamed or deleted by accident?
So think of parameters as the empty placeholders the function creates for itself in the dressing room. Okay, When you architect the function, you define parameters inside the prophesies say play your name and play your health. The function is formally declaring I don't care about the outside world, but to do my job, I expect to be handed two pieces of information when I'm called.
Without ever polluting the global memories exactly. Okay, here's where it gets really interesting. Oh yeah, we know how to pass individual arguments to isolate our functions. But as a game like the crypt scales, passing individual data points just gets messy. I mean, if I want a function to process a player's turn, I have to pass their name, health location, current weapon, their inventory array status effects.
It really is. In any complex program, you end up with dozens of small utility functions, for instance, functions to format text right, adding blank lines, wrapping texts in dashed boxes, and denting paragraphs. Right. If you leave all those formatting functions loose in the global scope, they clutter your environment.
That is astonishing. It's like having an invisible phantom workforce. You ask a simple piece of text to do something incredibly complex, and the agent just spins up an entire architectural structure in the background does the heavy lifting. And obliterates the evidence before the next line of code even runs.
Which leaves me with a final, slightly provocative thought to ponder. Inspired by this entire journey, We've just spent this time dismantling the digital world, realizing that everything on our screens is ultimately just a massive, intricate collection of encapsulated objects passing properties into isolated functions.
Think about your daily routines, your ingrained habits, your emotional responses to stress. Are we in some way just executing highly optimized functions responding to external arguments like when someone cuts you off in traffic? Is that just an argument being passed into your stress response function, returning a very predictable output based on the state of your internal variables that day?
Decouple something to mull over. The next time you find yourself stuck in a repetitive loop, maybe it's time to check your dependencies and write a new function. Thank you so much for joining us on this deep dive. Keep exploring, keep questioning, and remember even the most complex digital castles in the world are built from the exact same microscopic, logical grains of sand.
