avatar

Rodrigo Tamiazzo

Posted on 15th June 2023

Clojure Corner with Peter Stromberg

news-paper Clojure | Interviews | News |

We have started Clojure Corner to have a deeper understanding on what is happening in Clojure Community and in the world. Peter Strömberg a.k.a Pez is the first one in this Corner and we enjoyed our talk, read along to learn more from this awesome person.

Ela: First of all, I want to thank Peter Strömberg a.k.a Pez, for giving us this chance to have this talk with him. Then let me introduce our team: Jiri Knesl is the founder of Flexiana. Iain Wood, one of the greatest men on our team, and Rodrigo Tamiazzo who decided to run this interview, the representative of our VS Code community in Flexiana. I wish everyone a great time here!

Peter: Hi everyone!

Jiri: Hi folks. Happy to meet you.

Rodrigo: Hi guys! Peter thank you also, I’m a big fan of your work. :slightly_smiling_face: Actually, the first thing I’d like to ask is how are you, Peter? What are you up to, and what are you currently working on? But maybe we can start with a small intro as Jiri said. I mean, we know you but maybe you would like to introduce yourself to people that don’t know you yet.

Peter: I’ll be happy to start with how I am! It’s great with me. Friday and all. :smiley: What am I up to? I just took a brief pause from hacking on a ClojureScript, Re-Frame web app used for research on internet-based treatment for psychological illnesses. It’s developed at Karolinska Institutet, and used by researchers all over the world. The app was developed by Professor Brjánn Ljótsson. It was originally a PHP + JQuery app, and Brjánn has transformed it into a PHP + Clojure + ClojureScript app which allows being extended by JQuery (or any DOM manipulation thing). I’m having the best time of my professional life ever with it. Sadly Brjánn’s funds for it will be drained in a month so I will have to find something else fun to do.

During the pause, I was playing with Midjourney. Found a tweet with a super complicated prompt rendering a young, stunningly beautiful woman. The prompt was super complicated and I decided to figure out what in the prompt was doing the heavy lifting. To my disappointment, the image rather displays a weakness in this technology. At least I think it does. Tweeted about it here

I’ll be happy to present myself. Please tell me about a few things you want to know and I will try to cover those as well as whatever I think you should know. :smiley:

Rodrigo: That’s cool, I share the Friday feeling also :sunny: And thanks for sharing this past project, I think that human-centered, especially mental health is a terrific field where technology can help. And this final architecture got me thinking… “PHP + Clojure + ClojureScript app”, it’s like 2 backend processes (PHP & clj) running in parallel. Or it’s something like PHP code compiled to the JVM? Pretty glad to know this is an amazing professional moment, I hope it goes from here to better! (And maybe more amazing ideas like Calva) :smiley:

Peter: Brjánn’s end game is to get rid of the PHP part. It’s actually pretty cool the way he’s doing it. There’s an nREPL client in the PHP part and as APIs are being ported, Clojure code starts using this nREPL client for accessing them. Very pragmatic and elegant, I’d say. And my toolsmith heart warms from seeing nREPL used like this. :smiley:

Rodrigo: And yeah Midjorney and this generation of cutting-edge generators are getting surrealistically advanced in a short time, another topic I also enjoy. I found pretty curious this one girl model for MJ. It may be a basic figure, from which others are generated. Maybe we can say it’s like an archetype? :thinking_face: ^^ And Pez, just because I’m not sure if I understood correctly: when you said “Making myself available for spontaneous Huddles too” did you mean it would be ok for you for us to schedule a face-to-face time? Both ways work for me, but I totally understand if you prefer keeping async by text messages

Peter: I also used the term archetype, in another thread in Slack 

Rordrigo: So it maybe yeah, that could be a really plausible hypothesis! ^^

Peter: Oh, I replied to the wrong comment. :smiley:As for Huddles, I meant it. Spontaneous as well as scheduled. If I can’t do it at some particular time, I’ll just say so. It’s great doing the interview async. So I do not suggest doing sync meetings instead. It’s just nice to chat face-to-face too, I think. I sometimes open a huddle in the #calva channel, and just see if someone joins. Have had quite amazing chats with Calva users that way.

Jiri: Why have you decided to build Calva?

Peter: It was more a decision to keep maintaining it, than about whether to build it. I’ve always loved to tinker with new toys, including development environments. I don’t think I’ve used many tools that allow extension, that I haven’t extended. Even for things that resist extending, I still try to do it.

I was new to VS Code and very curious about how to build extensions for it. Then when the Clojure extension I was using, Visual:Clojure, was not doing a few things that I wanted it to do (pretty print results, run tests) I hacked it to do these things and sent a PR.

I’m also quite impatient (that’s not the right word, more like “eager” or something, my English fails me right now). Hmmm. Let’s say, I wanted the change to be applied quickly so that I could continue sending improvements in Visual:Clojure. Specifically, two improvements that I thought were extra exciting. So, when the PR hadn’t gotten any response after a week, I closed it and published my fork of the extension instead. BOOM. Calva was born.

So that’s why I “decided” to “build” Calva. “Decided” because it wasn’t much of a decision. I just did it without thinking much. Because I could? “Build”, because the first version of Calva wasn’t really built by me.

Then. Within a few weeks, something quite amazing happened. My version of the extension started to be downloaded. It wasn’t many weeks, maybe just one, before it had 1K downloads. My colleague, Linus Ericsson, bought cake and we celebrated at the office.

Another thing happened too. I started to get feature requests and bug reports and PRs. More people than I had concluded that Visual:Clojure was abandoned. Now it seemed they set their hope to Calva. And to me. I realized I now had to make a big decision:

  1. Take Calva down from the marketplace, not maintaining it for public use.
  2. Shoulder the responsibility involved with having users on the product.

You know what I decided. :smiley: April 17, 2018, a month after releasing Calva, I “announced” it on ClojureVerse, as part of my introducing myself on that forum.

That’s the “Why did I decide to maintain Calva?”. I created it to support my own needs for Clojure support in VS Code. And I maintain it for that same reason, plus that I want others that rely on my product to be able to do so. It’s important to me that Calva is maintained. That’s part of why we are a team of maintainers. I don’t want it to depend on me.

Wall of text. :smiley: It’s complex. What two improvements was I eager to get in there? The Calva Changelog tells us. Pasting here:

## [1.1.11] - 2018-03-20

- Add inline annotations for interactive code evaluation results.

## [1.1.9] - 2018-03-18

- Add toggle for switching which repl connection is used for `cljc` files, `clj` or `cljs`

The inline display of results was something my CIDER-wielding friends enjoyed and that I wanted to enjoy too. The cljc toggle was my solution to a rather tricky Ux problem.

End of the wall of text.

Rodrigo: So it appeared because of a personal need, and very quickly it became the best option for vscode. In your “introduce yourself” link, The final line says “I should probably rewrite it in Clojurescript. Maybe someday…” Since today Joyride exists, may we assume it’s now rewritten in cljs? Or it is a combination of clj and cljs? 

Peter: I have put a lot of effort into trying to port Calva into ClojureScript. So has Brandon Ringe. Both of us have given up and taken it up again a few times. A few months ago Brandon created a test project for it, I think it doesn’t show in that repository, but with the help of Thomas Heller (and some bug fixes in shadow-cljs) there might finally be a path forward that does not translate to “rewrite it all to ClojureScript in one go” (which I have also attempted).

The reason I have abandoned the full-rewrite attempts is that it has taken too much of my time and the product owner in me asks questions like “How does this benefit the users?”

“Or it is a combination of clj and cljs?”

Yes. Calva is partly written in ClojureScript. Mostly the divide is:

  • If it needs to reach into the Clojure ecosystem -> ClojureScript
  • If it integrates with VS Code -> TypeScript

For everything else, it often just defaults to TypeScript. I like TypeScript. I don’t love it like I do with Clojure. But it is pretty nice and npm usage and being close to VS Code API often makes me prefer it.

“Since today Joyride exists”

Joyride is written in ClojureScript. And an option for Calva features would be to write features using Joyride. That would mean they are written in SCI Clojure, so not always an option, but for many features it would work just great. And it would mean we would be working with a ClojureScript that is closer to the VS Code API since that’s what Joyride is about.

But I think we will be checking if Brandon’s latest ideas around writing things in ClojureScript work first. Since it would allow porting things piece by piece, I think it is a good way forward. And since I like TypeScript, I am not in a hurry. For me, the most important thing is that users of Calva get value. I don’t at all like to do work that I don’t think brings value to the users.

Rodrigo: Yes, this is actually the first important question about your work! Did you work with Clojure before Calva? What was the motivation behind Calva?

Peter: I think my answer above covers most of the initial motivation part. As for if I worked with Clojure. I wasn’t supposed to. I was not a developer at the startup I was working at. I was the product owner. But we were doing mob programming and my colleagues insisted I should be at the keyboard too. So in that respect, I was working with Clojure a bit. Mostly I was amazed at how my colleagues were using their editors and tried to understand what was going on, both when watching them and when given the keyboard. It was as if the app we were building was inside the editor. How could it be? Before I could really answer that question I was hooked. When we switched to ClojureScript for the front end I quite often found myself coding even when not in that mob. Eventually, I realized I wanted to code instead of managing the product. I used Emacs and CIDER for a while, but my computer didn’t really like it. I liked IntelliJ even less. Then someone showed me VS Code. Both my computer and I liked VS Code. :smiley:

Rodrigo: since you said that your computer “didn’t like Emacs+CIDER very well” XD How do you see Calva in relation to Emacs+CIDER? I mean are there features missing from emacs that you still would like to see in VSCode+Calva?

Peter: Calva is related to CIDER such that CIDER is the main inspiration. Calva is short for Calvados, which is distilled from Cider.

The first known record of Norman distillation was made by Squire Gilles de Gouberville in 1553, and the guild for cider distillation was created about 50 years later in 1606.

Wikipedia

And Bozhidar Batsov is my main inspiration as an open-source maintainer. Not only because he maintains a similar product. He takes the product and its users seriously, which is the main inspiration for me.

As for feature parity. I have this feeling that Calva is pretty far from feature parity with CIDER in some areas. I actually don’t know. But I know that Calva also is very feature-rich, and since it bundles clojure-lsp the feature set also includes a lot of things that you won’t find in CIDER. So, tricky question! I know of one feature that CIDER has that I wish Calva had: the CIDER inspector. Though #portal covers a lot of that use case, and then some, so it is not as pressing as it used to be. Still, Calva should have something “native” for inspecting data.

And I haven’t introduced myself yet. Where are my manners? :smiley: I can do that without further prompts, but still, it would be cool to know a bit of what you’d like to know about me. I’ll write something later tonight.

Rodrigo: haha that’s true! So far we only know that you live in Stockholm and are a very bright and creative person :upside_down_face: Could you tell us where are you from? (did you live your whole life in Stockholm?) When did you start coding/studying computation?  Did you go to College or were you a self-learner? Also if you could share how was your first contact with Lisp and if you had a favorite language before lisp/clj?

Peter: :wave: “I’m from many different places” — Highlander :smiley:

Stockholm is my second hometown. I was adopted here from Bogotá, Colombia when I was 6 years old. I don’t speak any Spanish. When I think something like “Who am I?” the first thing that comes to mind is that I am a family man, married with five children. I care about some things very deeply, won’t go into those things here, suffice it to say that I let my philosophy of life guide me in everything I do.

There is a very nerdy side to me. Nerdy as in that I nerd things. I dig into them, curiously and thoroughly. This is how I learn things. I have what might be the equivalent of American high school formal education. Sometimes I never come back up from a rabbit hole I jump down into. Other times I catch new interests and let go of whatever it was that I obsessed with before. In the category of never coming back up, I place programming. I’ve been doing it since I was 13 years old, 42 years ago, when I got a VIC20 computer as a Christmas gift from my parents. It’s what I do for fun and for food. Except I didn’t do it for food during the 2010s when I was working with another passion of mine: Products.

My product owner career ended when I was introduced to a new programming language and realized there is nothing as fun as coding in Clojure. It is my first LISP. Before Clojure I thought of myself as a polyglot programmer, picking up whatever language that I found. I liked them all, but can say I have fallen in love with but two of them. I did my for-food coding in PostScript for quite a few years and enjoyed it almost as much as I enjoy Clojure today. PostScript wasn’t general purpose enough to be my one and only language though. Clojure is.

A hobby I haven’t dropped yet is kitchen knife sharpening.  Sharpening my knives for a couple of hours is the only time when I do not think about anything at all. I need to do it now and then, regardless of what the knives need. :smiley:

As I keep dropping links here, you might as well get this one too. :grinning:

Rodrigo: Amazing! It would be ok if I associate the “nerdy side” with the “hacker side”? Your story reminds me a little bit of a documentary about a hacker’s life I’ve seen last year ^^ I didn’t even know one could make a living on PostScript ^^

Your hobby also is pretty similar to meditation in a sense, right? :slightly_smiling_face: Very important (although sometimes hard) to keep time for solitude

Peter: Yes, I often refer to those moments with my knives as my Zen. It was amazing the first time it happened to me. I was, what, 40 years old? And experienced a moment of non-thinking for the first time in my life! It gets extra important for me when I am up to something extra exciting and skips much of the sleeping, which I guess otherwise serves as pauses.

Rodrigo: Since you are (at least used to be) a polyglot programmer…may I ask you what you think about languages in this sense? Why was PostScript better than other languages? And Clojure? Is there any other (even theoretical) language that interests you?

Peter: It’s probably very related. Maybe a hacker is more about a skill set, and a nerd is more about an attitude.

Rodrigo: makes sense 🙂

Peter: PostScript was better than other languages for two reasons:

  • It reached into the printer which I, back then, needed to hack.
  • It supports Interactive Programming. Which I didn’t know what it was, back then. I only knew that I was wonderfully happy when I jacked into the machine (the physical machine in this case) and inspected its state, and modified how it worked. While it was running.

It’s idiomatic for PostScript to modify the program as part of its execution. I probably have a thing for this dynamism. I think I would have loved hacking in SmallTalk too. But I never crossed paths with it. Not looking much at other programming languages right now. I have so much yet to explore in Clojure and its ecosystem. Feels like I will be busy with that until I am ready to be dug down six feet under. :smiley: But it could change. I am a pretty curious guy.

I talk a bit about what makes programming fun for me on YouTube

Rodrigo: thanks for sharing this Pez, it’s really personal and it’s inspiring seeing how far you came and how much your life changed 🙂 

And about the languages I asked for, one of the properties I understood makes a language special is “Interactive programming” right? I can relate to that the first time I saw a REPL interacting with a live app, was almost surreal

Jiri: I have moved from Vim to VSCode recently (thanks to Calva, it helps a lot). When you compare VSCode with older editors like Vim and Emacs, what do you think are the main architecture or usability decisions that make VSCode better for you than Emacs or Vim? In Flexiana, people are really into Lisp machines. Why should they try VSCode?

Peter: For many years I was always using vi, and later Vim. I found writing plugins for Vim quite awkward. Probably I misunderstood something, but it was also a strange language that I didn’t really get on friendly terms with. When I started with Clojure, the support in Vim was a bit strange and a bit too far from CIDER. So I first tried to use Emacs for Clojure and Vim for everything else.

As I’ve mentioned earlier, Emacs was too heavy for my weak product-owner machine. The Clojure support in VS Code was closer to how things worked in CIDER, and VS Code was super easy to use. And also easy and fun to extend. It wasn’t long before I dropped Vim for “everything else” and today I live my life in VS Code. For things it can’t do, I use Joyride to make it do. I prefer VS Code over both Emacs and Vim because it integrates into the rest of macOS neatly and behaves like all other apps. Even on my current machine, which handles Emacs, VS Code is way, way more stable. It never crashes and I run it for months with 10-20 projects open at the same time. I’m probably holding Emacs wrong, but to me it is crashware. The main price I have to pay for this preference is that VS Code is more boring in its extensibility than Emacs is. The API often says no. Unlike Emacs which always says yes to whatever crazy thing you want to change.

If Lisp machine aficionados find VS Code extensions that give them good support then it’s a matter of preference if VS Code is the right editor or not. And even if extension support is lacking, if you like VS Code, I think you should make those missing extensions.

Jiri: To develop a VSCode extension, you need to do a lot of JS, right? Do you think it’s viable to write VSCode extensions in ClojureScript?

Peter: It’s perfectly viable! Joyride is written entirely in ClojureScript. Only some tiny glue files are written in JavaScript. If I would start to write Calva today I would do it in ClojureScript.

When developing VS Code extensions with VS Code, is the full REPL experience. The developer host instance of VS Code changes as you evaluate new behavior into existence. The debugger support we enjoy with the TypeScript code is strong, but it can’t begin to compete with the ClojureScript REPL in terms of developer ergonomics. And a tool like #flow-storm gives us a debugger anyway.

Jiri: How do you think developers’ day will look like 5 years from now? There’s AI, no-code, low-code, and PaaS (like Supabase and Firebase). In one way, things are way easier than 30 years ago and at the same time, we might be heading towards an era where only senior developers will have an edge over easier solutions. What’s your view on this?

Peter: The AI revolution will be amazing. I am super happy and grateful to be living in these times. To be here when this fantastic thing happens. It will be as great a revolution, maybe greater, than the Internet, I am pretty sure. There is no fear of AI in me to be found. It will be just fine! The powers that be will of course be trying to stop it from happening, but they will fail, I think/hope.

It’s really hard to predict where the tech will take us, we just won’t do things the same way as we do today. Heck, I don’t do things the same way as I did half a year ago. Today I am an AI-enhanced developer. What we can predict is that machines will be doing more of the things that humans do today, and this will free human creativity to do more valuable and fun things. Machines will not turn creative in my lifetime, nor yours, I think. The I in AI is deceiving.

Rodrigo: Pez I’d like to make another question: How do you see the actual debugger/inspector at VSCode? We talked about cider and you mentioned flow-storm in another thread, but there is also Calva’s inspector (“ctrl+alt+c i” if I’m not mistaken) … Is there any recommended way to do it now? And in the future? (if you see any trend..)

Peter: Just to make a thing clear first: The CIDER debugger is a different thing from the CIDER inspector. The former is a tool for inspecting program execution, and the latter is a tool for inspecting data. Calva has implemented a debugger that is more or less on par with CIDER’s. We haven’t implemented anything equivalent to the CIDER inspector.

So, if we are talking about how to deal with the lack of a data inspector, it depends on your needs. I seldom lack it. There is an inspector in shadow-cljs that I use for the few times I need something like that since I most often work in ClojureScript land. For people working with data science, I know #portal is popular. Calva integrates Portal’s views into its Clojure Notebooks. We got a nice shoutout from Kira McLean about that at the Conj. I think also #reveal is used by many people.

So. I think Calva needs a lightweight inspector of some sort. And then #reveal and #portal can take care of the users that need more than that.

And the distinction between a debugger and an inspector is blurred by things like #flow-storm. For my data inspection needs, #flow-storm is great.

Ela: Pez thank you so much for the time, I believe our developers enjoyed this time with you. All questions were from our side, is there any question you have for our developers or anything you like to know about Flexiana?

Peter: Since I work at what I think is a bit of a similar company to Flexiana, I am curious about how similar it is. :smile: How many are you there? What do you do to create a Flexiana culture for people who work there? What would you say is the thing that keeps you together? How do you think that a customer who has worked with you for a while would describe that thing that is unique with Flexiana? Are you hiring? Do you hire both junior and senior developers? What do you look for when hiring someone that will make it a successful hire?

Jiri: We are now about 70 people.

Speaking of culture, it’s autonomy (no hierarchy, no team leads, no managers, team own their own methodologies); craftsmanship (always expect clean code, no limit on testing or refactoring).

What keeps us together? Love for Clojure and craftsmanship.

I think for our customers, as each team is different and owns a methodology, the experience is different. But they always get to work with senior devs and designers who are independent and able to deliver anything.

Ad hiring) unfortunately, we’re now reducing headcount. But hopefully in September, we will start actively hiring.

We consider only people with 5+ years of professional experience (can be in other languages, many people start their Clojure journey with us).

When we are hiring, we have multiple stages in which we are trying to see whether the person has senior-level habits and understanding of what does it mean to build and maintain a production system. That’s probably the most important part. Besides that, we definitely expect knowledge of full-stack development and how webapps work both on client and server. But it’s true that our team is way more experienced on the backend side.

Peter: “I think for our customers, as each team is different and owns a methodology, the experience is different.”

Pushing a bit more on this thing. :smiley: If you think about something that all customers would say when having had Flexiana people for a while, What would that be? I know what I think/hope would be the answer for Agical customers here.

I know what I think/hope would be the answer for Agical customers here.

Jiri: Well, we are training people to be craftsmen, to write clean code, and to self-organize. So the experience should be that they can trust the team it can deliver anything they need and the end result will be of high quality.:smile:

Hope you enjoyed this interview, we are going to have Sean Corfield in this Corner next time!