Stop and Smell the Orchids

By: Danny Geisz | February 16, 2020

Project: Orchid



Bon-frikin-jour, brethren! What a week it has been. Last night my housemate and I journeyed into San Francisco to see the SF Symphony perform Saint-Saens’ Organ Symphony among other pieces. The Organ Symphony has a special place in my heart because:

  1. Saint-Saens was a musical sorcerer and everything he touched is distilled platinum.
  2. I myself played the Organ Symphony back in my glorious bassoon days, and I know the piece in and out. Listening to it performed live is remarkably similar to the feeling of seeing an old friend.

This schmeag named Jean-Yves Thibaudet debuted a spicy, spicy tango concerto for piano which was also quite fun. Monsieur Thibaudet is apparently one of the sauciest pianists still trotting, but I certainly hadn’t heard of him before this concert. Perhaps I need to make a better effort to remain attached to the culture of classical music. Perhaps not.

Now then, onto Orchid! Gracious me. I just looked at the Orchid project, and to my general horror I have only posted one piece about Orchid. This is slightly egregious because Orchid is hands down my most time-consuming personal project right now (aside from Project Supernatural, which implicitly consumes several hours per day), and literally the whole point of XFA is to document such endeavors. Perhaps I should just drop all pretenses of XFA being anything other than a brain dump for me. That would certainly be easier to explain in person. Eh, I like it as it is.

So what’s the latest news with Orchid, you ask? I think I’ll give a bit of an update as to my general progress, and then I shall give an account about how this project is affecting my life.

Superficially, Orchid has changed very little since I last posted. Actually, it literally doesn’t even properly compile, so to the untrained eye it may appear that I’m doing everything all wrong. However, if you take a peep under the hood into the code base, you’ll see an expansive evolving architecture for this project. You may remember from previous posts when I was noisily complaining about Orchid being the most organizationally challenging project on which I have ever worked. Well, blessed readers, nothing has changed. I’m not gonna lie. This is hard.

For my own personal gratification, I will now give a bit of an overview on how this project is working from a software perspective. If you consider yourself above computer science nerds, by all means, skip these next paragraphs and go to the part of the story where I tell the tale of Orchid provoking emotional breakdowns.

If you read the first post, you will know that one of my principal goals for Orchid is for it to look really good. Like Latex, for those of you who are familiar. This, in practice, is very difficult to accomplish. At the beginning of the project, I had to make the very big decision about how I want to actually render the math onto the application window. This is tricky, because I need the computer to be able to tell what mathematical terms are being clicked, which means the computer has to know where the terms are being rendered on the screen. This isn’t a problem if you’re using a text editor, and the computer only has to worry about one line of text. It is a problem if you’re trying to allow for more complicated mathematical expressions that aren’t linear in writing.

Because I really am trying to avoid reinventing the wheel as much as possible, I ended up settling on a slightly strange approach to the problem. During my research, I noticed that people have gotten really good at rendering math on web pages. Web pages are nice because you can add behaviors to each of the individual html elements that can allow you to easily detect if some element has been clicked or is highlighted, or whatever else.

Now then, JavaFX (which is what I’m using to build this application) has a cute little feature called a WebView, which can be used to display web pages. With Orchid, I basically have a WebView as the main editor window, and in the background, Orchid is just adding html to and manipulating the WebView’s DOM. I’m actually quite happy with this approach because I can very easily use the application to convert the entire editor window into html, which can then very easily be converted into a pdf.

This approach is, however, a bit quirky because I’ll have JavaScript listening to what the user is doing with respect to the main editor window, and the JavaScript will communicate this to the Java on the backend, so it kinda feels like I just stuffed a website into a desktop application (which is exactly what happened).

Another reason Orchid is a bit strange is because it doesn’t really lend itself to a MVC architecture. This is simply because each mathematical term in the model has a one-to-one correspondence with an html element in the WebView’s DOM, so it actually ended up making most sense to have each piece of the model be able to contribute to the view. So then, while the controller is abstracted from the model and the view, the model and the view are extremely parallel in nature, which is interesting.

Gracious me, if you don’t like CS, I super hope you didn’t read those last paragraphs. It honestly may not have been comprehensible to those of you who do like CS. Whatever. Let’s go right on ahead to how Orchid is messing with my life.

A simple axiom of my current existence is that I would rather be working on Orchid than doing my schoolwork. While this is of course in part due to the fact that I find Orchid more exciting that things like finding the infimums of sets, there are also more subtle reasons. Interestingly enough, ever since I started working on Orchid, whenever I’m doing math or physics, I’m always subconsciously trying to figure out how I would approach the current problem with Orchid, once it is completed. Because Orchid is inherently category-theory based, this mindset is actually quite useful in understanding the subtleties of various equations.

However, this has also started biting me in the butt. There are some topics in physics that Orchid will be able to handle incredibly easily and efficiently, and so now it’s frustrating to do my physics homework by hand because I know how much faster and easier it would be to do it with Orchid.

So then, the very idea of Orchid is making me frustrated with my math and physics homework, which isn’t exactly where you want to be when those are the subjects you’re majoring in.

Another reason I find Orchid to be particularly compelling is because it’s literally a perfect marriage of math, logic, and computer science. It’s kinda my ideal project. And because of that, I would rather be working on it than, well, most anything else.

Finally, I have found throughout my life that I tend to learn more useful information from my own personal projects and academic pursuits than I do in my classes. This is simply because school and classes can’t tailor their curriculum to the interests of each student, so they just teach you a ton of generally useful information, most of which you may never need. When I’m working on a personal project however, whether it be Orchid, building XFA, or ever learning Quantum Mechanics back in High School, I’m only learning information that is personally gratifying and applicable to my interests.

Now, I’m going to complain like an annoying twit.

I’m generally just frustrated with college in general. There, I said it. It feels like I’m spending a tremendous amount of time learning somewhat useful information when I could be spending my time learning and applying more practical information.

Gracious me, I’m starting to annoy myself. I’ll get straight to the point. My frustration with academics coupled with my liminal spiritual state has made me particularly prone to emotional crises. Two days ago, I hit the emotional nadir of my semester. I wasn’t doing great, I’ll admit.

Well whatever, enough complaining. I know for a fact that some part of me loves all the math, physics, and CS I’m doing in school right now, so I’m just trying to bring that mentality to the forefront of my mind.

Wow, I’m fading. I suppose if you want to take something away from this post, know that Orchid is a fun and cool boi. I got midterms to study for. Peace.