16
Good Programming Practices Jack Boys

Good programming practices updated

Embed Size (px)

DESCRIPTION

 

Citation preview

Page 1: Good programming practices updated

Good Programming PracticesJack Boys

Page 2: Good programming practices updated

Topics

• Practice Try and Fail• Breaking a Problem: Work In

team• Be a coding Ninja• ABC Always be coding• Bug Debug and error• Testing • Conclusion

Page 3: Good programming practices updated
Page 4: Good programming practices updated

Practice Try and Fail

• Basic of programing: Write Code on paper

• Improve your syntax• Thinking are clear• Improves Ability to remove a bug

or syntax error.• Time your self• Divide a task into subtask• If stuck interview your self• Ask a friend• Don’t love your code

Page 5: Good programming practices updated

Breaking a Problem: Work in Team• Make team of at least 2• Use flow charts flow diagram to

solve a problem• Solve tough coding problem in

front of your team• Admire one for asking and for

giving a solution• Ask the team why we are solving

in certain way• Discuss about alternate solution• In market you have to work like a

team

Page 6: Good programming practices updated
Page 7: Good programming practices updated

BE A CODING NINJA

Page 8: Good programming practices updated

Be a Coding Ninja

• Nail the programming fundaments

• Write an attractive peace of code• Add handsome comment to your

code, Comment should be in same level of code

• Commenting should be simple that after a year when you read your comment you can understand what your code is doing

Page 9: Good programming practices updated

Be a Coding Ninja

• Indent your code, it improve readability

• Use switch statement instead of if else if else

• Introduce functions in code• Work think like a pro• Use standard variable naming i.e.

Pascal casing and camel casing• Variable name should be

meaning full

Page 10: Good programming practices updated

Be a Coding ninja

• Every line of code should be useful

• A method should be not more than 30 lines

• Refactor your code, eliminate useless code

• Make the variable private or protected and expose public/ protected properties.

Page 11: Good programming practices updated

ABC: Always be coding• Join programming society in your

institute• Participate in programing

competition i.e. online, inside outside university

• Teach your junior it will help you keeping your coding saw sharped

• Programming is not something you can master in a couple of weeks. Set yourself a realistic target of a month and a half.

Page 12: Good programming practices updated

Bug Debug and error

• Your code should crash gracefully and with honor

• Use try catch throw technique its called exception handling

• Exception handling will help you finding the error

• Be a code snippiest you should know why your code have crash

Page 13: Good programming practices updated

Test your Program

• Test your program that it gives the correct answer we desired

• End user of your program are dull so your code should be flexible

• Give your code to your friend for testing

• Test weather the way we started to solve the problem had we covered all of them.

Page 14: Good programming practices updated

Class ActivityWrite down a c program which prints your complete name in the output screen, you have to use If else statement. One printf command will print your first name while the second will print your second. You have to use If else statement.You have to use GOOD PROGRAMMING PRACTICE to break this problem.HINT: One printf will be executed in checking of if statment

Page 15: Good programming practices updated

Solution

#include<iostream>using namespace std;void main(){if (!printf("Muhammad\n")){}elseprintf("Iqbal\n");system("pause");}

Page 16: Good programming practices updated