PyDev of the Week: K Lars Lohn

This week we welcome K Lars Lohn (@2braids) as our PyDev of the Week! He has been a part of the Python community for quite a few years. You can learn a bit more about him over on his blog or by checking out his Github account. Let’s spend some time getting to know him a bit more!

Can you tell us a little about yourself (hobbies, education, etc):

I’m a product of the education system of the State of Montana in the 1980s. I studied Electrical Engineering at Montana State, but switched to Computer Science at the University of Montana. I switched universities to get access to U of M’s VAX-750 running Unix. I graduated with a BS degree in ’83 and then, later, an MS in’ 91.

My hobbies include unusual plants, intricate drawing and baroque music. I have seven greenhouses filled with organic veggies, orchids and carnivorous plants. In the last few years I’ve discovered that I can draw well enough show pieces in art galleries. Finally, while I own an oboe and a family of baroque recorders, I’ve settled on an electronic woodwind instrument, a Yamaha WX-5. Oh yeah, then there are the Harleys: ’08 FX-STB Night Train and a ’15 Fat Boy Low.

I work for the Mozilla Corporation. My first contributions to Mozilla projects began while working at the OSUOSL in ’04. Later as an employee, I was the lead developer in Socorro, the Python based server side of the Firefox crash reporting system.

Why did you start using Python?

After considering several languages, I chose Python because it offered both OOP and functional paradigms. It’s quick to learn and quick from concept to working code.

Microsoft inadvertently pushed me into Python and Open Source way back in ’02. At that time, I was running a online nursery specializing in rose bushes. The business ran custom software I wrote using a Microsoft stack: Windows, C++, Access, SQL Server. One day, I received a letter from the Business Software Alliance threatening a lawsuit over unlicensed Microsoft Windows and MS Office software. I was unable to find any of the “Certificates of Authenticity” that came with the Dell machines. It turned out that it was a protection racket. Microsoft in cahoots with the BSA trying to shake down small businesses to scare them into paying “settlements” for software for which they already held legitimate license. I reported the scheme to the Oregon Attorney General.

Infuriated by their cavalier ethics, I decided that Microsoft had no business having a hand in my revenue stream. After some research in Open Source Software, I chose Python, Postgres and Linux to re-implement the software that ran my business. A month later, Microsoft was excised from both my business and personal life.

I hold a grudge against Microsoft to this day. I still have pursed lips about GitHub.

What other programming languages do you know and which is your favorite?

C++ will always have a place in my heart. I learned OOP in a graduate school course using Smalltalk in ’88. For the final project we had to use some other OOP language. After some research, I chose C++. I was a great choice as it launched the next era of my career at Rogue Wave software in the early to mid ’90s. I was the senior developer in the team that created the SQL encapsulation library known as DBTools.h++ (later renamed Source Pro DB). It was essentially SQL-Alchemy for C++.

One of my favorite languages from the past is APL, a cryptic exercise in unreadable code. It has its own character set and special keyboard. I was fascinated with its brevity and power. Conway’s Life cellular automaton can be implemented in one line: life←{↑1 ⍵∨.∧3 4=+/,¯1 01∘.⊖¯1 0 1∘.⌽⊂⍵} (from wikipedia)

What projects are you working on now?

I’m currently attached to the IoT group in Mozilla’s Emerging Technologies unit. The goal is to promote a standard that encourages the Internet of Things into becoming the Web of Things. There are too many proprietary systems and vertical silos in IoT. The same standards that drive the Open Web could be applied to IoT. Controlling a switch or a thermostat shouldn’t require the cloud unless control is from outside the local area network is desired and warranted.

The IoT group created the Things Gateway, an implementation of the Web Things API. It enables devices to be treated as Web apps, allowing control using Web tools: a browser and just about any language that can use a RESTful API and Web Sockets. The Things Gateway also serves as a bridge between non-IP technologies (Z-Wave, Zigbee) and the Web Thing API.

My work these days is exercising the Web Thing API with Python. I’m taking devices and services and wrapping them in a Web Thing blanket so they can be access and controlled as home automation devices. Some examples can be found on my blog: https://www.twobraids.com/search/label/IoT

One of the more interesting recent projects was to make a Tide Light (http://www.twobraids.com/2018/06/things-gateway-restful-api-and-tide.html). Using a Philip’s Hue bulb, make the color of the bulb follow real time tide information: green for low tide, red for high tide. For the low to high transition, fade the bulb from green to yellow to orange to red. For the high to low cycle, fade from red to magenta to blue to
cyan to green.

The nature of this sort of programming goes hand in hard with the asynchronous programming paradigm. This was my first opportunity to really start to exercise the abilities of Python in that realm. In the early days of asynchronous Python, it was all done with generators and I was skeptical because the intent seemed so obfuscated. In Python 3.6, it has achieved clarity and is really fun to use.

Which Python libraries are your favorite (core or 3rd party)?

The most common modules that I import are functools, itertools and contextlib. Erik Rose’s more-itertools is wonderfully useful (https://more-itertools.readthedocs.io/en/latest/api.html)

Of course, I have a lot of my own tools that I use repeatedly. configman is prominent in a majority of my code, but I’m not sure I can recommend others using it. While it is richly featured, it is poorly documented.

Is there anything else you’d like to say?

Deep within this field that we call Software Engineering is a hidden Law of Conservation of Complexity. I have serious doubts that complexity can be eliminated, it can only be shifted to somebody else. Want to simplify your complicated server architecture by breaking it into micro services? You’ve just delegated the complexity to the developers one step higher in the stack and the ops people one step lower. It seems we eventually push complexity all the way out to the
end users. At that point we declare that it’s not our problem anymore.

Do not fear complexity. If you fear and loath complexity, then you fear and loath the world in which we live. Life itself is unfathomably complicated, I choose to make peace with it and embrace it when I can. Complexity underlies life’s ability for graceful recovery which is always better than graceful failure.

Thanks for doing the interview!

1 thought on “PyDev of the Week: K Lars Lohn”

  1. Pingback: PyDev of the Week: K Lars Lohn | The Mouse Vs. The Python | Literary Nirvana

Comments are closed.