This document discusses code conventions for an enterprise-grade microservices framework for Node.js. It recommends using code conventions to improve code readability and maintainability as most software is maintained by others than the original authors. It provides guidelines for file naming, formatting of Java source code files with package and import statements, class declarations, indentation, and line wrapping.
Chapter 01 of the lecture Style & Design Principles taught at SAE Institute Hamburg.
Introduction to naming conventions, type and member design, exception design and common .NET interfaces.
MCA GTU Student can refer GTU Project guidelines, This Project guide lines will helpful for Live GTU Projects as well as for project creation. By TOPS Technologies. http://www.tops-int.com
its an amazing slide for u.you become helpful to read this slide.its clear your basic about java.you can learn a lot to read this slide properly.its consist of comment,java documentation ,java doc tags,class ,static keyword,j option panes,How do you convert a String to an int data type in Java? etc
Chapter 01 of the lecture Style & Design Principles taught at SAE Institute Hamburg.
Introduction to naming conventions, type and member design, exception design and common .NET interfaces.
MCA GTU Student can refer GTU Project guidelines, This Project guide lines will helpful for Live GTU Projects as well as for project creation. By TOPS Technologies. http://www.tops-int.com
its an amazing slide for u.you become helpful to read this slide.its clear your basic about java.you can learn a lot to read this slide properly.its consist of comment,java documentation ,java doc tags,class ,static keyword,j option panes,How do you convert a String to an int data type in Java? etc
its all about java variable.....you may also learn about various data type by this slide. freshers become helpful to read out this.this slides also may helpful in your varsity java course class .in this slide there is vast discussion about java variable
Writing Clean Code (Recommendations by Robert Martin)Shirish Bari
Writing clean code is every developers responsibility.
I have studied book " Clean Code: A Handbook of Agile Software Craftsmanship" by Robert C Martin. Based on my understanding about book I have listed down recommendations for writing down clean code.These can be good starting point while learning to write clean code
Csharp expressions, types, variables, control statements of both selection and loops, methods, namespaces, classes, inheritance and polymorphism topics are included in this presentation.
In this presentation, the most important object oriented topics and features of C# is discussed. The session was presented in 42nd Session of CodeWeekend and it is the 3rd week of C# + CS50 Series of Training.
This presentation provides the information on python including the topics Python features, applications, variables and operators in python, control statements, numbers, strings, print formatting, list and list comprehension, dictionaries, tuples, files, sets, boolean, mehtods and functions, lambda expressions and a sample project using Python.
its all about java variable.....you may also learn about various data type by this slide. freshers become helpful to read out this.this slides also may helpful in your varsity java course class .in this slide there is vast discussion about java variable
Writing Clean Code (Recommendations by Robert Martin)Shirish Bari
Writing clean code is every developers responsibility.
I have studied book " Clean Code: A Handbook of Agile Software Craftsmanship" by Robert C Martin. Based on my understanding about book I have listed down recommendations for writing down clean code.These can be good starting point while learning to write clean code
Csharp expressions, types, variables, control statements of both selection and loops, methods, namespaces, classes, inheritance and polymorphism topics are included in this presentation.
In this presentation, the most important object oriented topics and features of C# is discussed. The session was presented in 42nd Session of CodeWeekend and it is the 3rd week of C# + CS50 Series of Training.
This presentation provides the information on python including the topics Python features, applications, variables and operators in python, control statements, numbers, strings, print formatting, list and list comprehension, dictionaries, tuples, files, sets, boolean, mehtods and functions, lambda expressions and a sample project using Python.
Write code that is easy to understand by using meaningful variable and function names, proper indentation, and comments where necessary. The next developer (which could be future you!) should be able to understand your code without much effort.
f the error isn’t serious, and it is in the committable state, we can still commit the transaction. But if something went wrong and is in an uncommittable state, then we can roll back the transaction. This can be done by simply running and analyzing the XACT_STATE function that reports transaction state.
Do not store large objects in session. Storing large objects in session may consume lot of server memory depending on the number of users.
Do not store large objects in View State. It will increase page load time.
ASP.NET Code should not contain any business logic. It should call a business logic component.
Use Style sheet for providing consistent look and feel to an application.
Handle exceptions gracefully use global exception handling [Page_Error Or Application_Error].
Don’t use absolute paths – until and unless you have strong reason to do so. Prefer to use Server.MapPath(“~/…..”);
Avoid Copy – Pasting same code everywhere. Better to put them in Base Class or create new utility class.
Editing
Collapses existing regions to provide a high-level view of the types and members (CTRL + M + O)
Removes all outlining information from the whole document. (CTRL + M + P)
Toggles the currently selected collapsed region. (CTRL + M + M)
Inserts // at the beginning of the current line or every line of the current selection. (CTRL + K + C)
Removes the // at the beginning of the current line or every line of the current selection. (CTRL + K + U)
Formats the current document according to the indentation and code formatting settings specified on the Formatting pane under Tools | Options | Text Editor | C#. (CTRL + K + D)
Intellisense
Displays the available options on the smart tag menu. (CTRL + K + I)
Causes a visible completion list to become transparent. (CTRL)
Debugging
Conditional Debug
Launch in Debug Mode (F5)
Launch without Debug Mode (CTRL + F5)
Sets or removes a breakpoint at the current line (F9)
To Remove all breakpoints (CTRL + SHIFT + F9)
Navigation
Displays a list of all references for the symbol selected (CTRL + K + R)
Moves the cursor location to the matching brace in the source file (CTRL + ])
Navigates to the declaration for the selected symbol in code (F12)
Moves to the previously browsed line of code (CTRL + -)
Displays the selected item in Code view of the editor (F7)
Switches to Design view for the current document. Available only in Source view (SHIFT + F7)
Switches to Source view for the current document. Available only in Design view (SHIFT + F7)
Displays the Quick tab of the Find and Replace dialog box (CTRL + F)
Displays the Go To Line dialog box (CTRL + G)
Do not store large objects in session. Storing large objects in session may consume lot of server memory depending on the number of u
Scripting experts from Inductive Automation cover general best practices that will help you add flexibility and customization to HMI, SCADA, IIoT, and other industrial applications. Some specific tips about using scripting in the Ignition platform will be included as well.
In this webinar, learn more about:
• Common scripting pitfalls and how to avoid them
• The best programming languages to use
• Things to consider before using scripting
• How scripting environments work
• Scripting timesavers
• And more
Scripting experts from Inductive Automation cover general best practices that will help you add flexibility and customization to HMI, SCADA, IIoT, and other industrial applications. Some specific tips about using scripting in the Ignition platform will be included as well.
In this webinar, learn more about:
• Common scripting pitfalls and how to avoid them
• The best programming languages to use
• Things to consider before using scripting
• How scripting environments work
• Scripting timesavers
• And more
Game Programming 04 - Style & Design PrinciplesNick Pruehs
Chapter 4 of the lecture Game Programming taught at HAW Hamburg.
Introduction to naming conventions, type and member design, exception design and common .NET interfaces.
1. Coding Conventions [Part I]
An Enterprise-grade Micro Services Framework
For Node.js
MIT Licensed
Roshan Kulkarni
Hardik Patel
Mindstix Labs
2. Why Have Code Conventions
• 80% of the lifetime cost of a piece of software goes to
maintenance.
• Hardly any software is maintained for its whole life by
the original author.
• Code conventions improve the readability of the
software, allowing engineers to understand new code
more quickly and thoroughly.
• If you ship your source code as a product, you need
to make sure it is as well packaged and clean as any
other product you create.
THANK YOU!
3. Java Files
• Java Software uses the following file suffixes:
• Java source - .java
• Java Bytecode - .class
• Frequently used file names include:
• GNUmakefile - The preferred name for makefiles.
• README - The preferred name for the file that summarises the
contents of a particular directory.
• A file consists of sections that should be separated by blank lines and
an optional comment identifying each section.
• Files longer than 2000 lines are cumbersome and should be avoided.
THANK YOU!
4. Java Source Files
• Each Java source file contains a single public class
or interface. When private classes and interfaces are
associated with a public class, you can put them in
the same source file as the public class. The public
class should be the first class or interface in the file.
• Java source files have the following ordering:
• Beginning comments.
• Package and Import statements.
• Class and interface declarations.
THANK YOU!
5. Java Source Files
• Beginning Comments
• All source files should begin with a c-style comment that
lists the class name, version information, date, and
copyright notice:
/*
* Classname
*
* Version information
*
* Date
*
* Copyright notice
*/
THANK YOU!
6. Java Source Files
• Package and Import Statements
• The first non-comment line of most Java source
files is a package statement. After that, import
statements can follow. For example,
package com.mindstix;
import java.awt.peer.CanvasPeer;
THANK YOU!
7. Java Source Files
• Class and Interface Declarations
• The following table describes the parts of a class
or interface declaration, in the order that they
should appear.
THANK YOU!
#
Part of Class/Interface
Declaration
Notes
1
Class/interface
documentation comment
See ‘Documentation Comments’ section
below.
2
class or interface
statement
8. Java Source Files
THANK YOU!
#
Part of Class/Interface
Declaration
Notes
3
Class/interface
implementation comment
(/*...*/), if necessary
This comment should contain any class-wide
or interface-wide information that wasn’t
appropriate for the class/interface
documentation comment.
4 Class (static) variables
First the public class variables, then the
protected, then package level (no access
modifier), and then the private.
5 Instance variables
First public, the protected, then package
level (no access modifier), and then private.
6 Constructors
7 Methods
These methods should be grouped by
functionality rather than by scope or
accessibility. For example, a private class
method can be in between two public
instance methods. The goal is to make
reading and understanding the code easier.
9. Indentation
• Four spaces should be used as the unit of indentation.
The exact construction of the indentation (spaces vs.
tabs) is unspecified. Tabs must be set exactly every 8
spaces (not 4).
• Line Length
• Avoid lines longer than 80 characters, since they
are not handled well by many terminals and tools.
• Note: Examples for use in documentation should
have a shorter line length - generally no more than
70 characters.
THANK YOU!
10. Indentation
• Wrapping Lines
• When an expression will not fit on a single line, break it according to
these general principles:
• Break after a comma.
• Break before an operator.
• Prefer higher-level breaks to lower-level breaks.
• Align the new line with the beginning of the expression at the
same level on previous line.
• If the above rules lead to confusing code or to code that’s
squished up against the right margin, just indent 8 spaces
instead.
THANK YOU!
11. Indentation
• Here are some examples of breaking method calls:
someMethod(longExpression1, longExpression2,
longExpression3, LongExpression4);
var = someMethod(longExpression1,
someMethod2(longExpression2,
longExpression3));
• Following are two examples breaking an arithmetic expression. The
first is preferred, since the break occurs outside the parenthesised
expression, which is at higher level.
// PREFER
longName1 = longName2 * (longName3 + longName4)
+ 4 * longName5;
// AVOID
longName1 = longName2 * (longName3
+ longName4) + 4 * longName5;
THANK YOU!
12. Indentation
• Following are two examples of indenting method declarations.
The first is the conventional case. The second would shift the
second and third lines to the far right if it used conventional
indentation, so instead it indents only 8 spaces.
// CONVENTIONAL INDENTATION
someMethod(int anArg, Object anotherArg, String
yetAnotherArg,
Object andStillAnother) {
. . .
}
// INDENT 8 SPACES TO AVOID VERY DEEP INDENTS
private static synchronized horkingLongMethodName(int anArg,
Object anotherArg, String yetAnotherArg,
Object andStillAnother) {
. . .
}THANK YOU!
13. Indentation
• Line wrapping for if statements should generally use the 8-space rule, since
conventional (4 space) indentation makes seeing the body difficult. For
example:
// DON’T USE THIS INDENTATION
if ((condition1 && condition2)
|| (condition3 && condition4)
||!(condition5 && condition6)) { // BAD WRAPS
doSomethingAboutIt(); // MAKE THIS LINE EASY TO MISS
}
// USE THIS INDENTATION INSTEAD
if ((condition1 && condition2)
|| (condition3 && condition4)
||!(condition5 && condition6)) {
doSomethingAboutIt();
}
// OR USE THIS
if ((condition1 && condition2) || (condition3 && condition4)
||!(condition5 && condition6)) {
doSomethingAboutIt();
}THANK YOU!
14. Indentation
• Here are three acceptable ways to format ternary
expressions:
alpha = (aLongBooleanExpression) ? beta : gamma;
alpha = (aLongBooleanExpression) ? beta
: gamma;
alpha = (aLongBooleanExpression)
? beta
: gamma;
THANK YOU!
15. To be covered Next…
• Comments
• Declarations
• Statements
• White Space
• Naming Conventions
• Programming Practices
• Code Examples
THANK YOU!