--- Video Title: Programming Style Description: Programming Style Watch more Videos at https://www.tutorialspoint.com/videotutorials/index.htm Lecture By: Mr. Arnab Chakraborty, Tutorials Point India Private Limited --- In this session, we are discussing Programming Styling. So, we know that whenever we develop softwares, I use softwares where multiple coders and developers will be working. So, what will happen? I may have to work on a certain code which I haven't developed, which I haven't coded myself. So, I might be working with other developed code. So, in those cases, I have if we can maintain a proper programming style, then it will be convenient for us to write the code, to develop the code accordingly. So, what are the different do's and don'ts are to be maintained, which we are going to discuss in this session only. So, programming style is a set of coding rules followed by all the programmers to write the code and we are considering the best programming practices. When multiple programmers work on the same software project, they frequently need to work with the same code written by some other developer. So, this becomes tedious or at times impossible if all developers do not follow the same standard programming style to code their program. So, the coding style should be universal, should be uniform. So, an appropriate programming style includes using functions and variable names relevant to the intended task. So, that is very important. The variable and the function nomenclature should be done in such a way that it should, it can reflect the purpose of the function or the variable. And using well placed indentation, commenting, remark for the convenience of the reader and overall presentation of the code. So, sometimes we might be working on greyfield projects and it is very very rare in your life you can observe that you are working on green field project. So, that means you are starting with the software development from the very scratch of the project. So, that is a green field. In the most of the cases, we developers always work on the grey field projects. That means software has been developed already. So, now we are going for version, next version, because some change requests have come. So, now we are going for the next version of the software to get developed. In those cases, this variable nomenclature, function nomenclature, indentation, remarking and commenting, documentation of the code is very essential to understand what is the purpose of that code segment understudy. Now, this makes the program code readable and understandable by all, which in turn makes debugging and error solving easier. Also, proper coding style helps ease the documentation and the respective updations. So, what are the coding guidelines? So, let me discuss them one by one. So, practice of coding style varies with the organization, operating system and language of coding itself. So, obviously, organization to organization, this coding style may vary depending upon the language use or the platform or the operating system, whatever you are going to use. So, depending that one, the coding style may get changed. The following coding elements may be defined under coding guidelines of an organization. So, first one is the naming conventions. So, what is the naming convention? This section defines how to name functions, variables, constants and global variables. So, where to use the small letter, where to use the capital letter, where to put a space using say underscore or making the variable names and this particular function names with some proper. So, all these things will have some guidelines, some do's and don'ts will be there. So, that our naming standard should be generic. Next one is the indenting. This is the space left at the beginning of line, usually 2 to 8 character space or single tab. Next one is the white space. So, it is generally omitted at the end of the line. So, this is a white space should not be used at the end of the line. Indentation should be done. So, we should leave some space at the beginning of each and every line to denote that these series of lines are under one block and these series of lines are under another inner block. So, indentations are to be maintained. Next one is the operators. So, defines the rules of writing mathematical assignment and logical operators. For example, assignment operator should be equal to should have the space before and after it as in case of we have written this one as x space is equal to space 2. In this way the statements we are writing this one. Next one is the control structure. The rules of writing if then else case switch while until and for control flow statements solely and in nested fashion. We know that how to write the say nested for loops. So, indentations are to be maintained and how the this block begin and block end marker. Sometimes it is curly braces. Sometimes we might be using begin and end. So, how to maintain them? This is the control structures. How to write them? We should have some generic rule. Next one is the line length and the wrapping. So, defines how many characters should be there in one line. Mostly a line of 80 characters long and wrapping defines how a line should be wrapped if it is too long. So, whenever a line is having a too long, we should wrap it. Otherwise, it is line will go beyond the screen boundary. So, in one view, we cannot read the full line. So, it is not comprehensive. It is not easy to read and understand. So, in those cases, we should do the, we should check this line length and the wrapping. Let us suppose in a particular program, you are writing one SQL query, ok. So, you are writing in this way, select star, you can put enter, you can make the form from the next line. So, select star from say employee, where employee ID is greater than say 1000 and salary is less than 50000. So, you can break this line into, you can write this particular statement and broken into multiple different lines only to make the query readable. So, that is our common practices. So, usually follow that one. Next one, we are having this functions. So, this defines how function should be declared and invoked with and without parameters. Variables. This mentions how variables of different data types are declared and defined. Next one is the comments. It is very important. So, this is one of the important coding components. As a comment included in the code describe what the code actually does and all other associated descriptions. This section also helps creating help documentation for the other developers. So, this commenting and the remarking should be done properly. We can have the line comment, we can have the documentation comment, we can have the block comment. So, different types of commenting blocks are available in our programming construct. So, in this way, in this particular video, we have discussed what are the different and programming styles and what are the do's and don'ts. Thanks for watching this video. TutorialsPoint.com Simply easy learning.