What Are Three Different Changes That You Might Be Required To Perform On Existing Software?ã¢â‚¬â€¹
The old aphorism, "If it ain't broke, don't fix it," doesn't necessarily utilize in the case of engineering. Projects continually crave alterations, updates, and enhancements. This chapter outlines the nature of lawmaking change, and suggests some of the challenges to be faced when making these changes.
This chapter is from the book
Changing code is slap-up. It's what we exercise for a living. But there are means of changing code that make life difficult, and there are means that brand it much easier. In the industry, we haven't spoken about that much. The closest we've gotten is the literature on refactoring. I think we can augment the discussion a bit and talk about how to deal with code in the thorniest of situations. To exercise that, we take to dig deeper into the mechanics of modify.
4 Reasons to Change Software
For simplicity'south sake, let'southward wait at iv primary reasons to change software.
-
Adding a characteristic
-
Fixing a bug
-
Improving the design
-
Optimizing resource usage
Adding Features and Fixing Bugs
Adding a characteristic seems like the most straightforward type of alter to make. The software behaves one way, and users say that the system needs to practice something else also.
Suppose that we are working on a web-based application, and a manager tells us that she wants the visitor logo moved from the left side of a page to the right side. We talk to her about it and discover it isn't quite and so simple. She wants to move the logo, just she wants other changes, too. She'd like to arrive animated for the next release. Is this fixing a problems or adding a new feature? It depends on your betoken of view. From the signal of view of the customer, she is definitely request us to fix a trouble. Possibly she saw the site and attended a meeting with people in her department, and they decided to alter the logo placement and ask for a bit more functionality. From a developer's indicate of view, the alter could exist seen as a completely new feature. "If they simply stopped changing their minds, nosotros'd be done past now." But in some organizations the logo motion is seen as simply a problems ready, regardless of the fact that the team is going to have to practice a lot of fresh work.
Information technology is tempting to say that all of this is just subjective. Yous run into it as a bug set up, and I encounter information technology as a feature, and that's the cease of it. Sadly, though, in many organizations, bug fixes and features take to be tracked and accounted for separately because of contracts or quality initiatives. At the people level, we can go back and along endlessly about whether we are adding features or fixing bugs, just information technology is all just changing code and other artifacts. Unfortunately, this talk about bug-fixing and characteristic addition masks something that is much more important to us technically: behavioral change. There is a big difference between adding new behavior and changing quondam behavior.
Beliefs is the near important affair virtually software. Information technology is what users depend on. Users like information technology when we add behavior (provided it is what they really wanted), but if we change or remove behavior they depend on (introduce bugs), they finish trusting us.
In the company logo example, are we adding behavior? Yep. Afterward the change, the system will display a logo on the correct side of the page. Are nosotros getting rid of whatever behavior? Yes, there won't exist a logo on the left side.
Let's look at a harder case. Suppose that a client wants to add a logo to the right side of a folio, but in that location wasn't i on the left side to start with. Yes, we are adding beliefs, but are we removing any? Was anything rendered in the place where the logo is well-nigh to be rendered?
Are we changing behavior, adding it, or both?
It turns out that, for us, we tin draw a distinction that is more useful to usa as programmers. If we have to modify code (and HTML kind of counts equally lawmaking), we could be changing beliefs. If we are only adding code and calling it, we are often adding behavior. Let'southward wait at another example. Here is a method on a Coffee grade:
public course CDPlayer { public void addTrackListing(Track rail) { ... } ... }
The class has a method that enables us to add runway listings. Permit's add another method that lets us supersede rails listings.
public class CDPlayer { public void addTrackListing(Track rails) { ... } public void replaceTrackListing(String proper name, Track track) { ... } ... }
When we added that method, did we add new behavior to our application or change information technology? The answer is: neither. Adding a method doesn't change behavior unless the method is called somehow.
Allow'due south brand some other lawmaking change. Let'south put a new button on the user interface for the CD role player. The button lets users replace track listings. With that motility, we're adding the beliefs nosotros specified in replaceTrackListing method, but nosotros're too subtly changing behavior. The UI will render differently with that new push button. Chances are, the UI volition take about a microsecond longer to brandish. It seems virtually incommunicable to add beliefs without changing it to some degree.
Improving Design
Design improvement is a unlike kind of software change. When we want to alter software's structure to get in more maintainable, mostly nosotros want to keep its behavior intact also. When we driblet behavior in that process, we often call that a bug. One of the primary reasons why many programmers don't attempt to meliorate design often is because it is relatively piece of cake to lose behavior or create bad beliefs in the process of doing information technology.
The human action of improving design without changing its behavior is called refactoring. The thought backside refactoring is that we can make software more maintainable without irresolute beliefs if we write tests to make certain that existing behavior doesn't change and take small steps to verify that all along the process. People have been cleaning up code in systems for years, but only in the concluding few years has refactoring taken off. Refactoring differs from general cleanup in that we aren't simply doing low-run a risk things such as reformatting source code, or invasive and risky things such as rewriting chunks of it. Instead, nosotros are making a series of minor structural modifications, supported past tests to make the code easier to change. The cardinal thing about refactoring from a change indicate of view is that at that place aren't supposed to exist any functional changes when you refactor (although behavior can alter somewhat considering the structural changes that you brand can alter functioning, for better or worse).
Optimization
Optimization is like refactoring, but when nosotros do it, we have a different goal. With both refactoring and optimization, we say, "We're going to proceed functionality exactly the same when we make changes, only we are going to change something else." In refactoring, the "something else" is plan structure; nosotros desire to make it easier to maintain. In optimization, the "something else" is some resources used past the plan, ordinarily time or retentiveness.
Putting It All Together
It might seem strange that refactoring and optimization are kind of like. They seem much closer to each other than adding features or fixing bugs. Only is this really true? The affair that is common betwixt refactoring and optimization is that we concur functionality invariant while we let something else alter.
In general, three different things can change when we do work in a arrangement: structure, functionality, and resource usage.
Let'south look at what usually changes and what stays more or less the same when nosotros make four different kinds of changes (yes, often all three change, but let's look at what is typical):
Adding a Feature | Fixing a Issues | Refactoring | Optimizing | |
---|---|---|---|---|
Structure | Changes | Changes | Changes | — |
Functionality | Changes | Changes | — | — |
Resource Usage | — | — | — | Changes |
Superficially, refactoring and optimization do await very like. They hold functionality invariant. Simply what happens when we account for new functionality separately? When nosotros add a feature frequently nosotros are calculation new functionality, but without irresolute existing functionality.
Adding a Characteristic | Fixing a Bug | Refactoring | Optimizing | |
---|---|---|---|---|
Structure | Changes | Changes | Changes | — |
New Functionality | Changes | — | — | — |
Functionality | — | Changes | — | — |
Resource Usage | — | — | — | Changes |
Adding features, refactoring, and optimizing all hold existing functionality invariant. In fact, if we scrutinize bug fixing, yep, it does alter functionality, but the changes are often very minor compared to the amount of existing functionality that is not altered.
Characteristic addition and bug fixing are very much like refactoring and optimization. In all four cases, nosotros want to change some functionality, some behavior, but we want to preserve much more (meet Effigy ane.ane).
Effigy 1.1 Preserving behavior.
That'south a nice view of what is supposed to happen when nosotros make changes, merely what does it mean for us practically? On the positive side, information technology seems to tell usa what nosotros have to concentrate on. Nosotros have to make sure that the small number of things that we alter are inverse correctly. On the negative side, well, that isn't the but matter we accept to concentrate on. We accept to figure out how to preserve the residue of the behavior. Unfortunately, preserving it involves more than simply leaving the code solitary. Nosotros have to know that the behavior isn't changing, and that can be tough. The amount of behavior that we have to preserve is unremarkably very large, just that isn't the big bargain. The big bargain is that nosotros often don't know how much of that behavior is at risk when we brand our changes. If we knew, we could concentrate on that behavior and non care about the remainder. Understanding is the key thing that we need to brand changes safely.
Preserving existing behavior is one of the largest challenges in software development. Even when nosotros are irresolute primary features, nosotros oftentimes take very large areas of beliefs that we have to preserve.
Source: https://www.informit.com/articles/article.aspx?p=359418
Posted by: bartleytheds1985.blogspot.com
0 Response to "What Are Three Different Changes That You Might Be Required To Perform On Existing Software?ã¢â‚¬â€¹"
Post a Comment