Vinícius Campitelli

When advancing in our careers as developers, we come across some questions about the structure of our software. Before long, the main question about solving a problem is not about what to do anymore, but how to do it elegantly. We start looking for better development tactics and how to make our code mode readable and easier to maintain. Not only because it’s more elegant, but doing so can significantly save us time, as sometimes we spend more time trying to understand it than really writing it. In this self-development journey, everything is beautiful. In this article, I’ll share how you can use the SOLID principles to make your code flexible and maintainable.

twitter: @vcampitelli

Articles

Cryptography with Libsodium

By Vinícius Campitelli

According to the just-released 2021 version of OWASP Top 10 (a curated list of the most critical web application security risks out there), “Cryptographic Failures” are the 2nd most important of the many security concerns we should have as web developers. These concerns include a lot of misuses of cryptographic systems, like choosing weak algorithms, poor randomness sources, or usage of deprecated methods. That is why this is also the second article covering the main topics for cryptography: on our last issue, we covered the main theory, which sometimes is the cause of those errors mentioned above, and right now we will see how to use libsodium, a modern library with the most recommended algorithms already built-in and no weak settings available per default. It is a cross-platform tool, available to use on Windows, Mac, and Linux, and has been included in PHP’s core since 7.2. It also has bindings for Java, NodeJS, Python, Go, and several other languages. So we are safe to say it runs pretty much everywhere. The official website is libsodium.org, and you can find the full documentation there instead of the PHP.net manual as it is sometimes not complete. There is also a Quick Reference and a “Using Libsodium in PHP Projects” article on their website that helps a lot, and I strongly recommend you take a look. Before we start, here are a couple of notes: first, there are lots of constants to indicate some arguments that should be used instead of hard-coding the values, and second, both functions and constants are pretty verbose, sometimes taking up to 55 characters. But I think it’s better to express the purpose of everything instead of having to guess. Let’s begin! by Vinicius Campitelli

Published in The Art of Data, November 2021

Cryptography 101

By Vinícius Campitelli

If you ask a group of programmers the most difficult topics they think there is in the area, there will be a lot of different responses, depending on which language they use and how skilled they are. Dynamic memory allocation, concurrency, coroutines, compiler optimizations are just some examples of those answers. I do hope I’m wrong here, but I don’t think there will be anyone saying “Cryptography”. Sadly, this is why a lot of developers get it wrong on their first hundred times trying to develop a minimal secure system.

Published in Decrypting Cryptography, October 2021

Applying Best Coding Practices to PHP, Part Two

By Vinícius Campitelli

Sometimes, SOLID can be a bit hard (no pun intended) to follow because we can’t even notice what we are doing wrong, especially with the Liskov Substitution Principle, as it can be very theoretical. In part two, we look at another, more practical approach for writing solid code.

Published in PHP 8 Bits and Git, December 2020

Applying Best Coding Practices to PHP, Part One

By Vinícius Campitelli

When advancing in our careers as developers, we come across some questions about the structure of our software. Before long, the main question about solving a problem is not about what to do anymore, but how to do it elegantly. We start looking for better development tactics and how to make our code mode readable and easier to maintain. Not only because it’s more elegant, but doing so can significantly save us time, as sometimes we spend more time trying to understand it than really writing it. In this self-development journey, everything is beautiful. In this article, I’ll share how you can use the SOLID principles to make your code flexible and maintainable.

Published in SOLID Foundations, November 2020