Afshar
Posted on November 23, 2020
Perks of being a polygot
A polygot software engineer is someone who can develop with multiple programming languages. It can be extended to platforms or technologies which someone utilize to create software.
In the last couple of days, I've been working on different pieces of two projects. Each piece belongs to a different platform or technology, hence I can claim that I've been trying to be a polygot software engineer! While some people prefer to focus on one technology/language at a time rather than polyglottery, I enjoy practicing this. Whenever I can switch easily between stacks, I feel I am a powerful software engineer. Being able to code in different programming languages enters me to more professional communities. Rather than its pleasure, being a polygot improves your resume. When you can develop on different platforms, number of projects you can participate or number of team you can join, increases. Furthermore, people who wish to be a CTO or even a technical lead, should try polyglottery, because this way, they can make better decisions on the stack they will use in their team.
Stacks which I used
I'm, simultaneously, working on two projects. One project in .Net which tends to be implemented with microservice architecture, and another one which is developing with Node.js/Express as back-end, PostgreSQL as database and Vue.js as front-end. Both project have a good degree of variety.
I am originally a back-end developer coming from Microsoft universe. However, the .Net project has its own challenges for me. I am totally developing and debugging on a Linux machine rather than Windows. Additionally, I am using PostgreSQL as the database rather MSSQL. Not to forget xUnit which I am using for first time.
As a C# developer, I found JavaScript as the most helpful language as an alternative to C#. I have used Python and Ruby in short periods of time, but JavaScript is more useful in my situation. It is the dominant language in front-end development. As I am very excited about front-end development, it helps me to move faster. Consequently, I chose a JavaScript based technologies for development. Nodes.js, Express.js and PostgreSQL as back-end, and Vue.js as front-end.
.Net project
The project is based on .Net Core 3.1 which will be upgraded to .Net 5 soon. I'm using xUnit.net for first time in this project. It's being used for both unit testing and integration testing. The unit testing part was not hard. However, as the integration tester, it took a lot of time to set up correctly. Test web server, which is an in-memory web server running instead of actual one, was refusing my settings about database and injected services. However, finally I found some way to utilize all its power. Now, my project have several integration tests which test API endpoints smoothly on an in-memory Entity Framework database. It also allows me to resolve services from test web server to test additional aspects of the code. During the tests, I get used to C# dynamic feature alongside appropriate JSON serializer/deserializer which helped a lot in writing clean tests.
Microservice architecture
The .Net project which I am working on is not alone. It's part of a group of project which form a big solution. There are at lease one another .Net project, a React.js front-end, a React Native mobile app, and a PWA yet to emerge. Considering back-end, I was in the dilemma to merge all back-end projects, mine and current another project, into one project with a single startup, or run each one in its own process. I chose the latter option because, there is little communication between me as the sole developer of my project and the team working on the other project. As other projects and teams may join in future, I decided to use microservice architecture here.
I checked Microsoft guide for microservice architecture and read their e-book on microservice architecture architecture. Also, dedicate some times to know more about Docker and RabbitMQ. Finally, chose REST HTTP as the communication channel between projects. As the first project is playing API Gateway too, I created a bridge middleware to proxy requests to the other project after authorization and logging.
Also, a process is running to implement JWT as the security token and possibly, using Redis for black-listing revoked tokens. I'm also considering PASETO as a modern alternative for JWT.
JavaScript stack
This part is more interesting for me. Many parts of the work is new to me including JavaScript itself, Express.js, Vue.js, PostgreSQL, PWA, front-end development in general and CI/CD provided by GitHub, Heroku and Netlify.
Node.js/Express.js
This is the easiest part. I am used to Node.js from other development environments including React.js. Additionally, Express.js as the back-end part behind APIs is not far from ASP.NET Core API. The only part which I feel uncomfortable with yet is lack of structure which I'm used to from C#. Moreover, I had some struggles setting up PostgreSQL. It's a relational database like MS-SQL, but syntaxes and routines are not same. Backing up and restoring were the most challenging part.
Vue.js
Last year, on another project, I chose React.js over Angular as it was, in my opinion, easier to learn. Most people know at least something about JavaScript. They are more open to it rather than TypeScript. Additionally, React.js had, and may still have, broader job market meaning that finding new developers on React.js is more feasible than developers on Angular. That time, I withdrew Vue.js in spite of the fact that it was easier to learn, and also had higher speed of development making it more suitable for MVP. This time I chose Vue.js for some of reasons:
- I need its rapid development to create a minimum product quickly
- Learning Vue.js alongside my current acquittance with React.js is enriching my resume
- Its job market has grew substantially from last year
I've started to code my project based on a boilerplate code which I've found on internet. To get started, I read essential parts of Vue.js 3 from its official guide. Taking components structure aside, methods, JavaScript and axios are sweet to work with.
PWA
PWA, Progressive Web Application, is the buzz word of the day. They are marketed as an alternative of native apps. For me, it is a cheaper way to conquer users' smart phones. Before considering PWA, I was researching about Flutter as my potential choice for mobile development. PWA can be a great re-use of your current front-end codebase specially if you are not heavily dependant on device's hardware and offline usage. Adding a manifest and registering a service worker is not hard stuff to do.
My experience of PWA is based on a yet simple Vue.js codebase. Taking manifest, service worker and a simple responsive template aside, I enjoyed using Local Storage to add some offline functionality. An unresolved problem exists which causes not automatic update of added to home screen app.
CI/CD
My projects are hosted on GitHub. Curiosity tempted to test Netlify as the automated host for the front-end. It was not hard at all. After signing up to the Netlify and integration with GitHub, Netlify detected Vue.js automatically, and dedicated a temporarily CDN for my project. Now, I'm very comfortable: I just push to GitHub and wait some seconds. After a while I'm delighted with a published version of my source code under HTTPS.
Same process happened for Node/Express part. I found a free hosting of PostgreSQL on Heroku. Then, paired Heroku with my GitHub repository to make automatic publishes happen. Again, backup/restore data with cloud-hosted PostgreSQL came with some struggles.
Finally
I am doing all of this on an Ubuntu 20.04, AMD A9 machine during COVID-19 pandemic. Visual Studio Code is perfectly satisfying all my need of a code editor. Also, it is serving my debugging requirements.
Posted on November 23, 2020
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.