r/StandardNotes • u/a_standard_user Dev • Mar 31 '20
Implementation Details #002
(These are segments I've been posting to our community Slack. If you haven't already be sure to join there to see what we're up to!)
In the last segment, I talked about how we were sizing up our architecture to make it easier to maintain and build features into our apps. Our current architecture, which was constructed beginning in 2016/2017, and maintained over the next few years, has sort of reached a hard limit on what it can do. It can do what it was designed to do and well, but not much more than that.
One thing we’ve all learned at this point is to never give date estimates for software. But one should especially not give estimates for architectural projects. I mentioned a period of ~1 month for release of the new architecture, but I’d like to go on record now and completely retract any dates I may have previously mentioned ;)
Last week, as I was finalizing the development refactor of our shared JavaScript library SNJS, which contains the core logic our apps use to encrypt, manage data, and communicate with the server, I encountered a bug which I was not happy with. Of course catching bugs is part of the development process, but this particular bug upset me because it would have been easily prevented if the code was written in TypeScript.
So…I’m rewriting the entire codebase in TypeScript. It’s actually not too bad. I started late last week and am now about 75% complete. TypeScript is a superset of JavaScript that offers static type checking to make it less likely you’ll make simple programming mistakes. Writing our code in TypeScript was a mid-term todo, but I’ve decided to bring this up sooner, because if we’re focusing on architecture, now is the time. I will say that the code feels much more robust now with the introduction of TypeScript.
After I wrap up TypeScript integration, I want to focus on making more parts of the code follow an immutable object paradigm. Right now SNJS involves two primary data structures: payloads and items. Payloads are data that can be received from a server, or from an import file. Payloads are then used to create items. In the code, payloads are immutable. This means that after the objects are created, they cannot be modified or changed. This makes the code much more easy to reason about, and also helps prevent hard-to-track bugs and mistakes. Items are UI-level representations of a payload. However, items are currently mutable. For example, when the editor modifies a note’s title, we directly change note.title, and save the note. What I’d like to do is introduce immutability here, so that note objects (and other items) cannot be directly modified. Instead, anytime a place in the code wants to change an item, they must create a new item with the desired properties.
Overall, with the introduction of TypeScript and deeper immutability, this should put us in a really solid place, as far as long-term quality and maintainability go, which are of paramount significance.
How long will this take? As long as it takes. But I’m absolutely working at 110% capacity right now. I’ve been dreaming in TypeScript, I kid you not.
In other news, Baptiste has also been making great progress on upgrading our Electron app architecture. He’s also re-written a substantial part of that codebase in TypeScript, as well as upgraded to Electron 8, which introduces built-in spellcheck 🎉 Currently getting spellcheck to work in the desktop app is a real technical challenge, and requires a lot of custom work. We’re incredibly happy that the Electron team has decided to tackle this problem natively.
We’re still sort of feature-locked right now on our web app. Because the refactor I’m working on right now substantially changes the master web code beyond recognition, we can’t make any substantial changes to the production version without making it a near impossibility to merge in the refactor once it’s ready. Our mobile app is also feature-locked for the most part for the same reason. I’ve made some progress in hiring a dedicated mobile developer, and hope to share more info on this nearer to the start date.
As a general note, we operate by a 1-developer-1-feature model (the only way any developer can operate, I imagine). Because the projects we are currently undertaking are extremely blocking, and require deep architectural focus, and because most of our developers are working on these low-level features, we have admittedly very little capacity to fix low-to-mid-severity UI-level bugs or issues as they occur. This is not an ideal situation but almost every developer I hire I find myself assigning to some deep architectural work immediately ;) But I am working on improving resource management overall. It’s a tough problem and requires time and work. But overall, we’re absolutely making wonderful progress in building the kind of company we want to be :)
1
u/carlinmack Apr 04 '20
So…I’m rewriting the entire codebase in TypeScript.
lmao
0
May 25 '20
[deleted]
1
u/carlinmack May 25 '20
as a software dev who has experience converting javascript to typescript, I find it funny that a solo dev working on an update that feature-locks development would decide to take on such a task.
If I was you I would think that your comment characterised you as a person
1
u/pentapri Apr 10 '20
Every time there's a new and popular thread about how everyone is so tired of all the bugs and lack of development, a new post this appears. Every time there's some new version supposedly starting development and it's all hush hush and no details can be given and who knows how long it may take and so on, and on, and on.
More vapourware.
0
4
u/maxgamer128 Mar 31 '20
Thanks for the update. Sounds like you guys really have your hands full there.
I did want to ask however, being that these are pretty big changes, what can we expect once the work is completed from a security aspect? Will this app continue to provide the security features it has in the past or could these changes possibly bring about new vulnerabilities in the program?