The worst pandemic times seem to be already behind us and the market is slowly coming back to life after two years of lockdowns and online events. Since we can meet stationary without fear, our focus is to conduct conferences, workshops and other face to face events. At Espeo, we believe that nothing can replace interpersonal contact in a traditional form. This is why our first post-pandemic stationary event, coding.fest, took place on the 21st of April. It was an amazing meeting hosted in Gdańsk (Olivia Business Centre, O4 Coworking), from where our employees from Tricity work. Three of our employees (Piotr Horzycki, Wojciech Ossowski, and Szymon Biduła) have prepared prelections about PHP, Node.js, and Blockchain technologies. In this piece, we have collected summaries of the most important information from each speech that may be useful for you at work.
From this article you will learn about:
- Handling currency in an international fintech,
- Hexagonal NestJS,
- Connecting the DeFi space: Building bridges between blockchains.
Handling currency in an international fintech (Piotr Horzycki, Senior PHP Developer)
It’s tricky to handle multiple currencies in international fintech projects. From payment gateways to billing engines, there is a risk of losing money due to wrong calculations. When different systems have their own way of handling money, it’s easy to make a terrible mistake. Fortunately, we have a set of good practices, industry standards, and libraries for popular programming languages. Let’s start from using proper data types. Because most currencies have minor units of 1/100, it is natural to use decimal numbers to represent the amount. However, computers do not handle decimal numbers natively. Try adding 0.1 + 0.2 in a browser’s debugging console and you will not get the expected 0.3 due to a binary floating point system being used internally. This is why most e-commerce applications store an amount in the smallest unit as an integer. To make the calculations more reliable, especially across multiple currencies, a Money Pattern was invented. It already has successful implementations across PHP, Java, Javascript and other languages (MoneyPHP, Java Money, Dinero.js). Addition, subtraction, tax calculation, allocation, currency conversion – these are easily handled by well-tested libraries. When interchanging data between APIs, it is crucial to agree upon a contract. It’s not enough to just send a number and label it as ”price.” Thus, it is common to provide an object that combines an amount and a currency, like {”amount”: 1234, ”currency”: ”EUR”}. It would be even better to clarify use of integers with a label like amountInteger. This way we can avoid all misunderstandings.
Hexagonal NestJS (Wojtek Ossowski, Senior Node.js Developer)
Wojtek took us on a journey through the Yet Another NestJS App. Together, we discovered the unpleasant factors that developers encounter quite often during application development, such as: tangled codebase – instilling fear of change, fixed dependencies – causing vendor lock and reducing migration possibilities, cannonade of Mocked Dependencies – to set up your every single test. This final state of evolution is recognizable in the industry as The Big Ball of Mud and often ties developer’s hands, making it difficult for them to adapt to current business needs. This may end up with exponentially growing maintenance expenses, issues with meeting desired time-to-market and draining morale with poor development experience. Later, we highlighted The Architecture we Might Need: explicit, flexible and testable. These factors led us to the concept of Hexagonal Architecture. We’ve learned about its rules, building blocks, flow, and dependency relations between components. Limiting the integration points to the bare minimum and explicitly defining them introduced a bunch of improvements: better code organisation – through cognitive-friendly structure, increased testability – making entire business flow unit-testable, enhanced understanding – by exposing business processes, flexibility – possibility to delay critical decisions (aka. points of no return). Wojtek also showed us a NestJS project implemented in Hexagonal Architecture, cleverly using DI mechanism, encapsulating dependencies in Self-Contained Modules – hiding all implementation details and setting them up via Composition Root. We also saw how a modular, hexagonal approach can help us with microservice separation.
Are you a Node.js Developer looking for unique career opportunities? Check our job offer and join #espeocrew!
Connecting the DeFi space: Building bridges between blockchains (Szymon Biduła, Blockchain Developer)
Currently, the blockchain landscape is composed of many protocols that represent different design choices and as a result are mostly incompatible with each other. Yet, the liquidity, that could be measured by the overall market cap, is divided only among a few top players. Given the rapid rise of decentralized finance (DeFi) that is shaping the current market, underdogs need to find a way to bring the liquidity that enables DeFi or face unpleasant consequences. Therefore, many foundations and companies are interested in creating bridges between different blockchains. Creating such a solution for the client could be a daunting task for the developer. After all, one needs to take into consideration even the miniscule details of each blockchain to enable a seamless token swap. Thus, during the presentation a mental framework was presented that could make this task easier. This framework consisted of a list of issues that needed to be resolved on every bridge and questions that were worthy of lengthy discussion with the client during the design phase. Finally, the potential security risks were highlighted as bridges are currently the main target of the hackers attacks in the blockchain space.
Are you a Blockchain developer looking for new challenges? We have multiple growth opportunities for you! Check out our open job positions, apply and join our team!
The meetup provided ample opportunity to discuss interesting questions raised by participants. The planned Q&A session after each lecture and the networking session after the main part of the event happened to be very engaging. During the event, the participants were given the opportunity of winning the GoPro Hero 8 webcam by answering one question: ”In applications we often have a common database schema – both for Write and Read. What is the name of the approach that uses separate Read / Write models?”. The correct answer was Command Query Responsibility Segregation. The event showed us how important it is to return to offline meetings, which have been lacking in the past few years. We are already planning further ones for all programming enthusiasts. We hope to meet you there! Stay up to date with all the latest meetups and workshops we organize. Follow us on Linkedin, Facebook, and Instagram not to miss anything.