Implementing Agile Engineering Practices in Legacy Codebases

schedule Mar 26th 01:30 PM - 02:15 PM place Grand Ballroom 1

Afraid of legacy code? Don't be!!!

Most successful product companies are confronted with the problem of legacy code.

What is a legacy code?

  • A code which is in production for several years.
  • A super-complex, hard to understand code base, written by different set of developers. 
  • Outdated Technology stack.

But the most hurting reality is:

Lack of confidence in the code due to zero or poor test coverage.

Due to this reality, developers are often scared to touch it. They have very little confidence that "their code change wouldn't break the existing application in production."

Recently at IDeaS, we came across such situation, where we needed to enhance one of our products containing legacy code. We started looking into the code and soon figured out that it was developed in 2007, hardly ever touched (& still working in production :)). The original team, which has worked on this product, could not be traced anymore.

As this product has expanded to attract new customers, we had to change it significantly in order to support new customer's specifications. We had to make sure that the product was backward compatible and supported the earlier specifications, while we enhance the new specification.

One simple option was to COPY PASTE every single method which needs to be modified and use an if-statement to decide which method to call. This certainly seems like an easy method, since the chances of breaking existing code is very little. 

Today we all know this is a BAD option!!!

Instead, our team decided to refactor the existing code to support plug-and-play approach for different specification. But before we started refactoring code, we had to build a safety net of tests around the existing code.

How do we put the safety net? Ideal way would be to implement the Test Pyramid first. But, that would have taken significant time to be ready with the pyramid before we start touching the legacy code. And obvious, we would have missed the business goals.

What do we do?

Instead of building the entire test pyramid, we decided to attack different layers of the test pyramid, one at a time. Along the way, we followed the following approach:

  1. Re-structuring the Project code-base
  2. Establishing a baseline database: After taking a dump from the production database, we cleared out surplus data from the DB and setup a seed database with automed scripts
  3. Creating/fixing the build script 
    1. Setting up an auto DB deploy tool and integrating it with build scripts
  4. Set up basic CI pipeline
  5. Write a few work-flow tests to capture the system's flow from user's point of view
    1. Find the inception point in the code from where we can exercise the code
    2. Restify the application at the inception point (one service at a time)
    3. Setup authorization for production and test environment
    4. Build minimal test-data set for different environment 
    5. Create a few work-flow tests via the inception point (Test itself should not be coupled with the underlying database or implementation level components)
  6. Write business logic acceptance test to capture various complicated business rules
  7. Test drive the new enhancement or bug fixes
  8. Every time we touch legacy code, refactor the code and improve test coverage at unit level

This really helped us test driven the new code and implement all the layers of the test pyramid.

If you've a similar situation, join us, as we share our experience on how to confront legacy code.

 
11 favorite thumb_down thumb_up 6 comments visibility_off  Remove from Watchlist visibility  Add to Watchlist
 

Outline/structure of the Session

  • Intro + Our Legacy Code Context (5 Min)
  • Our challenges & approach we took (15 mins)
  • The journey to overcome the difficulties (will share code snippets)  ( 15 mins)
  • New Challenges we faced, how we resolved them and Road ahead (5 mins)
  • Questions ( 5 min )

Learning Outcome

  • Legacy code is fact of Software Industry & we cannot run away from it.
  • Management won't give us time to implement Test Pyramid but still how we can start putting the foundation for the test pyramid in place.
  • Typical challenges the team will be confronted  when dealing with legacy code & how to over come them.
  • How to create just enough test pyramid, that will give us confidence to touch the legacy code.
  • While just enough is 'sufficient' to get started. How and when will the final Test Pyramid take shape?

Target Audience

Developers, Testers, Managers, Product Owners

schedule Submitted 2 years ago

Comments Subscribe to Comments

comment Comment on this Proposal
  • Tathagat Varma
    By Tathagat Varma  ~  2 years ago
    reply Reply

    Prasad - can you share more details on what exactly did you guys do, and what were the measures of success before and after the change? 

    -TV

    • Prasad Kunte
      By Prasad Kunte  ~  2 years ago
      reply Reply

      Hi Tathagat,

      Thanks for going through.

      Business requirement was to change the code significanlty to support new clients while making sure that earlier client are supported as well. With minimal test cases (& most of them were broken), our puzzle was: "how do we make sure that earlier clients are not impacted after changing the code"

      Ideal approach was to have safety net/ Test pyramid first starting from UNIT coverage. But that would have taken us enourmous amout of time. So we thougt that instead of having bottoms-up approach (in test pyramid) lets have few Workflow test cases first for the existing code. That would give us @ least the higher level feedback for existing client's functionlity breakage when we touch new code.

      Once we had that, there was some confidence to start touching the code. For the modified code, writing test cases and making sure that they run in jenkins, was implicit. 

      We are on our way to build the right safety net. Interesting thing was how do we started building it.

      Thanks,

      -Prasad-

    • Prasad
      By Prasad  ~  2 years ago
      reply Reply

      Prasad,

      I am trying to understand it better.. Are you saying we can bring test coverage and a saftey net for legacy code?

      ~~PP

      • Prasad Kunte
        By Prasad Kunte  ~  2 years ago
        reply Reply

        Hey PP,

        Yes, we can certainly bring safety net for legacy code. I feel that's the need in software world due to the fact majority of the code which is running on production was written many years.

        It's a challege and certainly a hard way but IMHO that its very much required.

        Thanks,

        -Prasad-

  • Niranjan N V
    By Niranjan N V  ~  2 years ago
    reply Reply

    Hi Prasad,

    Did you see any quantifiable improvement ? If so, any specific test metrics used to measure the improvement (past v/s current).

     

    Regards

    Niranjan

    • Prasad Kunte
      By Prasad Kunte  ~  2 years ago
      reply Reply

      Hi Niranjan,

      Quick feedback if something breaks for Earlier Specification & confidence of developers to touch the legacy code is what I can see upfront. 

      But as we proceed, I would certainly share the jenkins screen shots to show the progress on the safety net.

      Thanks,

      -Prasad-


  • Liked Naresh Jain
    keyboard_arrow_down

    Naresh Jain - IAmA (I Am A ... Ask Me Anything)

    Naresh Jain
    Naresh Jain
    Founder
    ConfEngine.com
    schedule 2 years ago
    Sold Out!
    60 Mins
    Keynote
    Beginner

    On Reddit, IAmA stands for "I am a" and AMA stands for "ask me anything".

    In an IAmA post, a person will post what they are, and other people will ask the original poster some questions to gain insights about the experience the person has had.
     
    Ex: I'm Jeff Patton, creator of Story Mapping, Ask Me Anything... OR I'm Diana Larsen, co-creator of the Fluency Model and co-author of Agile Retrospectives, Ask Me Anything...

    We plan to take this concept and apply it to the Agile context. We've few luminaries at the conference and we plan to do an live interview with them using this format.

  • Aslak Hellesøy
    Aslak Hellesøy
    Founder
    Cucumber Limited
    schedule 2 years ago
    Sold Out!
    60 Mins
    Keynote
    Intermediate

    As lead developer of Cucumber and author of The Cucumber Book, Aslak gets asked to consult with organisations who want to introduce Behaviour-Driven Development (BDD). Time after time, he meets teams who are trapped doing half-arsed agile. They do the easy, obvious, visible agile practices, and none of the powerful, hard-to-master, hard-to-see ones.

    When these teams ask for help learning BDD, we get a chance to remind them how important conversations and collaboration are in software development. We teach them to write tests before they write code, as a way to explore and discover the hidden details of a requirement just before they dive in and start building it. This talk will make you wince with recognition, laugh with despair, and finally inspire you with stories of teams that have finally, after years of flaccid scrumming, discovered the true collaborative heart of agile software development. You’ll see patterns you recognise from your own teams, and gain insights about how to fix them.

  • Naresh Jain
    Naresh Jain
    Founder
    ConfEngine.com
    schedule 2 years ago
    Sold Out!
    45 Mins
    Talk
    Intermediate

    As more and more companies are moving to the Cloud, they want their latest, greatest software features to be available to their users as quickly as they are built. However there are several issues blocking them from moving ahead.

    One key issue is the massive amount of time it takes for someone to certify that the new feature is indeed working as expected and also to assure that the rest of the features will continuing to work. In spite of this long waiting cycle, we still cannot assure that our software will not have any issues. In fact, many times our assumptions about the user's needs or behavior might itself be wrong. But this long testing cycle only helps us validate that our assumptions works as assumed.

    How can we break out of this rut & get thin slices of our features in front of our users to validate our assumptions early?

    Most software organizations today suffer from what I call, the "Inverted Testing Pyramid" problem. They spend maximum time and effort manually checking software. Some invest in automation, but mostly building slow, complex, fragile end-to-end GUI test. Very little effort is spent on building a solid foundation of unit & acceptance tests.

    This over-investment in end-to-end tests is a slippery slope. Once you start on this path, you end up investing even more time & effort on testing which gives you diminishing returns.

    In this session Naresh Jain will explain the key misconceptions that has lead to the inverted testing pyramid approach being massively adopted, main drawbacks of this approach and how to turn your organization around to get the right testing pyramid.

  • Liked Dhaval Dalal
    keyboard_arrow_down

    Dhaval Dalal / Naresh Jain - The Tao of Transformation

    90 Mins
    Workshop
    Beginner

    "To know, is good. To live, is better. To be, that is perfect." - The Mother

    During the Agile adoption, its a common complain that many team in many organizations get caught up in the ceremonies or mechanics of Agile and fail to understand/appreciate the true value and spirit of Agile. And because of this, the original intent of the Agile movement itself is lost. This is a serious issue!

    This workshop will highlight, a well-proven approach to transformation (not adoption) and show the distinct steps in this journey that an individual or a collective goes through when learning anything new. Activities, serving as examples, in the workshop, will focus to show the journey - that is, how to begin with rituals, then gradually move to practices, arriving at principles and eventually internalizing the values. Witnessing this gradual process of transformation will help participants discover for themselves their current progression. We hope this will serve as a guiding light during their Agile journey.

    Finally, we will leave the participants to ponder upon and discover for themselves their ideals in life and work as this is not only applicable to software development, but also to any discipline where humans are involved, including life itself.

  • Liked Naresh Jain
    keyboard_arrow_down

    Naresh Jain - Sell Before you Build (MVP Hacks)

    Naresh Jain
    Naresh Jain
    Founder
    ConfEngine.com
    schedule 2 years ago
    Sold Out!
    60 Mins
    Case Study
    Intermediate

    Before you write any code, make sure you have a failing test." This was a revolutionary idea, when it was first pitched in the late 90’s. Many successful entrepreneurs have been practicing a similar approach - "Before you build a product/service, make sure you have paying customers." In this talk, Naresh Jain shares his approach of finding effective MVPs to validate his Educational Product and why Agile Methods simply fail to do so. If you are interested in finding out how to maximise your validated learning for minimum investment, then this session is for you. Recently Naresh's article on this topic was published by InfoQ.

  • Liked Sachin Natu
    keyboard_arrow_down

    Sachin Natu / Naresh Jain - Death of Inspection: Reincarnation of the Testing Community

    60 Mins
    Case Study
    Intermediate

    Adopting agile development practices and continuous delivery is becoming a norm in the software industry. Time to market and frequent releases have drastically reduced time available for regression testing. Inspection is considered wasteful. Faster feedback cycles during development is crucial. These have created lot of challenges for testing community, which traditionally relies on manual testing assisted by UI based test automation.

    This is an experience report of transforming testing practices across organization, which decided to embrace Agile. Today our testers are not trying to find defects, instead they collaborate with product management and developers to prevent them in the first place. In fact, during the appraisal process, the defects found by them is ignored, instead we focus on how much time they are able to dedicate to collaboration and exploratory testing. The boundaries between developers and testers have faded away and today quality is whole team's responsibility.

    We started with less than 20% of our testers with automation skills (mostly UI automation) and rest of them relying on manual testing. However, today, all our testers practice BDD. They have picked up Java & Groovy programming skills. They are able to contribute Workflow tests, Integration tests and Business Logic Acceptance Tests. Early collaboration and pairing is the norm. By the time developers are done with their tasks, all checks are already automated and hence we are able to deploy software every fortnight to production.

    Are your testers finding it hard to make this transition to an Agile mindset? This session will give you some concrete ideas based on our transition at IDeaS.  

  • Liked Ashish Parkhi
    keyboard_arrow_down

    Ashish Parkhi / Naresh Jain - Techniques to Speed Up your Build Pipeline for Faster Feedback.

    45 Mins
    Experience Report
    Intermediate

    We would like to share our experience and journey on how we brought down our Jenkins build pipeline time down from over 90 minutes to under 12 minutes. In the process, we would share specific techniques which helped and also some, which logically made sense, but actually did not help. If your team is trying to optimize their build times, then this session might give you some ideas on how to approach the problem.

    Development Impact - For one of our build job, below graph shows how the number of builds in a day have increased over a period of time as the build time has reduced. Frequency of code check-in has increased; Wait time has reduced; failed test case faster to isolate and fix.

    Business Impact - More builds leading to quicker feedback and faster story acceptance and less story spill over.

  • Naresh Jain
    Naresh Jain
    Founder
    ConfEngine.com
    schedule 2 years ago
    Sold Out!
    90 Mins
    Tutorial
    Intermediate

    In order to achieve my goals, as a buyer of your product, I want awesome feature.

    AT: make sure your users stories don't get in the way.

    Users Stories, the tool teams use to break big ideas into small demonstrable deliverable, are easy to describe and challenging to write effectively. In this hands-on workshop you'll learn how to write great user stories that adhere to the INVEST principle. We'll learn various techniques to slice your stories using the vertical-slicing approach. We will discuss what elements should be included in the stories, what criteria you should keep in mind while slicing stories; why the size of your user story is important and how to make them smaller and efficient.

  • Liked Ashish Parkhi
    keyboard_arrow_down

    Ashish Parkhi / Naresh Jain - Gamifying Agile Adoption - An Experiment

    45 Mins
    Case Study
    Intermediate

    While having a chat with Naresh Jain, he suggested me to go through the Ted Talk – “Gaming can make a better world” by Jane McGonigal. I found the title very weird and was wondering how is that possible? After going through the talk though, I was amazed. I started wondering if I can use the gamification technique in Agile Adoption, in our Products, in Performance Management Systems, in Employee Engagement Programs?

    Dhaval Dalal introduced me to Prof. Kevin Werbach’s definition of Gamification – “The use of game elements and game design techniques in non-game contexts.

    For our 4th ShipIt Day, organized on 25th/26th Sept 2014 at IDeaS, I decided to explore the idea of using game elements and game design techniques in the context of Agile Adoption. The idea was to create a gaming system which will automatically collect data, i.e. without explicit user intervention,  from multiple sources like Jenkins, Rally and manually from individuals and offer Star’s for positive behavior and deduct Star’s otherwise.

    The aim was to help the team get continuous visual feedback on how they are doing, adopt agile practices, visualize sense of accountability, visualize sense of achievement, drive positive behavior, create healthy competition, create a culture of appreciation, help performance tracking and create transparency.

     

    Landing Page

    User Profile

     

     

     Update - 

    1. Deducting points seems to be bothering the individuals. Now we are experimenting with getting rid of negative points and introducing short lived badeges instead e.g. "Build Breaker". 
    2. We have now added more badges to recognize individual efforts in various categories.
    3. Working on open sourcing the core app at https://github.com/IDeaSCo/rockstar
  • Naresh Jain
    Naresh Jain
    Founder
    ConfEngine.com
    schedule 2 years ago
    Sold Out!
    45 Mins
    Talk
    Intermediate

    Why do we see new process or methodology or movement every 10 years or so in the software industry? And why don't successful companies ride on their success forever? Naresh Jain uses the Adaptive Change Cycle (ACC) to explain the rationale behind it. Once you understand ACC, this talk will help you understand how to prepare yourself and your organisation to quickly move through the 4 stages of ACC: reorganise, exploit, conserve and release to constantly keep innovating. If you feel agile methods are stagnating and looking for what to expect next, this talk might give you some ideas.

  • Liked Vijay Bandaru
    keyboard_arrow_down

    Vijay Bandaru - Lean and Kanban Implementation from Trenches

    Vijay Bandaru
    Vijay Bandaru
    Agile Coach
    IVY Comptech
    schedule 2 years ago
    Sold Out!
    20 Mins
    Experience Report
    Intermediate

    I was part of a Large Scale Agile transformation in my organization and I was one of the Agile coaches there. As part of transformation we have created LeanOps teams to manage the technical debt, production incidents with a focused concentration. This article covers the following:

     

    - Why the trasnformation required?

    - What are the structural changes implemented?

    - LeanOps inception

    - Lean Ops working Model

    - Challenges with the LeanOps

    - How we addressed those challenges?

    - Goal oriented approach

    - Q & A

  • 60 Mins
    Talk
    Advanced

    There is a world of difference between the management principles in the era of the Industrial revolution to the current world of information revolution. We need to acknowledge the increasing gap between the way employees are being managed at work, and the way they want to be managed. Many surveys have been done in this area, ending in headlines like “6 out of 10 employees are miserable” and “74 percent of staff not engaged at work.” Dig into these surveys and you’ll see the quality of leadership on top of the list of complaints. The poor state of leadership and management skills in organizations is being driven by a broad range of factors, including but not limited to

    The changed nature of work - More of skill and innovation

    The increasing education of employees - Continuous improvement and learning needs

    The needs of later generations - The more sofisticated needs of the system

    The pace of change - The quick pace of changes

    In the current “rat race”, the management focusses on higher productivity and higher ROI, but they lack the capacity to “motivate” their employees that can take them to the next level of thinking. The "leaders" do not understand the subtle difference between teaching, mentoring and coaching. They use these words interchangeably without realizing that coaching teams can help them to increase the productivity, morale and create great employees resulting in more successful products.

    A new coaching model is required to enable continous improvement with quick feedback cycles that fosters adaptability and innovation.

    Two relevant quotes which I can relate to this issue are

    "It is people who build organizations and not organizations who make people" - unknown

    "Beware of little expenses; a small leak will sink a great ship" - Benjamin Franklin