Iāve yet to contribute to the safe network code base, but I did integrate with it in the past (years ago now, sadly). Iām not an expert in Rust, but Iāve been writing code in my day job for over 20 years, including Java (primarily), PHP and Javascript. Over the last 3.5 years, I have also been contracting, predominantly (but not exclusively) in Fintec. This has given me exposure to a lot of different applications, code bases, processes of varying quality and consistency.
Iāve recently started to look over the latest code base with renewed enthusiasm. Iāve read the Rust book and associated material and have started looking through the various Maidsafe repos. Iāve had a detailed look through sn_api (including sn_cli) and sn_client, tracing through authentication and sequences primarily. Iāve also started looking over sn_node and sn_routing.
My thoughts so far? In a nut shell, it is well organised and appears to be high quality code. There is good functional decomposition, well thought out abstractions (structs/objects) and as a result the code reads well. Given the degree of complexity and novelty, this is great to see.
On my travels I have seen far, far worse code. I have seen eye watering functions with hundreds of lines of code splatted within them. I have seen the absence of any structure beyond basic functional decomposition, with little in the way of types or abstractions. Some of this code was from institutions you would have thought (and hoped!) would have high standards. The Safe Network repos are a bastion of quality in comparison.
What would I improve? From what I have seen, unit testing isnāt a priority. There are unit tests, but they tend to be thinner on the ground than I would prefer. I understand that unit testing can slow down progress in the short term, but it has the opposite effect in the longer term. Personally, I tend to write more unit test code than application code and like a high level of coverage.
I understand that there are automated integration tests though (I havenāt seen these yet), which helps to bridge the unit testing gap though. As a newbie to Rust, I may also be overestimating how much unit testing needs to be done (relative to, say, Java). However, given the shape of the code looks āunit testableā, clearly the developers have a good understanding on how to separate concerns and use appropriate abstractions, etc.
Still, my journey into the safe code base continues. These are my honest opinions at this time though and I see much to be pleased about.