黑客初学者刷屏技巧_初学者,这些技巧将加速您的编码

黑客初学者刷屏技巧_初学者,这些技巧将加速您的编码黑客初学者刷屏技巧Whenyoujuststartoutyourprogrammingjourney,therearesomanyshinytoolsandtechnologiestoexplore,youalmostdon’tknowwheretostart.Fortunately,therearenumerousguidesonho…

大家好,又见面了,我是你们的朋友全栈君。

黑客初学者刷屏技巧

When you just start out your programming journey, there are so many shiny tools and technologies to explore, you almost don’t know where to start. Fortunately, there are numerous guides on how to get into different fields such as web development, computer systems, data science, and much more. This article is not one of these guides.

当您刚开始编程之旅时,有很多闪亮的工具和技术可供探索,您几乎不知道从哪里开始。 幸运的是,有许多关于如何进入不同领域的指南,例如Web开发,计算机系统,数据科学等等。 本文不是这些指南之一。

In my spare time, I tutor beginner programmers. When I’m working with them, I notice that even though their programming knowledge is solid, they still suffer from a low-efficiency workflow. I introduced the following tips to my students, and each one immediately benefited from knowing and using them. Often times there was even a reactive “Whoa!” upon learning these tips.

在业余时间,我指导初学者程序员。 当我与他们一起工作时,我注意到尽管他们的编程知识很扎实,但他们仍然遭受效率低下的工作流程的困扰。 我向学生介绍了以下技巧,每一个技巧都会立即从了解和使用它们中受益。 通常,甚至会有React性的“哇!” 在学习这些技巧后。

Regardless of your background, if you write code often, I urge you to please give these tips a try if you haven’t already. For the beginners I tutor, these were game-changers.

无论您的背景如何,如果您经常编写代码,我强烈建议您尝试一下这些技巧,如果您还没有的话。 对于我辅导的初学者来说,这些都是改变游戏规则的人。

重复行 (Duplicate Line)

We’ve all done this before: triple-click, copy, right arrow, enter, paste.

我们之前已经完成了所有操作:双击,复制,向右箭头,输入,粘贴。

Not only that, but we have probably done this a thousand times over. The seconds spent executing this string of operations adds up, not to mention the fact that you have to move your hand away from your keyboard and to your mouse.

不仅如此,而且我们可能已经完成了1000多次。 执行这一系列操作所花费的时间加在一起,更不用说必须将手从键盘移到鼠标上了。

You can shave off those precious seconds by using the Duplicate Line shortcut for your code editor. The added bonus: you don’t need to leave your keyboard.

您可以使用代码编辑器的“重复行”快捷方式来节省宝贵的时间。 额外的好处是:您无需离开键盘。

Here are the shortcuts for some commonly used code editors:

以下是一些常用代码编辑器的快捷方式:

  • VSCode: Shift+Option+Down/Up (Mac), Shift+Alt+Down/Up (Windows/Linux)

    VSCode:Shift + Option +向下/向上(Mac),Shift + Alt +向下/向上(Windows / Linux)

  • Atom: Shift+Command+D (Mac), Shift+Ctrl+D (Windows/Linux)

    Atom:Shift + Command + D(Mac),Shift + Ctrl + D(Windows / Linux)

  • Sublime: Command+Shift+D (Mac), Ctrl+Shift+D (Windows/Linux)

    崇高:Command + Shift + D(Mac),Ctrl + Shift + D(Windows / Linux)

  • Vim: Y to yank line + p to paste after the current line.

    VIM: Y以复制行+ p到当前行粘贴。

代码段 (Code Snippets)

Wouldn’t it be great if your computer just wrote your code for you? Well, using code snippets is the next best thing. Think of some common code patterns, expressions, or boilerplate that you write on a daily basis. A good snippet set will take care of all that extra typing, letting you skip straight to the meat of the task.

如果您的计算机只是为您编写了代码,那不是很好吗? 好吧,使用代码片段是下一件好事。 考虑一下您每天编写的一些常见代码模式,表达式或样板。 好的摘要集将帮助您处理所有额外的键入操作,让您直接跳过任务的重点。

You can find snippets for pretty much any commonly used language or framework. Conduct a search in your editor’s package marketplace and you will probably find something. For instance, to find React JS snippets for VSCode, I would go to the Visual Studio Marketplace and search “React snippets.” The first result is below.

您可以找到几乎所有常用语言或框架的摘录。 在编辑器的打包市场中进行搜索,您可能会发现一些东西。 例如,要找到VSCode的React JS代码段,我将转到Visual Studio市场并搜索“ React代码段”。 第一个结果如下。

For React/Redux/GraphQL/React Native: https://marketplace.visualstudio.com/items?itemName=dsznajder.es7-react-js-snippets

对于React / Redux / GraphQL / React Native: https ://marketplace.visualstudio.com/items?itemName = dsznajder.es7-react-js-snippets

My most used snippet is rafce, which (I think) stands for “React Arrow Function Component, Exported.” If I create a file called MyComponent.jsx and run rafce, it generates the following boilerplate for me:

我最常用的代码段是rafce ,(我认为)代表“已导出的React箭头功能组件”。 如果创建一个名为MyComponent.jsx的文件并运行rafce ,它将为我生成以下样板:

import React from 'react'const MyComponent = () => {
       
       
return (
<div>
</div>
)
}export default MyComponent

This will save you a lot of time, especially when you don’t know the boilerplate by heart.

这将为您节省大量时间,尤其是当您完全不了解样板时。

The next level for web developers would be to learn how to use Emmet. There are many easy-to-follow guides regarding this toolkit.

Web开发人员的下一个层次将是学习如何使用Emmet 。 关于此工具包,有许多易于遵循的指南。

支架对着色器 (Bracket Pair Colorizer)

Perhaps the toughest thing to do as a beginner is learning to debug. I know that when I started learning to program, there were few things in life that gave me larger headaches than debugging my C programs.

作为初学者,最难的事情就是学习调试。 我知道,当我开始学习编程时,生活中很少有比调试C程序更让我头疼的事情。

Bracket Colorizer won’t debug for you, but it will save you some headaches. This is simply a tool that, as the name suggests, color coordinates matching pairs of brackets for you.

Bracket Colorizer不会为您调试,但可以为您省去一些麻烦。 顾名思义,这只是一个工具,它可以为您匹配颜色匹配的方括号对。

Now, if you forget to close that if statement or accidentally add too many brackets for your expression, you will see it clear as day. Unfortunately for web developers, this doesn’t yet work for chevrons (these: < >), but our fingers are crossed!

现在,如果您忘记关闭if语句,或者不小心在表达式中添加了太多括号,您会清楚地看到它。 不幸的是,对于Web开发人员来说,这还不适用于人字形(这些字符: < > ),但是我们的手指交叉了!

Here are some options for popular code editors:

以下是流行的代码编辑器的一些选项:

Bonus: Bracket Highlighters serve a similar purpose, but instead highlight the matching bracket pair your cursor is on. Here are some more links:

奖励:括号荧光笔的用途与此类似,但可以突出显示光标所在的匹配括号对。 这里有一些更多的链接:

更好的评论 (Better Comments)

Beginners will quickly find out that comments are invaluable. I can think of some project deadlines I would not have met had it not been for my comments. Comments can be used to structure your thoughts before you code. However, comments can be a double-edged sword, as we will discuss later.

初学者会很快发现评论是无价的。 我可以想到一些项目截止日期,如果没有我的评论,我将无法达到。 注释可用于在编码之前整理您的想法。 但是,评论可能是一把双刃剑,我们将在后面讨论。

Commenting diligently makes you a time traveler within your code. When you leave that expressive comment, you can forget the project for some time and when you come back and read the comment, it’s almost like you never left. The more accurately you can capture your train of thought, the smoother your experience of resuming work will be.

勤奋地注释使您成为代码中的旅行者。 当您留下表达力的评论时,您可能会忘记项目一段时间,而当您回来阅读评论时,几乎就像您从未离开过。 您越能准确地把握思路,恢复工作的经验就越流畅。

Here are some extensions to give more life to your comments:

以下是一些扩展,可以使您的评论更加生动:

Unfortunately, misused comments can be disastrous. Imagine you write a comment describing a certain function, but then you must modify the function’s requirements. It is dangerously easy to forget to change your comment along with the function itself. What you are left with is a confusing comment trying to describe a completely different function. As such, many people will argue that writing clear, self-explanatory code is better than leaving comments.

不幸的是,滥用评论可能会造成灾难性的后果。 想象一下,您写了描述某个功能的注释,但是随后您必须修改该功能的要求。 忘记更改函数本身的注释是很危险的。 剩下的就是一个令人困惑的注释,试图描述一个完全不同的功能。 因此,许多人会认为编写清晰的,不言自明的代码比留下评论要好。

For those who choose to comment, the packages above will provide a more expressive commenting experience.

对于那些选择发表评论的人,以上软件包将提供更富有表现力的评论经验。

The duplicate line function, code snippets, Bracket Colorizer, and Better Comments are all tools that I personally use and benefit from. Its little things like these that help make coding an enjoyable, or at least tolerable, endeavor. Hopefully, you picked up a new trick to make your life easier! Happy hacking!

重复行功能,代码段,括号着色器和更好的注释都是我个人使用并受益的工具。 像这样的小事情有助于使编码成为一件令人愉快的事情,或者至少是可以忍受的事情。 希望您选择了一个新技巧,使您的生活更轻松! 骇客骇客!

翻译自: https://medium.com/swlh/beginners-these-tricks-will-accelerate-your-coding-647f6bb3fc26

黑客初学者刷屏技巧

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。

发布者:全栈程序员-用户IM,转载请注明出处:https://javaforall.cn/134600.html原文链接:https://javaforall.cn

【正版授权,激活自己账号】: Jetbrains全家桶Ide使用,1年售后保障,每天仅需1毛

【官方授权 正版激活】: 官方授权 正版激活 支持Jetbrains家族下所有IDE 使用个人JB账号...

(0)


相关推荐

  • 以图搜图百度识图_检索什么意思

    以图搜图百度识图_检索什么意思以图识图——基于内容的图片检索CBIR(ContentBasedImageRetrieval)

  • cdn加速配置_开启cdn加速

    cdn加速配置_开启cdn加速配置方法同上篇文章一样CDN加速配置,阿里云cdn内配置好以后即可剩下把前端服务器nginx内的证书文件上传以及配置写好即可。后端服务器也同上配置证书下载上传服务器配置好nginx即可。如果都配置好以后,不可以访问时,注意查看前端请求接口是否为https方式。如果为http时,检查是否更新服务器成功,如果成功后还不可以正常访问时,前端修改代码如下:vue.config.js内添加下行代码。index.html下添加代码:https:true完毕!…

  • vb中copymemory如何用_vb中lcase函数

    vb中copymemory如何用_vb中lcase函数vb中copymemory函数的使用挺耐人寻味的。copymemory的使用说明资料书上就一句“该函数用于将一块内存的数据从一个位置复制到另一个位置”。其参数数据类型destinationasany,sourceasany。尽管是any型可理解成任一类型但是我看很多地方都说参数是指针类型的。因此起初我很不解,既然是指针型的参数我们往往直接将变量传递过去而不是变量的地址传递过去不是非法的吗?

    2022年10月28日
  • jar包和war包区别及理解

    jar包和war包区别及理解在开发阶段不适合使用war包,因为在开发阶段,经常需要添加或删除Web应用程序的内容,更新Servlet类文件,而每一次改动后,重新建立war包将是一件浪费时间的事情。在产品发布阶段,使用war文件比较合适的,因为在这个时候,几乎不需要再做什么改动了。jar包jar是类的归档文件JAR(JavaArchive,Java归档文件)是与平台无关的文件格式,它允许将许多文件组合成一个压缩文件,为J2EE应用程序创建的jar文件是EAR文件(企业jar文件),jar文件格式以流行的ZIP文

  • 蓝桥杯单片机必备知识—–(11)EEPROM

    蓝桥杯单片机必备知识—–(11)EEPROM

  • php navigator,navigator对象

    php navigator,navigator对象navigator对象appName:浏览器软件名称,主要用来判断客户使用的是什么核心的浏览器。如果是IE浏览器的话,返回值为:MicrosoftInternetExplorer如果是Firefox浏览器的话,返回值为:NetscapeappVersion:浏览器软件的核心版本号。systemLanguage:系统语言userLanguage:用户语言platform:平台HTML>ph…

发表回复

您的电子邮箱地址不会被公开。

关注全栈程序员社区公众号