1 00:00:00,750 --> 00:00:01,770 ‫Welcome back. 2 00:00:01,800 --> 00:00:08,760 ‫In this video, we are going to have a look at some naming conventions and also at coding standards. 3 00:00:08,760 --> 00:00:15,810 ‫So regarding the class names, you should use Pascal casing, which means, for example, if you have 4 00:00:15,810 --> 00:00:23,370 ‫a class which is called client activity, then you should use a capital letter at the beginning and 5 00:00:23,370 --> 00:00:26,250 ‫then a capital letter at the second word. 6 00:00:26,250 --> 00:00:27,600 ‫So these are two different words. 7 00:00:27,600 --> 00:00:29,640 ‫It's called client and then activity. 8 00:00:29,640 --> 00:00:36,420 ‫And each new word should be written with a capital letter, but they should be written together. 9 00:00:36,420 --> 00:00:44,640 ‫So here class names like client activity. 10 00:00:47,700 --> 00:00:50,100 ‫The same thing goes for method names. 11 00:00:50,730 --> 00:00:57,030 ‫Method names like calculate value. 12 00:00:58,500 --> 00:01:07,200 ‫All right, so it's the same approach, capital C and then capital V for value, then use camel casing 13 00:01:07,200 --> 00:01:11,910 ‫for arguments and or for method arguments like this arts. 14 00:01:12,060 --> 00:01:20,640 ‫So here you would have, for example, method arguments like first number. 15 00:01:22,770 --> 00:01:27,720 ‫And the same goes for local variables. 16 00:01:30,520 --> 00:01:33,070 ‫Like item count. 17 00:01:33,490 --> 00:01:37,240 ‫Next, try to avoid abbreviations. 18 00:01:37,240 --> 00:01:48,940 ‫So for example, if you have something like user control, not use R, CTR or something like that. 19 00:01:49,060 --> 00:02:02,260 ‫So use user control instead of user CTR for variable names or in general. 20 00:02:03,760 --> 00:02:04,870 ‫Actually, it's in general. 21 00:02:04,870 --> 00:02:10,510 ‫So you shouldn't use abbreviations like that because it's much easier to read and it really makes sense 22 00:02:10,510 --> 00:02:17,890 ‫to have code that's easy to read, and that starts with the right naming for variables, methods, classes 23 00:02:17,890 --> 00:02:18,730 ‫and so forth. 24 00:02:19,990 --> 00:02:27,760 ‫There are of course exceptions for something like XML, FTP, URI and those kind of things don't use 25 00:02:27,790 --> 00:02:30,760 ‫numbers at the start of variables. 26 00:02:30,760 --> 00:02:39,130 ‫So for example, if we have three or it's an integer, three cars is five. 27 00:02:39,640 --> 00:02:41,440 ‫So that's something you cannot do. 28 00:02:41,440 --> 00:02:43,480 ‫So don't use it at the start. 29 00:02:43,480 --> 00:02:46,390 ‫What you can do is you can use it at the end. 30 00:02:46,390 --> 00:02:51,760 ‫So cars three, you could use that, but you cannot use three cars. 31 00:02:51,790 --> 00:03:01,780 ‫Then regarding underscore, try to avoid cars, start engine for example, try to avoid the underscore 32 00:03:02,590 --> 00:03:05,950 ‫and exceptions are an underscore at the beginning. 33 00:03:05,950 --> 00:03:13,150 ‫So if you want to have an underscore at the start of your variable name and you use that for log in 34 00:03:13,960 --> 00:03:17,020 ‫date or something like that, that would make sense. 35 00:03:17,140 --> 00:03:17,740 ‫All right. 36 00:03:18,820 --> 00:03:20,560 ‫But then it would not be an integer. 37 00:03:20,740 --> 00:03:28,000 ‫Next, try to avoid the capital string capital I and T or int capital boolean. 38 00:03:28,030 --> 00:03:33,190 ‫There are predefined type names like string int pool which are just for that. 39 00:03:33,190 --> 00:03:38,350 ‫So of course you can go ahead and use string or end 3932 or Boolean. 40 00:03:38,350 --> 00:03:44,680 ‫So the classes, but it's really highly preferred to use it that way. 41 00:03:44,680 --> 00:03:50,470 ‫So that's more consistent with the Microsoft DOT net framework and makes code more natural to read. 42 00:03:51,910 --> 00:03:58,360 ‫Also, by the way, for classes, use nouns or noun phrases to name classes. 43 00:03:58,360 --> 00:04:04,390 ‫So for example program or employee or business date or something like that. 44 00:04:04,390 --> 00:04:09,520 ‫So always try to use nouns for classes because that's what they usually should be. 45 00:04:09,520 --> 00:04:12,370 ‫They are for objects and objects usually are nouns. 46 00:04:12,400 --> 00:04:18,550 ‫Methods, however, usually are actions so that you can use, of course, verbs. 47 00:04:18,760 --> 00:04:19,420 ‫All right. 48 00:04:19,420 --> 00:04:23,200 ‫So I'd say those are the most important ones for now. 49 00:04:23,200 --> 00:04:31,930 ‫And if you want to know more about coding conventions in C-sharp, then I recommend to go to do factory 50 00:04:31,930 --> 00:04:36,430 ‫dot com slash reference slash C-sharp coding standards. 51 00:04:36,430 --> 00:04:41,710 ‫And here you'll find some great well, a great article which is just about that. 52 00:04:41,710 --> 00:04:50,440 ‫So he goes into a little more detail on that and he brings up examples which are too far away for us 53 00:04:50,440 --> 00:04:50,710 ‫yet. 54 00:04:50,710 --> 00:04:54,040 ‫So we have seen what classes are, we have seen what methods are and so forth. 55 00:04:54,040 --> 00:05:00,790 ‫But he also goes into things like enemies and interfaces and those kinds of things which we haven't 56 00:05:00,790 --> 00:05:04,480 ‫covered yet, but it will come in handy as soon as we get there. 57 00:05:04,480 --> 00:05:09,820 ‫So we will use enemies and interfaces later on in the course and then it will of course make sense to 58 00:05:09,820 --> 00:05:12,460 ‫also have those coding standards in mind. 59 00:05:12,460 --> 00:05:14,140 ‫But I'm going to take care of that. 60 00:05:14,140 --> 00:05:16,770 ‫And while creating the course, of course. 61 00:05:16,770 --> 00:05:18,940 ‫So I'm going to show it to you later on as well. 62 00:05:19,210 --> 00:05:19,570 ‫All right. 63 00:05:19,570 --> 00:05:23,590 ‫So please check out this website he's done a great job at. 64 00:05:23,590 --> 00:05:30,130 ‫Well, writing it down pretty beautifully, I'd say it's quite easy to understand and read. 65 00:05:30,130 --> 00:05:37,270 ‫And yeah, in the next video we are going to go ahead and check out how to convert a value from one 66 00:05:37,270 --> 00:05:41,260 ‫type to another or even how to cast from one type to another. 67 00:05:41,260 --> 00:05:43,000 ‫So see you in the next video.