0% found this document useful (0 votes)
22 views

Industrial Perspective in Java Programming CSV0652T - Unit - 1 - Part - I - Raw

Uploaded by

niranjal
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
22 views

Industrial Perspective in Java Programming CSV0652T - Unit - 1 - Part - I - Raw

Uploaded by

niranjal
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 12

COURSE NAME : Industrial Perspective in Java

Programming
COURSE CODE : CSV0652T
UNIT I
PART-I

INSTRUCTOR:
DR. NIRANJAN LAL @ SRM IST, DELHI NCR CAMPUS
[email protected] (personal)
[email protected] (professional)
http://cooltechie.in/
Java Best Practices
• In computer programming, best practices are a
set of informal rules that many developers follow
to improve software quality, readability, and
maintainability.
• Best practices are especially beneficial where an
application remains in use for long periods of
time, so that it was initially developed by one
team and then subsequently maintained by a
different group of people.
Java Programming Best
Practices at a Glance
 Use Proper Naming Conventions
 Class Members Should be Private
 Use Underscores in lengthy Numeric Literals
 Avoid empty catch Blocks
 Use StringBuilder or StringBuffer for String Concatenation
 Avoid Redundant Initializations
 Using enhanced for loops instead of for loops with a counter
 Proper handling of Null Pointer Exceptions
Java Programming Best
Practices at a Glance
 Use Proper Naming Conventions
 Class Members Should be Private
 Use Underscores in lengthy Numeric
Literals
 Avoid empty catch Blocks
 Use StringBuilder or StringBuffer
for String Concatenation Snake Case: Python, Ruby, JavaScript
(variable and function names)
 Avoid Redundant Initializations
Camel Case: Go, JavaScript, Java, C#
 Using enhanced for loops instead (variable and function names)
of for loops with a counter Pascal Case: Go, C#, Java, TypeScript (class
 Proper handling of Null Pointer and type names)
Exceptions Kebab Case: HTML, CSS (class names, file
names, and URLs)
Java Programming Best
Practices at a Glance
Access Modifiers in Java-The access modifiers
 Use Proper Naming Conventions in Java specify the accessibility or scope of a
 Class Members Should be Private field, method, constructor, or class.
 Use Underscores in lengthy Numeric
Literals
 Avoid empty catch Blocks
 Use StringBuilder or StringBuffer
for String Concatenation
 Avoid Redundant Initializations
 Using enhanced for loops instead
of for loops with a counter
 Proper handling of Null Pointer
Exceptions
int minUploadSize = 05_437_326; long debitBalance = 5_000_000_000_000_000L; float pi = 3.141_592_653_589F;

Java Programming Best


Practices at a Glance
int minUploadSize = 05437326;
 Use Proper Naming Conventions long debitBalance =
5000000000000000L;
 Class Members Should be Private float pi = 3.141592653589F;
 Use Underscores in lengthy Numeric
Literals
 Avoid empty catch Blocks
 Use StringBuilder or StringBuffer
for String Concatenation int minUploadSize = 05437326;
 Avoid Redundant Initializations long debitBalance =
 Using enhanced for loops instead 5000000000000000L; float pi =
of for loops with a counter 3.141592653589F;
 Proper handling of Null Pointer
Exceptions
Java Programming Best
Practices at a Glance
 Use Proper Naming Conventions
 Class Members Should be Private
 Use Underscores in lengthy Numeric
Literals
 Avoid empty catch Blocks
 Use StringBuilder or StringBuffer fo
r String Concatenation
 Avoid Redundant Initializations
 Using enhanced for loops instead
of for loops with a counter
 Proper handling of Null Pointer
Exceptions
Java Programming Best
Practices at a Glance
 Use Proper Naming Conventions
 Class Members Should be Private
 Use Underscores in lengthy Numeric Literals
 Avoid empty catch Blocks
 Use StringBuilder or StringBuffer for String
Concatenation
 Avoid Redundant Initializations
 Using enhanced for loops instead of for loops
with a counter
 Proper handling of Null Pointer Exceptions
Java Programming Best
Practices at a Glance
 Float or Double: which is the right choice?
 Use of single quotes and double quotes
 Avoiding Memory leaks
 Return Empty Collections instead of returning Null elements
 Efficient use of Strings
 Unnecessary Objects Creation
 Proper Commenting
Why Java is so popular?

 Scalability-Java offers many tools for building


scalable, enterprise software. It supports
modularity, static checking, and advanced tools for
analysis, and debugging.
 Garbage collection-Java offers an automatic
memory management mechanism, known as garbage
collection, which greatly improves the speed of
applications.
 Cross-platform capabilities-Java is cross-platform
capable, which means that a compiled program can
be easily run on different devices.
Why Java is so popular?

 Multi-threading-Multi-threading allows concurrent


Java applications to execute commands on multiple
threads simultaneously, which greatly improves
software performance and hardware utilization.
 Active developer community-Thanks to Java’s
popularity, developers are provided with numerous
sources of invaluable knowledge essential to their
work.
 Energy efficiency-Java is one of the fastest and
most energy-efficient object-oriented programming
languages.
Learning Resources

 https://stratoflow.com/java-best-practices/
 https://www.developer.com/languages/javascript/java-best-
practices/

You might also like