• Home
  • About
    • About The Coder
    • Language List
  • Code Rules
    • #1: Clarity Trumps Everything
    • #2: Source Code is for Humans
    • #3: Don’t Ignore Warnings
    • #4: Comment As You Go
    • #5: Always Use Parentheses
    • #6: Always Define Literals
    • #7: Never Repeat Yourself
  • CS-101
  • Python-101
  • Simple Tricks
  • Guestbook

The Hard-Core Coder

~ I can't stop writing code!

The Hard-Core Coder

Tag Archives: software design

Python Tk Calculator App

15 Monday Dec 2025

Posted by Wyrd Smythe in Python

≈ 1 Comment

Tags

Python code, software design

The previous post laid out the basics for creating windowing (GUI) apps in Python using the tkinter (Tk Interface) module. The module has been part of the standard library since Python versions 2.7 and 3.1.

In this post, as a small seasonal gift, I’ll start presenting a working GUI application — a script-driven pre-fix calculator with variables. Between the calculator code and its window code, there is too much for one post, so there will be (at least) a second part next week.

Continue reading →

Tk Windows in Python

24 Monday Nov 2025

Posted by Wyrd Smythe in Fun, Interesting, Python

≈ 2 Comments

Tags

Python code, software design

Python has included the Tk interface module (tkinter) since versions 2.7 and 3.1. The module is a binding to version 8.5 of the Tk GUI suite for making windowing applications. My first installed version of Python was 2.7, so I’ve been aware of the module for over ten years but never explored it.

At the beginning of this month, I decided to dive in. It led to an intense two-week bout of 12+ hour days, but I emerged with working apps (and my sanity). This post and ones to come document and share what I’ve learned.

Continue reading →

Dual Numbers in Python

17 Monday Nov 2025

Posted by Wyrd Smythe in Interesting, Python

≈ 1 Comment

Tags

dual number, function derivative, Python classes, Python code, software design

The last two weeks I’ve been on a serious coding binge teaching myself Python’s Tk module. Once I wrap things up, I plan to publish a series of tutorial posts.

In the meantime, here’s a trick I learned recently that allows one to start with a series of data point and use those to (quickly!) generate a set of corresponding data points that are the derivative of the function implied in the first set. The trick uses something called the dual numbers.

Continue reading →

Byte Multiplication Trick

29 Monday Sep 2025

Posted by Wyrd Smythe in Interesting, Python

≈ 1 Comment

Tags

GPU, Mandelbrot, Python code, software design

I’ve been working on an arbitrary-precision numeric class (in Python) that stores numbers in what amounts to base-256 — that is to say, in machine-native binary. It differs from the variable-length integers in Python by supporting fractions (and from Python’s Decimal number type by being binary).

It occurred to me I could implement multiplication with a lookup table rather than actually doing the math (at the CPU level, that may be what in fact is going on). So, I thought I’d compare the two implementations.

Continue reading →

Python Tredoku Solver

16 Monday Sep 2024

Posted by Wyrd Smythe in Fun, Python

≈ 1 Comment

Tags

computer programming, puzzles, Python code, software design, Sudoku, Tredoku

I’ve never been particularly interested in puzzle games. Figuring out software has filled that niche for me (plenty puzzling enough). So, I’ve never done a Sudoku puzzle. Recently I read a post about Tredoku, which is a kind of three-dimensional Sudoku.

In that post was an unsolved Tredoku puzzle. I wasn’t tempted to try to solve it myself, but I did think it might be fun to see if I could write some Python to do it.

Continue reading →

Bloom Filters in Python

19 Monday Aug 2024

Posted by Wyrd Smythe in CS101, Python

≈ 3 Comments

Tags

Bloom filter, computer programming, Python code, software design

I recently learned about Bloom filters (and was then able to fully understand the joke in this xkcd comic). While I don’t have a good application for them myself, I found them interesting enough to play around with a little.

Python uses them under the hood in a way that has some potential for other applications. In this post I’ll explain Bloom filter basics and go over some simple implementations.

Continue reading →

Musical Scale Modes Table

01 Sunday Oct 2023

Posted by Wyrd Smythe in Fun, Python

≈ 2 Comments

Tags

computer code, Python code, software design

Mathematician and educator John Baez has an excellent series of blog posts about music theory. The seventh concerns generating scales by using notes separated by fifths. Shifting the start point generates the seven major scale modes. Shifting the root key generates those seven modes in the twelve keys (a total of 7×12=84 scales).

John asked if any of his readers would be interested in creating that table of all 84 rows. It sounded like — and turned out to be — a fun exercise. This post explores in detail the Python solution I came up with.

Continue reading →

Function Currying

22 Wednesday Apr 2020

Posted by Wyrd Smythe in CS101

≈ 3 Comments

Tags

computer code, computer programming, function currying, Python code, software design, software development

I saw a video recently about function currying, and it triggered the realization that currying might solve a problem I’ve been pondering in the context of language parsing. The problem involves knowing how many arguments an operator expects, what’s called the arity of an operation or function. It can vary from zero to many.

It occurred to me that, with currying, there could be a language where operations always take just one argument. That would solve a challenge for a mathematical expression language I have in mind.

Continue reading →

Rule #5: Always Use Parentheses

19 Sunday Apr 2020

Posted by Wyrd Smythe in CS101

≈ 1 Comment

Tags

code clarity, computer programming, operator precedence, order of operations, parentheses, readable code, software design

Enough stories, time for a new rule. Which is to always use parentheses in all except the simplest of math expressions. Languages have a precedence protocol, so the compiler can figure it out, but human readers may be confused.

As always, the underlying motivation involves code clarity for other humans reading the source code — the most important rule of all.

Continue reading →

DataCollector Factories

16 Thursday Apr 2020

Posted by Wyrd Smythe in Stories

≈ 1 Comment

Tags

computer programmer, computer programming, data, Java, software, software design, software development

Last time I introduced the DataCollector application, but didn’t have room to get into the use of factory classes. There isn’t often a need for a factory class, but they can be useful when you need to create objects at run-time without knowing their class until then.

The general approach involves a function that returns instances of a class based on run-time information. In some cases the instances are limited to a predetermined set of classes, in other cases it can any class the known to the code.

Continue reading →

← Older posts
Follow The Hard-Core Coder on WordPress.com

The Posts

  • Python Tk Calculator App
  • Tk Windows in Python
  • Dual Numbers in Python
  • Python Decorators, more
  • Python Decorators, redux
  • Byte Multiplication Trick
  • Parsing Multipart Form Data
  • Simple Python Tricks #18
  • Simple Python Tricks #17
  • Simple Python Tricks #16

The Topics

  • Blog (4)
  • CS101 (37)
  • Fun (36)
  • Interesting (5)
  • Opinion (12)
  • Python (59)
  • Stories (15)

The Month

December 2025
M T W T F S S
1234567
891011121314
15161718192021
22232425262728
293031  
« Nov    

The Past

Posts

RSS Feed

Comments

RSS Feed

The Main Blog

Visit Logos con carne

Lots of wyrds... with meat!

The Author

Wyrd Smythe

Wyrd Smythe

The canonical fool on the hill watching the sunset and the rotation of the planet and thinking what he imagines are large thoughts.

View Full Profile →

Create a website or blog at WordPress.com

  • Subscribe Subscribed
    • The Hard-Core Coder
    • Already have a WordPress.com account? Log in now.
    • The Hard-Core Coder
    • Subscribe Subscribed
    • Sign up
    • Log in
    • Report this content
    • View site in Reader
    • Manage subscriptions
    • Collapse this bar