调试代码遗留_陷入遗留代码地狱吗? 这里有一些想法可以帮助您处理情况
调试代码遗留
by Felipe Lopes
通过Felipe Lopes
陷入遗留代码地狱吗? 这里有一些想法可以帮助您处理情况 (Stuck in legacy code hell? Here are some few thoughts to help you manage the situation)
I’m gonna tell you a little story about how I ended up in a legacy code project and how our team managed to get the best from that.
我将向您介绍一个有关我如何结束遗留代码项目以及我们的团队如何从中获得最大收益的小故事。
首先,一点背景 (First, a little bit of context)
I’ve been working for almost a year on a project, that is quite complex, to say the least.
至少可以说,我已经在一个项目上工作了将近一年,这个项目非常复杂。
While I pass the time reading here at Medium about all the awesome things people are doing around the world in software engineering (creating big infrastructures, putting together several cutting-edge systems to respond to thousands of requests per second ), part of my daily life as a software engineer has not been-so-glamorous. Which is to keep an old extension, for an old platform, up and running properly.
当我花时间在Medium上阅读有关人们在软件工程领域正在做的所有令人敬畏的事情(创建大型基础架构,将几个尖端系统组合在一起以每秒响应数千个请求)时,这是我日常生活的一部分作为软件工程师并没有那么出色。 这是为旧平台保留旧扩展,并正常运行。
To put it in plain English, I suffer with legacy code.
用通俗易懂的英语来表达,我受制于遗留代码。
First, let me tell you about the bright stack. This extension is meant to run in one of the most important e-commerce platforms, Magento. But Magento released a new version of the platform (2.0), with lots of improvements, implementing most of the good practices, backend developers were hoping to see.
首先,让我告诉您有关明亮堆栈的信息。 此扩展旨在在最重要的电子商务平台之一Magento中运行 。 但是Magento发布了该平台的新版本(2.0),进行了许多改进,实现了大多数优秀实践,后端开发人员希望看到这一点。
For me, it would be great if the extension was made for the latest Magento version, but the extension was developed for the previous version (1.9). An archaic one, lots of times unnecessarily complex, cumbersome and full of intricate xml files. But it does the job. Oh, boy, it does!
对我而言,如果扩展是针对最新的Magento版本进行的,那将是很棒的,但是该扩展是针对先前版本(1.9)开发的。 一个古老的文件,很多时候都不必要地复杂,繁琐并且充满了复杂的xml文件。 但这确实起作用。 哦,男孩,确实如此!
Besides that, the extension, as you may be expecting, is written in PHP, the language everyone loves to hate.
除此之外,正如您所期望的那样,该扩展是用PHP编写的,PHP是每个人都喜欢讨厌的语言。
Although PHP has gained lots of improvements with the latest 7.x version, Magento 1.9 does not support it and I’m forced into working with old PHP versions. Thus, I’m unable to play with all the new stuff. To finish explaining the scenario, there is not a single piece of test. Neither I, nor anyone in the team, was part of the original extension design and development. In the beginning we were kind of lost, most of the time.
尽管PHP在最新的7.x版本中获得了很多改进,但是Magento 1.9不支持它,因此我不得不使用旧PHP版本。 因此,我无法使用所有新内容。 为了完成对场景的解释,没有一项测试。 我和团队中的任何人都不是原始扩展设计和开发的一部分。 一开始,大多数时候我们都迷路了。
圈内奔跑和尖叫不是一种选择 (Running in circles and screaming is not an option)
When you start working in a project like this, you feel like those guys playing the last song in the Titanic. Everything is falling apart, but you keep doing your job.
当您开始在这样的项目中工作时,您会感觉像是那些家伙正在播放《泰坦尼克号》中的最后一首歌。 一切都崩溃了,但是您继续做自己的工作。
The clients keep opening tickets, the problems never seem to be solved at all. Your boss ask for new features. You start blaming the platform, the code base (someone you don’t even know wrote and you start hating them for that). At this point you are deep down in the legacy hell.
客户不断开票,这些问题似乎根本没有解决。 您的老板要求新功能。 您开始责怪平台和代码库(甚至您都不认识的人都开始为此而恨之入骨)。 在这一点上,您已经陷入了地狱的深渊。
There are actually two things you can do here. The first one is to update your Linkedin profile, put a nice photo, tell a nice story about how good you are and start sending resumés. Looking for a new job, a job without legacy code (spoiler alert, this place does not exist) or you can stop, breath and make a plan to deal with that thing.
您实际上可以在这里做两件事。 第一个是更新您的Linkedin个人资料,贴上一张漂亮的照片,讲述一个关于自己的好故事,然后开始发送简历。 寻找新的工作,没有遗留代码工作(扰流警报,这个地方不存在),或者你可以停止,呼吸和制定一个计划,以对付那个东西。
开始做一些事情 (Start doing something about it)
If you are in a scenario like this, you should start acting fast. If your code base is not under a source code version system (git, please) and your team does not use a tool to manage the tasks, maybe you should think about that Linkedin stuff. But if you have the minimum, start with the basic, remove the cruft.
如果您处于这种情况,则应该开始快速采取行动。 如果您的代码库不在源代码版本系统(请使用git)下,并且您的团队未使用工具来管理任务,则也许您应该考虑使用Linkedin。 但是,如果您有最低要求,请从基本开始,删除残留物 。
I’m pretty sure that there is deprecated code, code that is not reached at all, and code that was left behind. Just taking space and making things look like a lot worse than it actually is. Give that code a good look, tinker with it, fill it with break points and start getting rid of what is not being used. Make sure you are not doing anything stupid here and don’t exaggerate. Remember, there is no test yet, so only get rid of those methods you are completely sure are useless.
我很确定有不推荐使用的代码,根本没有到达的代码以及留下的代码。 仅占用空间并使事情看起来比实际情况差很多。 给该代码一个好的外观,修改它,用断点填充它并开始摆脱不被使用的内容。 确保您在这里没有做任何愚蠢的事情,并且不要夸大其词。 记住,还没有测试,所以只有摆脱那些完全确定没有用的方法。
Doing that, you’ll be more comfortable with your code base and you will probably feel more confident. After that, you will still have unnecessary code, but almost everything you have there has meaning, or is useful.
这样做,您将对代码库更加满意,并且可能会感到更加自信。 在那之后,您仍然会拥有不必要的代码,但是您在那里拥有的几乎所有东西都具有意义或有用。
The next step is to think about tests. There are several ways to test software. You can do unitary tests, integration tests, system tests, stress tests, and plenty more. They are great and should be used in the right time. But remember, you are in a critical moment here and you should start with what is really important. Functional tests.
下一步是考虑测试。 有几种测试软件的方法。 您可以进行整体测试,集成测试,系统测试,压力测试等等。 它们很棒,应该在正确的时间使用。 但是请记住,您现在处于关键时刻,应该从真正重要的事情开始。 功能测试。
I’m not the most skilled tester. Far from that. I still have a lot to learn and study. But as far as I know, functional tests (for web projects, at least) are the least invasive ones. You don’t have to create mocks, stubs, fakes, dummies. Your tests are going to interact with the browser and simulate the human interaction.
我不是最熟练的测试人员。 远非如此。 我还有很多东西要学习。 但是据我所知,功能测试(至少针对Web项目)是侵入性最小的测试。 您不必创建模拟,存根,假货,假人。 您的测试将与浏览器交互并模拟人工交互。
At this point you have a code base with only the code that is needed and few tests to help you stop adding new bugs with every new feature. It is a win-win situation. Now you can stop, breath and think more calmly.
此时,您的代码库仅包含所需的代码,并且几乎没有测试可帮助您停止在每个新功能中添加新的错误。 这是双赢的局面。 现在您可以停下来,喘口气,更加冷静地思考。
接下来是什么? (What next?)
With more time, less bugs and sanity in place, you can start tackling other problems. Have you thought about continuous integration? How is your team development workflow? If you are using git (which I hope), you could start planning your branches. Create a master branch, a develop branch, add new features through feature branches, hot fix branches, and so on.
有了更多的时间,更少的错误和理智的解决方案,您就可以开始解决其他问题。 您是否考虑过持续集成? 您的团队开发工作流程如何? 如果您正在使用git(希望如此),则可以开始计划分支。 创建一个master分支,一个develop分支,通过Feature分支,Hot Fix分支等添加新功能。
How is your continuous delivery? How are your versions created? If you have to do more than “pushing a button”, maybe it is time to think about that process. How could you make it more reliable, less error prone? Does your application generate enough logs? Could you improve that? Now it is time to create a better software, now it is up to you.
您如何连续交货? 如何创建您的版本? 如果您要做的不仅仅是“按下按钮”,也许是时候考虑一下该过程了。 您如何使它更可靠,更不易出错? 您的应用程序是否生成足够的日志? 你能改善吗? 现在该创建一个更好的软件了,这取决于您。
而已 (That’s it)
We are still working on our legacy, trying to make it better. Although we haven’t reached the ideal scenario yet, several things have changed. Now we have only the necessary code. The workflow for that particular extension is well defined. We have functional tests in place and the deployment process is getting better.
我们仍在努力处理我们的遗产,力求使其更好。 尽管我们还没有达到理想的情况,但是有些事情已经改变。 现在,我们只有必要的代码。 该特定扩展的工作流程已明确定义。 我们已经进行了功能测试,并且部署过程越来越好。
After changing that scenario and surviving the legacy hell, our team got the task to develop a new extension to the same old Magento 1.9. Any sane person would be angry about that, but I’m thinking it is the perfect moment to do the right thing. This is the chance to make all the complaints become best practices and create a piece of software with maintainability in mind. but this is a subject for another article.
在改变了这种情况并在旧地狱中幸存下来之后,我们的团队获得了为相同的旧版Magento 1.9开发新扩展的任务。 任何理智的人都会对此感到生气,但是我认为这是做正确的事情的最佳时机。 这是使所有投诉成为最佳做法并创建具有可维护性的软件的机会。 但这是另一篇文章的主题。
翻译自: https://www.freecodecamp.org/news/few-thoughts-on-legacy-hell-e229f76529e0/
调试代码遗留
相关文章:

求二维数组最大子数组
结对队友:胡康臻、杨寒寒 1、设计思想: 首先定义产生二维数组,定义可输入二维数组行和列,各位数随机产生; 然后进行最大子数组的求和比较,从每行的第一个数为子数组的起点开始进行不同的子数组遍历比较&…

UVa 11021 (概率 递推) Tribles
Tribble是麻球? 因为事件都是互相独立的,所以只考虑一只麻球。 设f(i)表示一只麻球i天后它以及后代全部死亡的概率,根据全概率公式: f(i) P0 P1 * f(i-1) P2 * f(i-1)2 ... Pn * f(n)n 每个麻球死亡是独立的,所以…

积分页面布局记录
微信小程序开发交流qq群 173683895 承接微信小程序开发。扫码加微信。 正文: 、 // pages/user/my_integral/record/record.js var app getApp(); var util require("../../../utils/util.js") Page({data: {url_data: ,username: ,usertop: ,tab: 1…

uber_Uber是如何制成的
uberby Dmytro Brovkin由Dmytro Brovkin Uber是如何制成的 (How Uber was made) Uber has transformed the world. Indeed, its inconceivable to think of a world without the convenience of the innovative ride sharing service. Tracing its origins in a market which …

HTML 标签包含规范,规避脱标流,图片和文字垂直居中对齐,
1 标签包含规范 ◆div可以包含所有的标签。 ◆p标签不能包含div h1等标签。 ◆h1可以包含p,div等标签。 ◆行内元素尽量包含行内元素,行内元素不要包含块元素。 2 规避脱标流 ◆尽量使用标准流。 ◆标准流解决不了的使用浮动。 ◆浮动解决不了…

Java Socket发送与接收HTTP消息简单实现
在上次Java Socket现实简单的HTTP服务我 们实现了简单的HTTP服务,它可以用来模拟HTTP服务,用它可以截获HTTP请求的原始码流,让我们很清楚的了解到我们向服务发的HTTP消息的结 构,对HTTP请求消息有个清晰的认识。这一节我想写了一个…

微信小程序日期相减得出天数
微信小程序开发交流qq群 173683895 承接微信小程序开发。扫码加微信。 正文: // 日期结算 num_data: function (e) {var start_date new Date(this.data.start_date.replace(/-/g, "/"));var end_date new Date(this.data.end_date.replace(/-/g, &q…

es6 ... 添加属性_如何在10分钟内免费将HTTPS添加到您的网站,以及为什么您现在不止需要这样做......
es6 ... 添加属性by Ayo Isaiah通过Ayo Isaiah 如何在10分钟内免费将HTTPS添加到您的网站,以及为什么现在比以往更需要这样做 (How to add HTTPS to your website for free in 10 minutes, and why you need to do this now more than ever) Last week, Google ann…

程序员跳槽全攻略——读书笔记
有同学说,我技术很好啊,又会机器学习又会编译原理,凭什么那些写Javascript的薪水比我高一倍? 谁让你在一家建站公司上班呢。对一家做网站的公司而言,机器学习和编译原理是不能为它带来收益的,而Javascript写…
[转] Gradle: 此时不应有 Androidandroid-studiosdk oolslib\find_java.exe。解决方法
上述问题主要是java路径的问题,这里主要给出解决方案,至于为什么这么解决的,大家可以学学bat语言。想问的可以留言我。 dx.bat 根据安装目录,我的是D:\Program Files (x86)\Android\android-studio\sdk\build-tools\android-4.2.2…

微信小程序和微信小程序之间的跳转和传参示例代码附讲解
微信小程序开发交流qq群 173683895 承接微信小程序开发。扫码加微信。 正文: 一:微信小程序跳转 使用限制 需要用户触发跳转 从 2.3.0 版本开始,若用户未点击小程序页面任意位置,则开发者将无法调用此接口自动跳转至其他小…

电子界卡组构建2019_2018–2019年构建现代Android应用程序的路线图
电子界卡组构建2019Kriptofolio应用程序系列—简介 (Kriptofolio app series — Introduction) Welcome to this series of blog posts where I will be creating a modern Android app. I will use the best tools and practices available in the year 2018–2019. I am doin…

python操作mysql数据库实现增删改查
Python 标准数据库接口为 Python DB-API,Python DB-API为开发人员提供了数据库应用编程接口。 Python 数据库接口支持非常多的数据库,你可以选择适合你项目的数据库: GadFlymSQLMySQLPostgreSQLMicrosoft SQL Server 2000InformixInterbaseOr…

弹性布局,自动按比例居中
1. 让行类盒子及盒子的元素 自动按比例居中效果图 html <view classaaa><view classbbb>aaaaaaaaa</view><view classbbb>aaaaaaaaa</view><view classbbb>bb</view><view classbbb>aaaaaaaaa</view> </view> c…

Ubuntu 14.04系统托盘图标问题,skype托盘图标显示
Ubuntu 14.04系统托盘图标问题,skype托盘图标显示_瑞波支付_新浪博客 Ubuntu 14.04 取消了系统托盘白名单机制,导致使用传统系统托盘技术的程序无法显示出托盘图标,dconf-editor也无力解决这个问题 。Ubuntu Unity桌面目前使用的技术是indicator-applica…

以太坊去中心化_开发以太坊去中心化投票应用程序的指南
以太坊去中心化by Timothy Ko蒂莫西高(Timothy Ko) 开发以太坊去中心化投票应用程序的指南 (A guide to developing an Ethereum decentralized voting application) After the entire cryptocurrency market passed 700 billion dollars in market cap, the cryptocurrency s…

Intellij IDEA的下载和使用(针对学生的免费使用计划)
一、下载和使用授权(针对学生) 1、下载 可以在Intellij IDEA官网上下载需要的版本。下载地址:https://www.jetbrains.com/idea/ 2、学生免费试用 首先,你得现有你们学校的官方邮箱账户,例如XXXYYY.edu.cn 其次…

LPC1768基本输入输出GPIO使用
LPC1788通用IO口的控制包含了一些基本的组件,比如设置推挽输出,开漏输出,上拉电阻等,我们今天来看看. 首先使用GPIO要打开GPIO的系统时钟 LPC_SC->PCONP | (1<<15);//gpio 时钟 然后需要选择我们选定引脚的功能,有些引脚有多个功能,通过寄存器可以从中选择一个 之后是…

微信小程序发红包功能实现,附效果图加讲解。
微信小程序开发交流qq群 173683895 承接微信小程序开发。扫码加微信。 需要做红包功能的可以找我,收费卖源码,也承接开发。此博文仅示例。 流程效果图: 图片1触发wx.sendBizRedPacket({})吊起图片2,点击开,出现图…

项目部署时网关怎么回事_使用Kubernetes部署聊天网关(或技术按预期运行时)...
项目部署时网关怎么回事by Richard Li理查德李(Richard Li) 使用Kubernetes部署聊天网关(或技术按预期运行时) (Using Kubernetes to deploy a chat gateway (or when technology works like it’s supposed to)) TL; DR (TL;DR) This is a story about what happens when clo…

如何用php实现分页效果
分页效果在网页中是常见的,可是怎样才能实现分页呢,今天做了两种方法来实现一下分页的效果 首先,我们需要准备在数据库里面准备一个表,并且插入数据,这些都是必需的前提工作了,不多说,如图所示&…

微信小程序在showToast中换行并且隐藏icon
微信小程序开发交流qq群 173683895 承接微信小程序开发。扫码加微信。 正文: 实现代码: 注释:真机才有效果,开发工具展示icon属性无效 var a 11\r\n3wx.showToast({title: a,icon:none,duration: 5000})

node aws 内存溢出_如何使用Node.js和AWS快速创建无服务器RESTful API
node aws 内存溢出by Mark Hopson马克霍普森(Mark Hopson) 如何使用Node.js和AWS快速创建无服务器RESTful API (How to quickly create a serverless RESTful API with Node.js and AWS) In this beginner’s guide, we’ll briefly describe the “Serverless” software arc…

java学习之匿名内部类与包装类
匿名内部类: 所谓匿名内部类,顾名思义指的就是定义在类内部的匿名类,现有的spring框架开发以及java图形界面都经常用到匿名内部类。 下面来看一个代码: interface A{public void fun() ; } class B implements A{public void fun(…

【微信小程序】登录功能实现及讲解(获取用户唯一标识)
微信小程序开发交流qq群 173683895 承接微信小程序开发。扫码加微信。 正文: 功能:登录实现并获取到用户唯一标识 官方文档地址:可以先看完我的文章再看官方地址 实现步骤:1.调用微信API wx.login()得到code 2.把得到的cod…

参考框架 系统 基准_带有基准的前端框架的真实比较(2018更新)
参考框架 系统 基准by Jacek Schae由Jacek Schae 带有基准的前端框架的真实比较(2018更新) (A Real-World Comparison of Front-End Frameworks with Benchmarks (2018 update)) This article is a refresh of A Real-World Comparison of Front-End Frameworks with Benchmar…

U盘重装MacOS-Sierra系统
Mac系统重新安装两种方法: 1、在线远程重装。 2、制作启动U盘进行重装。 理论上第一种比较简单,但是会比较耗时,实际操作中,由于网上下载的系统版本低于我现在MacOS的版本,导致无法安装,因此只能使用第二种…

this和that的区别和原理
微信小程序开发交流qq群 173683895 承接微信小程序开发。扫码加微信。 正文: 本篇博文纯属个人见解,如有不妥,可以留言批评指正,谢谢。 var that this; this指的是当前的对象。 that是一个临时的变量,用于保存当…

linu逻辑分区动态调整大小
linu逻辑分区动态调整大小 注意: 这个动态调整的方法是有丢数据风险的,要确保调整的源分区没有使用或者使用率很低。源分区中如果有重要的文件最好先备份在centos 6.5上操作过lvdisplay 查看已有的分区的大小 lvdisplay ,选择要操作的逻辑分区&#…

多个敏捷团队同时做一个项目_您说您的团队很敏捷……但是这个词可能并不代表您的想法。...
多个敏捷团队同时做一个项目by Mark Shead由马克希德(Mark Shead) Many things get called Agile — especially by people who are selling something. But the Agile Manifesto makes it clear that it isn’t a methodology. It isn’t a specific way of doing software d…