[程序员英语口语][Clean code]Chapter1-4 Casing conventions & programming languages

Clean code

chapter1 naming

1.4 Casing conventions & programming languages

Now, before we dive into the concrete examples and the different variations and so on… we also have to stop at the important topic of casing.

In programming, we got four main ways of writing our names, four main casing, and that would be snake_case, camelCase, PascalCase, kebap-case.

Now snake_case looks like this: is_valid, send_response, where multiple words are separated with an underscore and everything is lowercase, for example, you use snake_case a lot in python, there, you use it for variable names, for function names and for method names, and that’s what you saw in the initial examples in the first course section already.

Now python uses snake_case, many other programming languages like jave and javascript use camelCase, which looks like this, isValid, sendResponse.

The same name, but now not with an underscore between words, but instead there is no separation between words, except for the starting character of the next word in line. The first character in the name is always a lowercase one, like the iin theisValid, and the s in the sendResponse, but then every word in that phrase starts with an uppercase charater, like the uppercase v in Valid and the uppercase R in the Response, again, this CamelCase notation is used by many other programming languages, but it’s used for the same things as python uses snake_case, and that would be (for) variables , function and methods.

Now another notation which we know is PascalCase, It looks like this:IsValid, SendResponse, and this is used by many programming languages. For example, by python, java and javascript for class name. Class names are typically written in PascalCase. And when it comes to kabob-case, it looks like this, and we, for example, know this from HTML, where HTML elements we might be building.

Now these are the four main ways of writting things, and mostly it comes down to conventions. When to use which notation, I outlined the most important conventions here. For example, for python, we use snake_case for variables, function and methods. And style guides for your favorite programming languages typically tell you which notation to use for what.

I wanna emphasize, of course, that no matter which casing you used, the name in the end, is always the same, just the way you write it is different, and therefore again, which programming language you choose does not really have an impact on how to write clean code, This is just an extra convention you should keep in mind, because, of course, following languages-specific conventions is also a part of writting clean code.

  1. dive into 深入地

Let’s dive into the detail of this code snippet

  1. variations 变体

This Class have five variations.

  1. stop at 停在

I want to stop at this function and dive into the detail.

  1. kebap-case 烤肉串体

You should use kebap-case in HTML

  1. underscore 下划线

  2. lowercase 小写 uppercase 大写

  3. use … a lot 使用得很多

This command is used a lot in our daily development

  1. separation 分隔

  2. character 字符

This is a character array

  1. notation表示法

  2. comes down 归纳为

When it comes down to a simple rule.

  1. keep in mind 记住

We should keep in mind this important convention.

  1. languages-specific 语言特定的 (specific特定的)

I will talk about this specific type of class later.

Tips:这个单词/短语列表只是一些推荐学习的用词,但是此系列的重点不仅仅在于这些,而在于如何用英文表达一些逻辑,适合积累口语,大家可以仔细品读短文,找到自己喜欢的表达方式。

推荐的学习方法:先听几遍保证能听懂70%,再对照原文进行学习,找到自己喜欢的表达后反复造句让自己加深印象,跟着原文读一遍,然后再自己读一遍。

Source:【整洁代码 Clean Code-哔哩哔哩】 https://b23.tv/skgyGMC

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值