提高编码效率_这5种简单的策略可提高您的编码效率

提高编码效率

As a developer, your productivity is not gauged by how much code you churn out, but by how much value you deliver. Gone are the days where lines of code are a worthwhile performance metric. If you want to master your craft and hone your productivity, you will need to embrace the age-old adage — “Work smarter, not harder”.

作为开发人员,您的生产率不是由您投入多少代码来衡量的,而是由您交付多少价值来衡量的。 如今,行代码成为有价值的性能指标的日子已经一去不复返了。 如果您想精通Craft.io并提高生产力,则需要接受古老的格言-“更聪明地工作,而不是更努力”。

These are 5 methods and principles you can employ today to start seeing immediate returns in your productivity.

您现在可以采用以下5种方法和原则来开始看到生产力的即时回报。

认真思考要实现的目标 (Be deliberate in what you want to achieve)

There is no way to know how productive you are if you have nothing to measure against. One of the biggest boosts to productivity you can get without having to do much at all is to set deliberate goals for what you want to do today and this week.

如果没有什么可衡量的,就无法知道自己的生产力。 无需做任何事情就可以最大程度地提高生产力的方法之一就是为您今天和本周想要做的事情设定故意的目标。

At the start of each week, take a moment to think about 3 things you want to have ticked off by the end of Friday. These should be high-level items, and your daily objectives will help you meet these goals.

在每个星期的开始,花点时间考虑一下您想在周五结束前完成的三件事。 这些应该是高级项目,您的日常目标将帮助您实现这些目标。

At the start of each day, consider what you have accomplished so far this week, and what you would need to do today to stay on track. Write down 3 objectives somewhere (I prefer a physical medium, but apps like Sunsama work great for this too). As you go through the day, when you finish a goal, tick off the item.

每天开始时,请考虑本周到目前为止所取得的成就,以及今天需要做些什么才能保持正轨。 在某处写下3个目标(我更喜欢物理媒介,但Sunsama之类的应用程序也可以很好地实现这一目标)。 一天中完成目标时,请勾选该项目。

It can take a bit of calibration to get a good feel for how big these tasks should be. I found myself writing down far too much at first. I was lucky if I was able to finish the first item on the list. After about a week of tweaking, I’ve reached a scope that works well for me. This technique is invaluable when it comes to projecting how much work I will get done in a week, and making it happen.

可能需要一些校准才能很好地了解这些任务的大小。 一开始我发现自己写下的东西太多了。 我很幸运能够完成清单上的第一项。 经过大约一周的调整,我已经达到了适合我的范围。 当计划我一周将完成的工作量并使其实现时,这项技术是无价的。

不要写完美的代码 (Don’t write perfect code)

Not straight away, at least. Many developers have fallen prey to the temptation to write perfect code in a single go. It rarely happens. Think of writing code the same way you would draw a picture. Start with a rough outline of what you want, and iteratively add details until you end up with something great.

至少不是马上。 许多开发人员不愿意一次编写完美的代码。 它很少发生。 考虑用与绘制图片相同的方式编写代码。 从大致概述您想要的内容开始,然后迭代添加细节,直到最终得到一些很棒的东西。

Leonardo da Vinci didn’t paint the Mona Lisa by perfecting her head before moving on to her neck, he worked through countless iterative refinements over the whole image.

莱昂纳多·达·芬奇(Leonardo da Vinci)没画过蒙娜丽莎(Mona Lisa)的画像,而是在移到脖子上之前先完善了头部,他在整个图像上进行了无数次迭代改进。

A good principle to help remember this is the “3 E’s of code”

记住这一点的一个好原则是“代码的3 E”

  • Effective — Write the code solve the problem

    有效-编写代码解决问题

  • Efficient — Improve the code to make it more optimised

    高效-改进代码以使其更优化

  • Elegant — Refine the code to make it beautiful (don’t skip this step. Efficient code isn’t worth much if no one can read it)

    优雅—完善代码以使其美观(不要跳过此步骤。高效的代码如果没有人看懂,就不值钱了)

In that order. Don’t start the next step until the previous one is complete.

以该顺序。 在上一步完成之前,请勿开始下一步。

This methodology ties in well with the next point.

该方法与下一点很好地联系在一起。

尽可能使用TDD (Use TDD wherever you can)

Test-Driven Development is great. It is basically a free productivity boost. Writing your tests as you go and refactoring code once it passes fits in perfect lock-step with the 3 E’s mentioned above. Don’t write your tests after you are finished with the code. If you do this, one of two things are likely to happen:

测试驱动开发很棒。 这基本上是免费的生产力提升。 随手编写测试,并在代码通过后进行重构,可以完美地锁定上述3E。 完成代码后,请勿编写测试。 如果执行此操作,则可能会发生以下两种情况之一:

  1. You will be told to skip the tests and move on

    系统会告诉您跳过测试并继续前进

  2. If you do write the tests, you will base them on the output of the code, and if you have bugs, so will the tests

    如果确实编写测试,则将基于代码的输出,如果存在错误,则测试也将基于它们

Writing tests as specifications — distilled business requirements — ensures that your code is working as you write it and that the testing cannot be skipped. This results in higher quality work, fewer bugs, and less cause to come back and rework things later. If that isn’t a productivity gain, I don’t know what is.

按照规范编写测试(精炼的业务需求)可确保您的代码在编写时就可以正常工作,并且不会跳过测试。 这样可以提高工作质量,减少错误,并减少以后返工和返工的原因。 如果那不是生产力的提高,我不知道这是什么。

分批工作 (Work in batches)

A fact of life for most jobs is that you will often receive small tasks which people ask you to do. Being a developer is no different, and depending on your role you might get a couple of these a week, or dozens of them per day!

大多数工作的现实生活是,您经常会收到人们要求您完成的小任务。 成为开发人员也没有什么不同,根据您的角色,您一周可能会得到其中的一些,或者每天可能得到数十种!

The key thing here is that many of these tasks are not urgent at all, and can be delayed without any adverse impact. If you delay enough similar tasks, you will be able to group them all together and action them all at once. This approach of doing the work in batches has various benefits. On the one hand, you are reducing the amount of context-switching you do, so you will naturally get productivity gains there. You will also be able to consolidate the setup and teardown overhead associated with small tasks. In most cases, the setup work required to do one task is the same as the work required to do 10 similar tasks. consolidating this overhead can save you a lot of time which could be better spent elsewhere.

这里的关键是,这些任务中的许多任务根本都不紧急,可以拖延而不会产生任何不利影响。 如果延迟足够多的相似任务,则可以将它们组合在一起并立即执行所有操作。 这种分批完成工作的方法具有多种好处。 一方面,您正在减少上下文切换的数量,因此您自然会在那里获得生产力的提高。 您还可以合并与小任务相关的设置和拆卸费用。 在大多数情况下,执行一项任务所需的设置工作与执行十项类似任务所需的工作相同。 合并这些开销可以节省大量时间,最好在其他地方花费。

坚持不懈 (Be Relentless)

Perhaps the most important thing when it comes to getting stuff done. Sometimes you have to just power through. Using the other tactics described above will put you in a position to identify the work which needs to be done, and give you tools to do it efficiently, but at the end of the day, you just have to do it. I set myself a hard requirement of AT LEAST checking off the first item on my 3 item list every day. On good days I can get two or three high-level items checked off, but if you check off one meaningful objective each day — as long as you have set yourself valuable targets — you will be smashing out work and ticking boxes like nobody’s business.

完成工作可能是最重要的事情。 有时,您只需要接通电源即可。 使用上述其他策略将使您能够确定需要完成的工作,并为您提供有效完成工作的工具,但总之,您只需要完成工作即可。 我对自己提出了一个严格的要求,即每天至少要检查我的3个项目列表中的第一个项目。 在美好的日子里,我可以检查两到三个高级项目,但是如果您每天检查一个有意义的目标(只要您为自己设定了重要的目标),您就会无所事事,无所事事。

翻译自: https://medium.com/dev-genius/boost-your-coding-productivity-with-these-5-simple-tactics-dca7b617cb65

提高编码效率

文章知识点与官方知识档案匹配,可进一步学习相关知识算法技能树首页概览33848 人正在系统学习中 相关资源:锁屏 自动锁屏 定时锁屏 注销软件

来源:weixin_26746861

声明:本站部分文章及图片转载于互联网,内容版权归原作者所有,如本站任何资料有侵权请您尽早请联系jinwei@zod.com.cn进行处理,非常感谢!

上一篇 2020年7月22日
下一篇 2020年7月22日

相关推荐