Chris Padilla/Blog

My passion project! Posts spanning music, art, software, books, and more
You can follow by Newsletter or RSS! (What's RSS?) Full archive here.

    TypeScript is Secretly Just C#

    TypeScript is MOSTLY just a way of bringing C# methodology to building applications in JavaScript.

    Call me Captain Obvious! They are both Microsoft products.

    But I've been learning C# and the similarities have been interesting!

    Here are the things that are really nice about working in C# so far:

    1. It's a compiled language. SO there are some errors that are caught at compile time, like undeclared variables.
    2. Intelisense is strong here. Typing values right out the gate makes that all the easier.
    3. Self documentation is pretty wicked in Visual Studio. Opening up the Assembly Browser gives you access to ALL the properties and methods for objects and classes that are used in your project.
    4. Enums! From the TypeScript docs: "Enums are one of the few features TypeScript has which is not a type-level extension of JavaScript."
    5. Interfaces and Generic Types also are a borrowed C# concept!

    The only exception might be that C# is a classic object oriented programming language where JavaScript and TypeScript mostly fake that part, being much more dynamic. Arguably, though, some of the tooling already gets you pretty close — component based frameworks, for example.

    The "TypeScript is just JavaScript" sentiment has strangely made TypeScript difficult to learn for me. Similar to Node vs ES6 — the fact that they're so similar makes it difficult to remember that your brain needs to work in a different paradigm. It helps when I'm learning about Types in a language that is strongly typed from the get-go.

    So I'll say this much: learning C# has been a really fun way to also learn TypeScript.

    Static Methods

    In class driven languages like, say, C# — a way of storing utility methods is through a Static Method.

    Say you're working in JavaScript. A great ol' example of this is the Object.keys() method.

    Objects is the constructor. keys the static method.

    (technically not a class since JavaScript only mimics classes. More details on that in You Don't Know JS by Kyle Simpson and contributors.)

    In JavaScript, you can access the method on the constructor through dot notation. But when creating an object, that object doesn't have a keys method.

    const pizzaData = new Object();
    
    Object.keys(pizzaData) // √
    
    pizzaData.keys // X

    The benefits?

    Largely memory and data size. Not every object needs to recreate the method for each instance. We really only need one source of truth for a utility method like this.

    Not all that different from abstracting a handler in React components. Does each input component need to have its own onChange method instantiated with the component? Or can the same method be passed down from a parent prop.

    So a pattern for working with static methods could be:

    • If you need a method that can access the data directly on an instance? Store the method with the instance.
    • If need something that converts data from an instance, or is largely utilitarian in function, a static method could be a good option.

    Transience

    I'm thinking lots on the transient nature of things.

    Especially in art, software, and entertainment, but y'know, everything is changing all the time.

    My recent pieces of evidence:

    • All things are acquirable, including blogs and podcasts
    • There are genres of games I grew up playing that have fallen from the limelight into niche-status. Platformers comes to mind.
    • Though, Point and Click Adventure Games have hit me really hard lately. LucasArts closed in 2021. Humongous Entertainment, maybe a juvenile example, but one from my childhood, had a short 15 year run before closing due to both hand drawing animation becoming to expensive and their target age range of young kids growing up quicker, wanting to move on to games marketed for older kids.
    • On the topic of 2D Animation: Austin Kleon wrote in response to the Oral History of Lilo & Stitch. Kleon writes about how you know it's good when you have to ask "how did this even get made??" and Lilo & Stitch was one of those for Disney. The Florida studio that developed it, though, was closed only a year after, and marked the major shift for Disney away from 2D animation.
    • Austin, Texas.
    • Man, even the climbing gym I go to was just acquired!

    Maybe it has to do with my age. Large slices in the pie chart of my life have been pretty consistent and sturdy. Same group of friends k-12. Same colleagues in college. Even in teaching music, working with the same folks. It helps that my medium — teaching classical music — was a backwards looking genre. There were discoveries to be made, but they weren't the "ground moving underneath you" kind of discoveries.

    Maybe it's the technological era. 300 MB on a CD ROM was a lot back in the day. Software was shipped on floppy disks 25 years ago. Now GitHub can help me write my unit tests.

    Lots of feelings to be felt here:

    It's cool! New stuff all the time!

    Or...

    It's a bummer! They don't make it like they used to!

    I'm somewhere in the middle. Mostly, I'm becoming more aware of how important creative work is as a response to shifting sands.

    In grad school, I read Making Your Life As An Artist by Andrew Simonet. Lots of great practical advice, though the opening of the book has a beautiful explanation of why all art making is important:

    With food, there have long ben seed savers and farmers who reject the standardization of our diet. They grow things that don't fit with industrial agriculture. They preserve the seends for plants we may need someday.

    This is what artists do culturally. We provide the wide spectrum nutrition that the soul needs and the Entertainment Industry ignores. We save cultural seeds, the DNA of ideas and ways of seeing that we may need tomorrow.

    Or in 20 years.

    Or 2,000 years.

    Sometimes it looks like blogging.

    Sometimes it's playing the sax.

    Sometimes it's games.

    Sometimes it's art.

    Sometimes it's music.

    The nice thing is it's not just high art that's worth preserving, so is the folk music.

    All the same, when making something that comes from a place of authentic curiosity and fascination, it's a way of casting a vote for the staying power of that idea.

    You bring your own intersections of the different moving cultural pieces, and we get a double wammy - preserving meaningful culture and creating something new in the process.

    Late Easter Sketches

    A little late, but here are some quick little easter sketches!

    Many fond memories of eating PACKS of peeps...

    Barre Chord Improv

    Listen on Youtube

    Been LOVING this new instrument!