Question

In: Computer Science

a. In your own words, explain what is meant by good programming practice. Give two examples,...

a. In your own words, explain what is meant by good programming practice. Give two examples, one with good programming practice and one without good programming practice

Note:java Programming Language

Solutions

Expert Solution

Good programming practice means your programme code will be in well manner means you have to follow all the programming conventions like :

1)- Using naming conventions

2)- Ordering Class Members by Scopes

3)- Class members should be private

4)- Using Underscores in Numeric Literals

5)- Avoid Empty Catch Blocks

6)- Using StringBuilder or StringBuffer instead of String Concatenation

7)- Using Enums or Constant class instead of constant Interface

8)- Avoid Redundant Initialization (0-false-null)

9)- Using Interface Reference to Collections

10)- avoid using for loops with indexes

Example of good programming practice

public class Employee_Details // Naming conventions

{

private int Employee_ID;

private String Employee_Name; // class members should be private and use underscore between two name

Employee_Details(int ID, String Name) //use a constructor for accesing the private data or use public function

{

Employee_ID=ID;

Employee_Name=Name;

}

public static void main(String args[])

{

Employee_Details ob=new Employee_Details(23,"Rohit");

}

Example of bad programming style

class Abc //without using a valuable name of the class

{

int a=5; // without using naming conventions

int b=3;

public static void mian(String args[])

{

int c=a+b;

System.out.println(c);

}

}

*Note=>  Program will run in both conditon but by using conventions your program is understandable to your team member and they will continue your program in case of your absence


Related Solutions

In your own words, explain what is meant by an Array and ArrayList. Give two examples...
In your own words, explain what is meant by an Array and ArrayList. Give two examples that illustrate the main difference Note:Java programming language
In your own words, explain what is meant by ‘corporate social responsibility’. Provide two examples.
In your own words, explain what is meant by ‘corporate social responsibility’. Provide two examples.
What causes trigeminal neuralgia? Explain in your own words and give examples.
What causes trigeminal neuralgia? Explain in your own words and give examples.
In your own words, describe what is meant by “fault tolerance” in a network, and give...
In your own words, describe what is meant by “fault tolerance” in a network, and give an example of how it could be implemented in a small office LAN with 25 workstations and two servers, including Internet access for the workstations, but not the internal servers.
Explain the following in your own words (be specific): What is meant by a 95% confidence...
Explain the following in your own words (be specific): What is meant by a 95% confidence interval? What is meant by the true mean and how does it relate to the confidence interval? Explain Standard Error or Margin of error and how it helps define the confidence interval?
. Explain in your own words what is meant by the term ‘price elasticity of demand’....
. Explain in your own words what is meant by the term ‘price elasticity of demand’. 2. Why is it important for business managers to understand price elasticity of demand? 3. When price elasticity of demand is greater than 1, we say that the good is: INELASTIC / ELASTIC / UNITARY ELASTIC / POSITIVELY ELASTIC 4. When price elasticity of demand is less than 1, we say that a good is: INELASTIC / ELASTIC / UNITARY ELASTIC / NEGATIVELY ELASTIC...
With respect to Ohm's Law, explain in your own words what is meant when it is...
With respect to Ohm's Law, explain in your own words what is meant when it is said that there is "a linear response between voltage and current." Name a specific device in which Ohm's Law is a good description of the relationship between current and voltage, and one for which it is not. Do your best to explain this failure in terms of the basic properties of electrons flowing through a conducting material. Describe the temperature response of resistors in...
( please in your own words) Explain what is meant by quality management and why is...
( please in your own words) Explain what is meant by quality management and why is it important?
In your own words, explain magnetic fields, forces, and give examples in daily life. In your...
In your own words, explain magnetic fields, forces, and give examples in daily life. In your own words, explain the workings of direct current motors. In your own words, explain current loops and solenoids.
Explain conservation of momentum and give examples in daily life. In your own words, explain impulse...
Explain conservation of momentum and give examples in daily life. In your own words, explain impulse and give examples in daily life. In your own words, center of mass and give examples in daily life please reply in text! (not handwritten)
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT