We Feel Overwhelmed. It Isn't Going to Get Any Better

本文探讨了在处理遗留代码时如何保持积极态度并从中找到乐趣。作者指出,虽然遗留系统的维护充满挑战,但通过建立良好的工作环境、连接外部社区以及采用测试驱动开发等实践,程序员依然能够享受编程过程。

开发板推荐:天空星STM32F407VET6开发板

超高性价比 STM32主控 | 超高主频 | 一板兼容百芯 | 比赛神器 | 沉金彩色丝印

为自己打打气,转帖一篇好文章,来自于Michael Feathers的《Working effectively with legacy code》。

当你面对一堆大粪构成的大山的时候,还是有点事情可以做的——


Working in legacy code is difficult. There is no denying it. Although every situation is different, one thing is going to make the job worth it to you as a programmer or not: figuring out what is in it for you. For some people, it is a paycheck, and there isn't anything wrong with that—we all have to make a living. But there really ought to be some other reason why you are programming.

If you were lucky, you started out in this business writing code because you thought it was fun. You sat down with your first computer ecstatic with all of the possibilities, all of the cool things you could do by programming a computer. It was something to learn and something to master, and you thought, "Wow, this is fun. I can make a great career if I get very good at this."

Not everyone comes to programming this way, but even for people who didn't, it is still possible to connect with what is fun about programming. If you can—and some of your coworkers can, too—it really doesn't matter what kind of system you are working on. You can do neat things with it. The alternative is just dejection. It isn't any fun, and frankly, we all deserve better than that.

Often people who spend time working on legacy systems wish they could work on green-field systems. It's fun to build systems from scratch, but frankly, green-field systems have their own set of problems. Over and over again, I've seen the following scenario play out: An existing system becomes murky and hard to change over time. People in the organization get frustrated with how long it takes to make changes in it. They move their best people (and sometimes their trouble-makers!) onto a new team that is charged with the task of "creating the replacement system with a better architecture." In the beginning, everything is fine. They know what the problems were with the old architecture, and they spend some time coming up with a new design. In the meantime, the rest of the developers are working on the old system. The system is in service, so they receive requests for bug fixes and occasionally new features. The business looks soberly at each new feature and decides whether it needs to be in the old system or whether the client can wait for the new system. In many cases, the client can't wait, so the change goes in both. The green-field team has to do double-duty, trying to replace a system that is constantly changing. As the months go by it becomes clearer that they are not going to be able to replace the old system, the system you're maintaining. The pressure increases. They work days, nights, and weekends. In many cases, the rest of the organization discovers that the work that you are doing is critical and that you are tending the investment that everyone will have to rely on in the future.

The grass isn't really much greener in green-field development.

The key to thriving in legacy code is finding what motivates you. Although many of us programmers are solitary creatures, there really isn't much that can replace working in a good environment with people you respect who know how to have fun at work. I've made some of my best friends at work and, to this day, they are the people I talk to when I've learned something new or fun while programming.

Another thing that helps is to connect with the larger community. These days, getting in touch with other programmers to learn and share more about the craft is easier than it ever was. You can subscribe to mailing lists on the Internet, attend conferences, and take advantage of all the resources that you can use to network, share strategies and techniques, and generally stay on top of software development.

Even when you have a bunch of people on a project who care about the work and care about making things better, another form of dejection can set in. Sometimes people are dejected because their code base is so large that they and their team mates could work on it for 10 years but still not have made it more than 10 percent better. Isn't that a good reason to be dejected? Well, I've visited teams with millions of lines of legacy code who looked at each day as a challenge and as a chance to make things better and have fun. I've also seen teams with far better code bases who are dejected. The attitude we bring to the work is important.

TDD some code outside of work. Program for fun a little bit. Start to feel the difference between the little projects you make and the big project at work. Chances are, your project at work can have the same feel if you can get the pieces you work with to run into a fast test harness.

If morale is low on your team, and it's low because of code quality, here's something that you can try: Pick the ugliest most obnoxious set of classes in the project, and get them under test. When you've tackled the worst problem as a team, you'll feel in control of your situation. I've seen it again and again.

As you start to take control of your code base, you'll start to develop oases of good code. Work can really be enjoyable in them.

开发板推荐:天空星STM32F407VET6开发板

超高性价比 STM32主控 | 超高主频 | 一板兼容百芯 | 比赛神器 | 沉金彩色丝印

内容概要:本文聚焦于高维多阶段随机规划问题的建模与求解方法,结合Python代码实现,系统研究了在不确定性环境下的复杂动态优化问题。重点探讨了正则化分解技术在缓解高维问题“维度灾难”中的作用,以及如何引入马尔可夫过程对系统状态转移的不确定性进行建模,从而提升优化模型的鲁棒性与实用性。文中详细阐述了算法设计思路与实现流程,涵盖场景生成、阶段划分、递推求解及收敛性分析等关键环节,适用于能源调度、电力系统规划等具有多阶段决策特征的实际应用场景。; 适合人群:具备一定运筹学基础、随机过程理论知识及Python编程能力,从事能源系统优化、电力调度、智能电网、低碳规划等领域的高校研究生、科研人员以及相关工程技术人员。; 使用场景及目标:①掌握高维多阶段随机规划问题的建模框架与求解策略;②学习如何利用马尔可夫链刻画动态不确定性并嵌入优化模型;③理解正则化方法在降低计算复杂度、加速算法收敛方面的技术优势;④借鉴完整代码实现在自身研究课题中复现或拓展相关算法; 其他说明:资源提供可运行的Python源码,建议结合具体案例数据进行调试与验证,并配合主流优化求解器(如Gurobi、CPLEX)进一步提升求解效率,同时推荐阅读相关文献以深化对分解算法与随机规划理论的理解。
内容概要:本文详细介绍了Spring Boot中过滤器(Filter)、拦截器(Interceptor)以及跨域处理(CORS)的核心概念、实现方式与实际应用。文章首先讲解了自定义过滤器的两种实现方式(实现Filter接口或使用@WebFilter注解),并通过@Order或FilterRegistrationBean控制执行顺序,列举了认证、日志、跨域、参数处理和性能监控等典型应用场景。接着深入阐述了拦截器的使用,包括登录拦截、权限校验(结合自定义注解)、日志记录等功能,并提供了线程安全的用户上下文管理与最佳实践建议。随后通过对比表格清晰展示了过滤器与拦截器在规范、作用范围、依赖容器等方面的本质区别,并配合完整的请求流程图说明二者执行顺序。最后全面覆盖了跨域问题的多种解决方案,包括@CrossOrigin注解、实现WebMvcConfigurer、使用CorsFilter、Spring Security集成、配置文件方式及生产环境配置建议,帮助开发者彻底解决前后端分离中的跨域难题。; 适合人群:具备一定Java和Spring Boot基础,从事Web开发1-3年的研发人员,尤其是正在构建前后端分离项目的开发者。; 使用场景及目标:① 实现统一的请求处理逻辑如鉴权、日志、性能监控;② 构建安全可靠的登录与权限控制系统;③ 解决前后端分离架构下的跨域问题;④ 理清过滤器与拦截器的差异并合理选用; 阅读建议:此资源理论与实战紧密结合,建议边学习边动手实践文中提供的代码示例,重点关注执行流程、ThreadLocal使用、CORS配置细节及生产环境安全配置,结合调试加深理解。
下载代码方式:https://pan.quark.cn/s/454642a7036c 《微机原理与接口技术》在计算机科学学科内是一门具有核心地位的基础学科,其核心议题在于探究微型计算机的构造特征、运行机制以及与外部设备间的数据交互途径。由彭虎主编的教材凭借其阐释精当且实例充裕的特点,获得了众多教育工作者与学生的广泛认可。课后习题的参考答案在学术进修中扮演着至关重要的角色,它能够协助学生评估学习成效,并进一步消化和强化所学内容。 本压缩文档内含的《微机原理与接口技术习题答案_电子工业出版社_彭虎_周佩玲_傅忠谦著.pdf》构成了一套全面的教师教学参考资料,其中系统性地收录了各章节的习题解析,对于自主研习或课堂教学中的难点处理具有显著效用。借助这份参考答案,学习者能够参照个人解题方案,识别偏差与疏漏,进而优化对微机原理与接口技术的认知深度。 在微机原理的篇章中,重点阐述了中央处理单元的构造、运算单元、控制单元、存储系统(涵盖内存、寄存器及外存的功能机制)、指令集以及程序设计入门等要素。这些基础性知识构成了理解计算机操作机理的根基,同时也是后续学习操作系统、编译技术等进阶学科的前提条件。 接口技术的篇章则涉及了输入/输出(I/O)接口、中断机制、总线体系、定时器/计数器装置、直接存储器访问(DMA)等范畴。这部分知识关乎计算机与外部设备之间的交互模式,以及数据的高效传送方法,是计算机硬件体系构建的关键所在。 在习题解答资料中,通常会对每个题目的解题过程进行细致说明,对于较为复杂的问题或许还会提供详尽的图形或流程示意图,以助读者直观掌握。重点难点剖析环节,针对学习期间普遍存在的疑虑和挑战进行深度阐释,有助于学员克服学习障碍。 再者,彭虎、周佩玲和傅忠谦三位作者均为计算...
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值