编写代码超过限制时间
by Jonathan Solórzano-Hamilton
乔纳森·索洛萨诺·汉密尔顿(JonathanSolórzano-Hamilton)
编写代码时浪费时间。 (When writing code is a waste of time.)
知道不应该构建什么是现代软件开发中最关键的部分。 (Knowing what not to build is the most crucial part of modern software development.)
One of the most prominent mistakes made by development teams is doing too much work.
开发团队犯下的最突出错误之一就是工作量过多。
Last time you were in crunch mode on a project, did you think “this is going great”? Crunch time is the penance we pay for the poor decisions we made earlier in the project. In particular, the decision to do too much work.
上次您在项目中处于紧缩模式时,您是否认为“进展非常顺利”? 紧缩时间是我们为项目早期做出的糟糕决定所付出的苦恼。 特别是决定做过多的工作。
I have spent many years architecting and developing enterprise software. I cut my teeth with an internship at HP and survived a harrowing stint at an imploding start-up before moving on to a more stable career track. I spent several years working at Stanford University and have since become the Assistant Director of Architecture at UCLA Research Information Systems.
我花了很多年设计和开发企业软件。 我在HP实习期间咬牙切齿, 在一家初创的初创公司中度过了痛苦的时光,然后才转向更稳定的职业生涯。 我在斯坦福大学工作了几年,此后成为UCLA研究信息系统的架构助理总监。
In this role I lead enterprise software development efforts, particularly the implementation of micro-services, to support research administration processes. I have learned a lot, through the school of hard knocks, about what does not work in a collaborative software development process.
在此职位上,我领导企业软件开发工作,尤其是微服务的实施,以支持研究管理流程。 我学到了很多东西,经过艰苦的磨练的学校,什么不协作软件开发过程中的工作。
避免工作节省了我的培根 (Avoiding work saved my bacon)
Years ago I found myself leading a 6-month rewrite of a 5-year project. At the end of the six months, we would either have a successful release or the chance to iterate on our resumes.
多年前,我发现自己领导了一个为期5年的项目的为期6个月的重写 。 在六个月末,我们要么获得成功的发布,要么有机会对简历进行迭代。
We had two options: work ten times as fast as the previous team — which had already been putting in 70+ hour weeks — or avoid most of the work. We avoided most of the work.
我们有两种选择:工作速度是前一个团队的10倍(每周工作70个小时以上)或避免了大部分工作。 我们避免了大部分工作。
We achieved this by aggressively limiting the scope. The customer, though, would only tolerate so much feature reduction. They had been waiting for five years and weren’t going to accept a skeleton of a product.
我们通过积极限制范围来实现这一目标。 但是,客户只能忍受这么多的功能减少。 他们已经等了五年了,不会接受产品的骨架。
The rest of the scope restriction came from within. The team re-structured the product architecture to reuse third-party packages wherever we could. Out went the bespoke logger. Gone was the custom expression-trees framework. Goodbye, home-brew object-relational mapper. Hello, free open-source software.
其余范围限制来自内部。 团队重新构建了产品架构,以尽可能地重用第三方软件包。 定制记录器出了。 自定义表达式树框架已不复存在。 再见,自制的对象关系映射器。 您好,免费的开源软件。
I did not have to update my resume.
我不必更新我的简历。
燃烧的小径确保您会发现所有陷阱 (Blazing the trail ensures you will find all the pitfalls)
First let’s hit the most severe problem with a complete do-it-yourself approach to application development: security. The literal definition of a pitfall is a pit which is covered to entrap the unwary.
首先,让我们用一个完整的自己动手的应用程序开发方法来解决最严重的问题:安全性。 陷阱的字面定义是一个覆盖了陷阱的坑,以困住粗心的人。
The road to secure applications is lousy with pitfalls.
确保应用程序安全的道路充满陷阱。
Hackers have been playing a game of cat-and-mouse with application developers since the dawn of the discipline. They have gotten very, very good at cracking security safeguards. They have built up an entire arsenal of methods, techniques, and vulnerabilities to exploit. Do you want to fight them starting from scratch?
自从该学科诞生以来,黑客就一直在与应用程序开发人员玩猫捉老鼠的游戏。 他们已经非常擅长破解安全保障措施。 他们建立了完整的方法,技术和漏洞库。 您要从头开始与他们战斗吗?
It is possible that you will anticipate every single exploit an attacker could levy against your application. It is possible that you will keep up with the latest developments and ensure that your custom front-end security is up to par. It is far likelier that one day you will miss one hole and your boss shows up to set an empty cardboard box on your desk.
您可能会预期攻击者可能对您的应用程序征收的每一个漏洞。 您有可能会跟上最新发展,并确保自定义前端安全性达到标准。 有一天,您可能会错过一个洞,而老板会出现在您的办公桌上放一个空的纸板箱,这是极有可能的 。
你会浪费时间 (You will waste time)
Setting aside application security concerns, you also do not want to waste time. Rebuilding commonplace features that are already supported by popular public packages is a complete waste. If you cannot extend these packages, you should at least fork them.
除了应用程序安全性问题外,您也不想浪费时间。 重建流行的公共软件包已支持的常见功能是完全浪费的。 如果您不能扩展这些软件包,则至少应将它们分叉。
But wait, you may think. It will be a useful exercise for me to learn how to build this feature. Learning is not a waste of time!
但是等等,您可能会想。 对我来说,学习如何构建此功能将是一个有用的练习。 学习不是浪费时间!
This is only partly true. Yes, learning on the job is not a waste of your time. Subjecting the broader team to your half-baked, sub-par “learning implementation” of a common feature is a massive waste of your colleagues’ time.
这只是部分正确。 是的,在工作中学习并不会浪费您的时间。 让更广泛的团队接受您半熟半熟,不合格的通用功能的“学习实施”,这是在浪费同事的时间 。
It is worthwhile to invest in your own learning. Spend time at freeCodeCamp building your skills in a low-risk environment. Other online schools and university extensions offer coding curriculum as well
值得投资于自己的学习。 花时间在freeCodeCamp上 ,在低风险的环境中建立技能。 其他在线学校和大学扩展也提供编码课程
Perhaps you only have time to learn on the job. You may feel that you must use your contributions to the team as an independent learning exercise. If so, at least abstract your attempt behind an interface to make it easy to rip out and replace later.
也许您只有时间在工作上学习。 您可能会觉得您必须将对团队的贡献作为一项独立的学习练习。 如果是这样,请至少将您对接口的尝试抽象化,以使其易于淘汰并在以后进行替换。
炫耀性消费的其他好处 (Other benefits to conspicuous consumption)
Consuming a free (or otherwise third-party) package offers many immediate benefits. It also pays off in the long term.
消费免费(或第三方)软件包可立即带来许多好处。 从长远来看,它也有回报。
First, you will get access to more features quickly. A package that solves your immediate problem will also likely address some common, related issues. The maintainers probably ran into similar issues and expanded the package features. You can even look to these “extra” features for ideas about where to take your product.
首先,您将快速访问更多功能。 解决您当前问题的软件包也可能会解决一些常见的相关问题。 维护人员可能会遇到类似的问题,并扩展了软件包功能。 您甚至可以借助这些“额外”功能获得有关将产品带往何处的想法。
Second, you are signing up for automatic improvements and new features as they are released. Public packages rarely stand still: their developers encounter additional needs, their community grows, their consumers have to upgrade base frameworks. These all drive the implementation of new features. They also motivate the release of updates that ensure the code stays compatible with the latest version of the underlying language or framework.
其次,您要注册以发布自动改进和新功能。 公共软件包很少停滞不前:他们的开发人员遇到了更多需求,他们的社区不断壮大,他们的消费者不得不升级基本框架。 这些都推动了新功能的实现。 它们还促使发布更新,以确保代码与基础语言或框架的最新版本保持兼容。
Third, if it is an open-source package, you have the opportunity to give back to the community. Become one of the maintainers. You will have a say in the direction of the package. Other maintainers may adopt your extensions as core features into the code base. As a bonus, you will gain personal exposure as a developer, and you will also have the opportunity to improve your skills by learning from your peers.
第三,如果它是开源软件包,那么您就有机会回馈社区。 成为维护者之一。 您将对包裹的方向发表意见。 其他维护者可能会将您的扩展作为代码库的核心功能。 作为奖励,您将获得作为开发人员的个人风光,并且还将有机会通过向同行学习来提高自己的技能。
You will also incur much less technical debt. Even the best code incurs some maintenance overhead, which will chip away at your team’s future productivity. Reducing the amount of code you write today will increase the number of features you can release tomorrow.
您还将承担更少的技术债务 。 即使是最好的代码也会产生一些维护开销,这将降低团队未来的生产力。 减少您今天编写的代码量,将增加明天可以发布的功能。
那么,什么时候自己建造呢? (So when do you build it yourself?)
Given the already-enumerated benefits, and the mitigated risks, it may seem that coding is always a waste of time. Many application features are already available in third-party packages. So what’s left for the developer to do? Wire them together?
考虑到已经列举的好处和降低的风险,似乎编码总是在浪费时间。 第三方程序包中已经提供了许多应用程序功能。 那么,开发人员还有什么要做呢? 将它们连接在一起?
You assuredly can create a minimum-viable product by assembling pre-built packages. It still needs at least one feature of differentiation to be viable. If that one element is compelling enough, it will pave the way for you to iterate to greatness.
您肯定可以通过组装预制包装来创建最低限度的产品。 它仍然至少需要差异化的一个特征才能可行。 如果这一要素足够引人注目,它将为您迭代至卓越铺平道路。
I have already written about Tesla in my article about sustainable development, but it’s a good analogy. The first Tesla vehicle was a completely pre-built electric car. Tesla only provided their disruptive new lithium-ion battery. The second iteration merged the electric drivetrain and bespoke Tesla battery from this car into a respected production sports car.
我在关于可持续发展的文章中已经写过关于特斯拉的文章,但这是一个很好的类比。 特斯拉的第一辆汽车是完全预制的电动汽车。 特斯拉只提供了他们具有破坏性的新型锂离子电池。 第二次迭代将电动驱动系统和定制的Tesla电池从这辆车合并为备受推崇的量产跑车。
Now Tesla has iterated into five-door SUVs and mass-market consumer vehicles. They differentiate their current products via gull-wing doors and self-driving capability.
现在,特斯拉已经迭代到五门SUV和大众市场消费汽车。 他们通过鸥翼门和自动驾驶功能使当前产品脱颖而出。
With each product iteration, Tesla expanded the scope of their differentiation. They identified what their customers wanted next and scaled out their development to maintain their edge.
随着产品的每次迭代,特斯拉扩大了差异化的范围。 他们确定了客户接下来想要什么,并扩展了他们的开发以保持自己的优势。
Find your essential differentiation and build it. Craft it with the most love and care you can. The rest of the product can recycle what’s already out there until you have grown enough to broaden your value proposition.
找到并建立您的本质差异。 尽最大的爱和关怀来制作它。 产品的其余部分可以循环利用现有产品,直到您成长到足以扩大自己的价值主张为止。
细读包 (Perusing packages)
You have identified the product you intend to build. You have outlined its features and defined the minimum viable scope. You have identified the differentiators, so the rest is up to packages.
您已确定要构建的产品。 您已概述了其功能并定义了最小可行范围。 您已经确定了差异化因素,因此其余的取决于软件包。
How do you find and identify which packages to use?
您如何查找和标识要使用的软件包?
First, you will need a source. GitHub is a popular destination for free open-source software. Stack Overflow has many suggestion threads, and you can ask the community for advice. These are also valuable communities to join, because they will build your public profile as a developer.
首先,您将需要一个来源。 GitHub是免费开源软件的流行目的地。 堆栈溢出有许多建议线程,您可以向社区咨询。 这些也是有价值的社区,因为它们将建立您作为开发人员的公开资料。
Language-specific package repositories exist as well, including NPM for JavaScript, RubyGems.org for Ruby and Rails, and NuGet.org for .NET development.
还存在特定于语言的软件包存储库,包括用于JavaScript的NPM ,用于Ruby和Rails的RubyGems.org以及用于.NET开发的NuGet.org 。
Browsing the source, you will need to identify which packages will be viable for your product. The first indicator I examine is ongoing freshness. When was the last update? How many people help maintain the repository? How many of them are active?
浏览源代码,您将需要确定哪些软件包适用于您的产品。 我检查的第一个指标是持续的新鲜度。 最近一次更新是什么时候? 有多少人帮助维护存储库? 他们中有多少活跃?
Next, you need to make sure that the license is compatible with your product. Some licenses may impose additional obligations on you as a user of the package. The MIT License and Apache License 2.0 are usually safe choices. They impose few commitments on you (but you still have to comply with the license, however minimal).
接下来,您需要确保许可证与您的产品兼容。 某些许可证可能会对您作为软件包用户施加其他义务。 MIT许可证和Apache许可证2.0通常是安全的选择。 它们对您的承诺不多(但是您仍然必须遵守许可证,无论多么微小)。
There are other considerations to selecting the right package. Is it officially supported by a company, especially a major company? These have a lower risk of falling out of maintenance. Bootstrap (by Twitter) and React (by Facebook) are good examples.
选择正确的软件包还有其他注意事项。 它是否得到公司(尤其是大公司)的正式支持? 这些具有较低的维护风险。 Bootstrap (通过Twitter)和React (通过Facebook)是很好的例子。
Is it the right size for your project? Some packages are big and unwieldy. It may take longer to learn and implement the package than to build a small custom solution.
是否适合您的项目规模? 一些软件包很大且笨拙。 与构建小型自定义解决方案相比,学习和实施软件包可能需要更长的时间。
How many users have downloaded it overall, and how many recently? These metrics provide clues to which packages the community supports, and which may be on the way out.
总体上有多少用户下载了它,最近有多少用户下载了它? 这些度量提供了社区支持哪些软件包以及可能正在淘汰的线索。
Is your language or platform of choice in the middle of a major release roll-out? Check and see how the repository is performing. Have the maintainers already started integration to the new version? Have they run into any roadblocks? How does support for the next version vs. the current version look?
在主要版本推出期间,您是选择的语言还是平台? 检查并查看存储库的性能。 维护人员是否已开始集成到新版本? 他们遇到任何障碍了吗? 新版本对当前版本的支持情况如何?
Picking the right package is an exercise in risk analysis. You need to perform due diligence to ensure that the package will be capable of supporting your product long enough.
选择正确的软件包是风险分析中的一项练习。 您需要进行尽职调查,以确保该包装能够长期支持您的产品。
所以这对于你来说意味着什么? (So what does this mean for you?)
Be humble. Keep your team humble, too. You are not the best developers ever born. You do not have time to remake the entire world in your image and remain competitive. Even if you did, you are squandering competitive edge unless you are re-inventing with purpose.
要谦虚。 也让您的团队保持谦虚。 您不是天生的最好的开发人员。 您没有时间重塑形象并保持竞争力。 即使您这样做了,也要浪费竞争优势,除非您有目的地进行重新发明。
Use packages that are already out there. Give back to the community if you can by becoming a maintainer.
使用已经存在的软件包。 如果可以的话,请回馈社区,成为维护者。
Focus your efforts on the change you want to bring to your market. Create something truly novel. It will always be worth your time.
将精力集中在要带给市场的变化上。 创造真正新颖的东西。 永远值得您花时间。
I recently had a conversation about this topic with Michael Miles on his excellent podcast, Developing Up. Click the link to listen!
最近,我在Michael Miles出色的播客“ Developing Up”中与这个话题进行了对话 。 点击链接收听!
Please ? if you enjoyed this article!
请 ? 如果您喜欢这篇文章!
翻译自: https://www.freecodecamp.org/news/when-writing-code-is-a-waste-of-time-6602af8cb759/
编写代码超过限制时间