Tag: Are Right A Lot

Welcome Robot Overlords

Welcome Robot Overlords

Maybe I don’t actually need to learn a new programming language?

Naturally, I’ll have more to say on this soon. But I figured I’d also ask ChatGPT its opinion on the question:

It depends on what you want to do with programming. If you are just starting out with programming and don’t have any specific goals in mind, you may want to start with a general-purpose programming language like Python or Java. These languages are widely used and have a large community of users, so you can find a lot of resources to help you learn and get started.

If you have specific goals in mind, such as building web applications or mobile apps, you may need to learn a language that is more specialized for those purposes. For example, if you want to build web applications, you may want to learn HTML, CSS, and JavaScript. If you want to build mobile apps, you may want to learn a language like Swift (for iOS) or Java (for Android).

In general, it’s a good idea to start with a general-purpose language and then learn additional languages as needed to achieve your goals. This will give you a strong foundation in programming concepts that you can apply to any language you learn in the future.

That’s pretty solid advice for a newbie, but I’m far from that. Perhaps the human touch is still needed?

Zeros And Ones

Zeros And Ones

If you’ve never heard of Benford’s Law, it’s worth reading about this nifty statistical fact. The gist is that for certain types of data sets, the frequency of the leading digit follows a predictable pattern (with 1 being the most frequent by far). I decided to put it to the test by analyzing the total view counts for each post on this blog.

Leading DigitActual RatePredicted Rate
131.3%30.1%
227.7%17.6%
317.5%12.5%
47.8%9.7%
55.4%7.9%
62.4%6.7%
71.2%5.8%
84.2%5.1%
92.4%4.6%

I guess that’s why they call it a law, because the actual digit rates match up pretty well.

Speaking of which, apparently I also have a thing for named laws. If you do too, the article is worth it for this side note:

The fact that things are often named for someone who didn’t discover it first is common. In fact, there is a name for this, Stigler’s Law of Eponymy. It was proposed by the American statistics professor Stephen Stigler in 1980 when he wrote that no scientific discovery is named after its original discoverer. In an ironic twist, Stigler acknowledged that the American sociologist Robert Merton had previously discovered “Stigler’s Law”.

You Are Not Alone

You Are Not Alone

Every new beginning comes from some other beginning’s end.

It’s been a strange season for tech work, with the boom of the last few years (decades even?) feeling like it’s coming to a screeching halt. A lot of people suddenly finding themselves out of a job, wondering what’s next.

While I’m relieved not to have been affected this time, I’ve been laid off before, and I remember the feeling of helplessness. Of wondering if I should have known better or cut and run before things got bad. And most of all (though it took me some time to name it): loneliness. All the relationships I’d built up at the workplace, while not my best friends, were a large part of my social life, and to have them ripped away with no warning took quite a toll.

For those in that boat right now, know that it’s not your fault. Really, it’s not your fault. Take it from someone who’s been there (on both sides of the table): it’s not your fault. Take time to acknowledge your feelings. And while I can’t promise you that something better is just over the horizon, there might be! And that is an encouraging thought.

Kindness Trumps Rightness

Kindness Trumps Rightness

Regularly I’ll hear people claim “I don’t care what anyone says about me.” While I appreciate the sentiment of confidence such a statement is intended to communicate, I believe it’s unhelpful, for several reasons.

First, I don’t believe it’s possible. Humans are social creatures, and much of our mental software is set up to be concerned with our standing with other people. Some of us perhaps more so than others can set that aside at times, but no one can turn it off completely.

Second, living with disregard for others’ perspectives on your own life and actions deprives you of valuable wisdom. Of course one shouldn’t take all opinions equally, and one must discern how to synthesize the input of others with your own evaluations. But more data is rarely a bad thing. Listen, then decide.

Most importantly, however, is that knowing how those you come in contact with feel about you is a healthy way to measure if you’re having a positive influence on them. At the end of the day I want every person I interact with to come away feeling that their lives are better for having known me. That’s more valuable than pretty much any other measure of impact I can imagine, and it’s true both personally and professionally. Absolutely nothing is more important to your career than being kind. Not education. Not skill. Not drive. Nothing.

So yes, I care what everyone says about me. And you should too.

Meta Post

Meta Post

Really enjoyed Two Heads Are Better Than One, a discussion of the various ways technology has allowed humans to have “second brains.” I realized in some ways this blog is one such implementation; it’s a place I can capture thoughts and stories so that I can recall them later without keeping them in working memory.

As a bonus, via the article I discovered Obsidian, which I’m now dying to try out. I’m a sucker for Markdown and the power of plain text processing tools.

Expect The Unexpected

Expect The Unexpected

Like many other languages, Python has the notion of default values for function parameters, for example:

def compute_final_price(cost, sales_tax_rate=0.08):
    return cost * (1.0 + sales_tax_rate)

This code behaves as you would expect:

compute_final_price(10.0, 0.07)  # returns 10.7
compute_final_price(10.0)  # returns 10.8

However, interesting things happen in more complex cases, because the default value is evaluated once, at the time the function is defined, and not when it’s executed.

my_rate = 0.05

def compute_final_price(cost, sales_tax_rate=my_rate):
    return cost * (1.0 + sales_tax_rate)

compute_final_price(10.0)  # returns 10.5
my_rate = 0.06
compute_final_price(10.0)  # still returns 10.5

You can prove to yourself the value is evaluated at definition time by running help(compute_final_price), and you’ll notice the default value has already been computed:

Help on function compute_final_price in module __main__:

compute_final_price(cost, sales_tax_rate=0.05)

The above can be pernicious if the default value is an object that’s modified inside the function:

def add_to_list(item, my_list=[]):
    my_list.append(item)
    return my_list

add_to_list(4, [1, 2, 3])  # returns [1, 2, 3, 4]
add_to_list(1)  # returns [1]
add_to_list(1)  # returns [1, 1]

A common workaround for the above is to do the following:

def add_to_list(item, my_list=None):
    if my_list is None:
        my_list = []
    my_list.append(item)
    return my_list

add_to_list(1)  # returns [1]
add_to_list(1)  # returns [1]

I’ve encountered folks that insist one should never use default values except for None and the above pattern, but I’ve found most of the time I’m not mutating such defaults, and the behavior described here is fine. But still, the more you know.

Into The Sunset

Into The Sunset

I’ve mentioned before my penchant for minimalism, which is why for the past 8 years my code editor of choice has been Atom (in fact, I may have been a beta tester for it, my memory’s a bit fuzzy on that point). Which is why it bummed me out a bit to read it’s being shut down at the end of this year. Technology marches on, I suppose. I can’t blame GitHub Microsoft for wanting to consolidate development effort in their fully-featured IDEs, especially integrated cloud-based solutions like Codespaces.

Still, I’m going to miss Atom’s simplicity and customizability (I’d even contributed to a few plugins). It was robust enough to be a complete development environment (for my coding style, at least), yet snappy enough for quick one-off text file editor. For the former case I’ll probably get back into VSCode, and Sublime Text ought to do the trick latter. Though maybe I can use it for both?

Crossing The Rubicon

Crossing The Rubicon

There are a plethora of resources for those just getting started with software development, and best I can tell, most of them will do the job adequately well. But there isn’t nearly as much on what is needed next: guidance on how to get from “early intermediate coder” to “seasoned software engineer”. In brief, here are some suggestions:

  1. Study existing high-quality code; if you don’t know what good looks like, it’s nearly impossible to produce it.
  2. Write a lot of code. There’s no substitute for practice and putting in your time.
  3. Find someone who can give you feedback on the code you write, and humbly iterate per the guidance.

In my experience, an efficient way to do all three is to find a couple open source projects that need support, dig into their code, and submit contributions. You start from a base of quality code, get to write more, and you’ll get feedback through pull requests. And the icing on the cake is that it’s all done in public.

Spend a few years of doing the above and you’ll be well on your way to next-level programming expertise. It’ll also teach you how to code with a distributed and decentralized community of stakeholders, and that’s no small thing.

Public Service Announcement

Public Service Announcement

This is a slash: /

This is a backslash: \

Website URLs have slashes. If you say “backslash” or “forward slash” when describing a URL, I will judge you.

That is all.

Automatic For The People

Automatic For The People

When I quit my first job after nearly 12 years, it was a shock to lose access to all the software I’d spent years developing. While I believe strongly in Egoless Programming, and resisting the notion of “my code”, so much reference material I’d built up was suddenly lost to me. I decided in that moment I needed to build up a portfolio that could not be taken away.

A few weeks ago I published Chrome Local Storage, a Python package that can read from and write to the Chrome’s browser’s internal storage, either one running locally or on an Android mobile device. The first draft didn’t have any CI/CD automation in place, but this weekend I fixed that.

It now automatically sets the version according to the git tag, runs some limited automated tests, runs a linter, scans both the code and dependencies for security vulnerabilities, and publishes builds to PyPI. All via Github Actions.

Did this project really need a complete pipeline? Not really, I doubt I’ll see much reason to modify it in the future. But I wanted to learn Github Actions, and I’d wanted to learn Poetry. Now I’ve done both, and have a publicly available reference to which I’ll always have access for when I need to build Python packages in the future. And if others need the same, they can use it as well.