Side Effect Injection, or The virtuous duct tape
Remember the time when you have accidentally (or not) sent to production a piece of code meant to be for test only? Or temporarily put a tiny “if”, for instance, with Thread.sleep() or logging for debugging? You are not alone. There is a numerous number of tasks, after the solution of which the test/debugging code goes to production, becoming a time bomb waiting to explode, increasing technical debt and spoiling developer’s karma along the way.
In this talk, we’ll go into the details of Side Effect Injection approach, that will allow you to implement almost any behavior into the testing application: delays, stubs, logging, security bypass and so on, and yet not mess up the repository with hacks and even not reassemble the application itself.
During the talk, we’ll look at the Java code compilation variants, dig into one bytecode modification case in JVM, dissect Java formal grammar, and then play with it all using a real application as an example.
Starting with school years Vladimir was enthusiastic about programming and since then has managed to code everything: from Soviet programmable calculators to modern SCADA systems in production. For the last several years he has been involved into backend development of Internet banking and other follow-up services at CFT (Center of Financial Technologies), where he actively stands for microservices and other popular things. Constantly bothers with ideas about optimization of difficult development/server software testing tasks, nurtures solutions for them while jogging or swimming and then puts them into life, experimenting shamelessly on his colleagues.