我是编码的新手,所以如何命名“类”? [英] I'm new to coding so how do I name a "class"?

查看:59
本文介绍了我是编码的新手,所以如何命名“类”?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是新手编码所以我如何命名班级?



我尝试过的事情:



我不知道在哪里寻找答案

I'm new to coding so how do i name a "class"?

What I have tried:

I dont know where to look for the answer

推荐答案

你将你的课程命名为相关的任何东西你需要它做什么。



如果你正在写一些东西从你的数据库导出数据上传到第三方你可能不想命名它 XmlWriter你想把它命名为像VendorExport这样的东西。或者类似的东西。



你也应该研究一下SOLID原则。你应该以一种单一的责任来建立自己的课程,而不是在阳光下完成一切的巨大的整体课程。



谷歌的[<一个HREF =https://www.google.com/search?source=hp&ei=AhRZWueQGsTTjwSiqrHICg&q=programming+SOLID+principle&oq=programming+SOLID+principle&gs_l=psy-ab.3..0j0i22i30k1l7。 593.4044.0.4409.28.20.0.0.0.0.286.2327.2j10j3.15.0..2..0 ... 1.1.64.psy-ab..13.15.2325.0..35i39k1j0i131k1j0i20i264k1j0i131i20i264k1.0.cu3i79cwVCwtarget =_ blanktitle =新窗口> ^ ]
You name your classes to be relevent to whatever it is that you need it to do.

If you are writing something to export data from your database to upload to a third party you probably don't want to name it "XmlWriter" you want to name it something relevant like "VendorExport" or something like that.

You should look into SOLID principles as well. You aught to build your classes in such a way that it has a single responsibility rather than 1 huge monolithic class that does everything under the sun.

Google[^]


当您创建用于创建代码的文件并创建类时,它将会是我要求你给你的课程命名。



如果你在谈论你在代码中的内容,那就像是:

public类代码



(或者你想给它命名的任何东西,我只是用Code作为例子。)
When you create your file where you are making your code and you create the class, it will ask you to name your class.

If you are talking about what you put inside the code it would be something like:
public class Code

(or whatever you want to name it, i just used Code as an example.)


引用:

我是新手编码所以我如何命名类?

I'm new to coding so how do i name a "class"?



停止!

书籍和tutos是学习Java或任何其他语言的简单方法,他们以定时的方式介绍概念,通过跳过步骤来简化理解,你将陷入深刻的困境,最终你将花费更多的时间,而不是一开始就正确学习。



你想做的就像从屋顶开始建房子。



数以百万计的人在你面前学习编程,数百万人会跟随,教学方法已知。


Stop!
Books and tutos are the easy way to learn Java or any other language, they introduce concepts in a timed fashion that ease the understanding, by skipping steps, you will put yourself in deep difficulties, and in the end you will spend more time than if learning correctly at first.

What you try to do is like building a house by starting with the roof.

Millions of people have learned programming before you and millions will follow, methods of teaching are known.


这篇关于我是编码的新手,所以如何命名“类”?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆