Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Good programming practices updated

620 views

Published on

Published in: Technology, Education
  • Login to see the comments

  • Be the first to like this

Good programming practices updated

  1. 1. Good Programming Practices Jack Boys
  2. 2. 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
  3. 3. 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
  4. 4. 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
  5. 5. BE A CODING NINJA
  6. 6. 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
  7. 7. 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
  8. 8. 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.
  9. 9. 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.
  10. 10. 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
  11. 11. 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.
  12. 12. Class Activity Write 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
  13. 13. Solution #include<iostream> using namespace std; void main() { if (!printf("Muhammadn")){} else printf("Iqbaln"); system("pause"); }

×