Skip to main content

Posts

Unit Testing is overrated

Unit testing is a popular approach for testing software, but mostly for the wrong reasons. It’s often touted as an effective way for developers to test their code while also enforcing best design practices, however many find it encumbering and superficial.It’s important to understand that development testing does not equate to unit testing. The primary goal is not to write tests which are as isolated as possible, but rather to gain confidence that the code works according to its functional requirements. And there are better ways to achieve that.Writing high-level tests that are driven by user behavior will provide you with much higher return on investment in the long run, and it isn’t as hard as it seems. Find an approach that makes the most sense for your project and stick to it.Here are the main insights:Think critically and challenge best practicesDon’t rely on the test pyramidSeparate tests by functionality, rather than by classes, modules, or scopeAim for the highest level of int…
Recent posts

Book Summary : Designing Data Intensive Applications by Martin Kleppmann

I. 4 fundamental ideas that we need in order to design data-intensive applications.Reliable, scalable, maintainable applications.Reliability means continuing to work correctly, even when things go wrong. Common faults and preventions include:Hardware faults: hard disks crash, blackout, incorrect network configuration,…Add redundancy to individual hardware components to reduce the failure rate.As long as we can restore a backup onto a new machine quickly, the downtime is not fatal.Software faults: bug, out of shared resources, unresponsive service, cascading failure,…There’s no quick solution other than thorough testing, measuring, monitoring, analyzing.Human errors: design error, configuration error,…Enforce good design, good practice and training.Decouple the places where people make the most mistake.Automate testing: unit test, integration test, end-to-end test.Allow quick recovery rollback strategy.Set up detials monitoringScalability describes a system’s ability to cope with incre…

Relatively speaking, the billionaire isn't rich. It's all relative

TakeawaysInvesting is about relative, not absolute performanceTechnology competition is about relative, not absolute strengthSociety is about relative, not absolute status 1. Don't bet on the most likely winnerImagine you're an investment analyst [1].Investment analysts research companies and decide which stocks to buy or sell. You've done your work on Tencent, a chinese internet company, concluding that the business, management, and macro trends all look good. Gaming and online entertainment will continue increasing in importancethe executive team is experienced, and population growth provides a tailwind for at least ten years.You model all of that up in excel. Write a simple 5 page investment memo. Prepare 50 pages of backpocket complicated charts just in case [2].Convinced of your brilliance and diligence, you pitch your boss on Tencent. You time your meeting perfectly, a little after he's been in the office, but before he's busy looking up summer vacation home…

One Pull Request. One Concern

Mirror of: https://medium.com/@fagnerbrack/one-pull-request-one-concern-e84a27dfe9f1Git has a command called git-request-pull. The purpose of the command is to prepare a set of commits so that the owner of a copy of a project can request to the owner of another copy to land a small set of changes. The idea is to be able to share a piece of functionality with the owner of a more trusted version of the project, without requiring additional write access. This opens a wide range of opportunities for collaboration: anyone can clone a trusted project, make changes, and then ask the original author to land those changes.When Github came out, it leveraged the philosophy of Git and "forked" the idea behind git-request-pull. The purpose was to create an abstraction on top of it so that those who are not familiarized with Git could understand and apply the philosophy of collective collaboration without having to setup mailing lists.They called it Pull Request.A Pull Request serves a si…

Advice to young web developers

I’ve been making websites in some form or another since 2008. After 12 years of experience I think I’ve accumulated enough knowledge to know a few things. Here’s some things I’d like younger developers to think about, in no particular order:Sometimes a website is just a website.The browser is already a client; HTML is its language.The web is built around server-side rendering.You can provide your data in more than one way; consider HTML to be one of several possible data representations.Scaling your server helps everyone. Expecting client-side scaling only helps people with the fastest computers and Internet connections.Not everyone has (or can use) a mouse.Not everyone has (or can use) a keyboard.Not everyone has (or can use) a touchscreen.Not everyone can see colors or pictures the same way you can.Not everyone can process information the same way you do.It is inhumane to move things around on people.The browser’s native HTML parsing is far faster than anything you can write in Java…

The ultimate guide to debugging in Python

Even if you write clear and readable code, even if you cover your code with tests, even if you are very experienced developer, weird bugs will inevitably appear and you will need to debug them in some way. Lots of people resort to just using bunch of print statements to see what's happening in their code. This approach is far from ideal and there are much better ways to find out what's wrong with your code, some of which we will explore in this article.
Logging is a MustIf you write application without some sort of logging setup you will eventually come to regret it. Not having any logs from your application can make it very difficult to troubleshoot any bugs. Luckily - in Python - setting up basic logger is very simple:
import logginglogging.basicConfig(filename='application.log',level=logging.WARNING,format= '[%(asctime)s] {%(pathname)s:%(lineno)d} %(levelname)s - %(message)s',datefmt='%H:%M:%S')
logging.error("Some serious error occurred.")log…