SlideShare a Scribd company logo
Hello,
My name is Raman and I am the CTO for McKinsey’s India Build Hub. Congratulations for
clearing the Hackerrank test. You will now be moving to our code-pairing interviews. In this
interview, you will be given a problem and we would expect you to develop a solution (in a
programming language of your choice) using your problem-solving skills and adhering to
software engineering best practices. Both these aspects (problem solving and SE best
practices) are very important for succeeding in this round. You will be assigned a colleague
of mine who will be evaluating you on its basis.
Given below are some guidelines which will help you demonstrate your skills clearly to the
evaluator.
1. Ask questions and state your assumptions: This will help establish a common
understanding of the problem statement and clarify some of the ambiguous aspects of
the given problem statement.
2. Write pseudo-code first: Pseudo code helps you to think clearly without getting
bogged down by syntax and other constructs of programming languages.
3. Think of edge cases and solve for them too in consultation with your evaluator.
4. Think of optimization opportunities in terms of recursion, nested loops etc. Think of
algorithm classes (Backtracking, Dynamic Programming, Greedy or others) that will
help you optimize further.
5. Develop code in your favourite programming language but avoid using internal
algorithm/collection libraries. The intention here is to demonstrate how strong your
fundamentals are and not how good you are at using libraries.
6. Please give extra attention to good coding practices. We have attached coding
practices for some of the commonly used programming languages. Please practice
adhering to them before the code-pairing round. Well-written, readable, maintainable
code is of paramount importance to us and that is a skill that we expect from all in our
team.
7. Develop adequate test cases and test your solution before attempting to submit to the
system. We also want to see how well you test your code before letting the system do
it.
Your evaluation will be based on all how well you do in all of the above aspects. Needless to
say, we consider this as one of the most critical part of our evaluation and we want you to do
extremely well here.
Given below are some of the general programming best practices guidelines for you to start
practicing and come prepared.
We all look forward to meeting you. All the best.
General Guidelines:
1. Writing well-structured codes
2. Working code is better than non-working code
3. Having Proper Comments
4. Avoid heavy nesting
a. Loops can become very slow if you don’t do them right
b. keep computation-heavy code outside loops
5. Optimize loops
6. Proper Naming of Variables, Classes, Functions and Modules
7. Do not use Language Specific Build-in Methods
E.g. - Do not use Build In String Methods, Array Methods, Data Structures, etc
JavaScript Coding Best Practices:
Naming Convention
We sometimes come across variables like x1, fe2 or abc in JavaScript, or — on the other
end of the spectrum — variable names
like incrementorForMainLoopWhichSpansFromTenToTwenty or createNewMemberIfAgeOv
erTwentyOneAndMoonIsFull.
None of these make much sense — good variable and function names should be easy to
understand and tell you what is going on.
 camelCase for identifier names (variables and functions)
 names start with a letter
 spaces around operators
 2 spaces for indentation of code blocks
 Comments with // or /* */
Python Coding Best Practices:
Naming Convention
 A variable name must start with a letter or the underscore character
 A variable name cannot start with a number
 A variable name can only contain alpha-numeric characters and
underscores (A-z, 0-9, and _ )
 Variable names are case-sensitive
 comment starts with a hash character (#)
 multiline comment (""")
C++ Coding Best Practices:
Naming Convention
 The first character of function/ method argument names should be
lower case
 No special symbols can be used in variable names except for the
underscore
 Digits may be used in the variable name but only after the alphabet
 The global constants should be all capital letters separated with ‘_’
 Pointer variables should be prepended with ‘p’ and place the asterisk
‘*’ close to the variable name instead of pointer type
 The /* (slash, asterisk) characters, followed by any sequence of characters
(including new lines), followed by the */ characters. This syntax is the same as
ANSI C.
 The // (two slashes) characters, followed by any sequence of characters.
Java Coding Best Practices:
Naming Convention
 Method name should start with lowercase letter, be a verb such as main(), print(),
println()
 If the method name contains multiple words, start it with a lowercase letter followed
by an uppercase letter such as actionPerformed().
 Variable should start with a lowercase letter such as id, name. We should use
camelcases variable names. E.g. firstName, lastName
 Avoid using one-character variables such as x, y, z.
 Have meaningful variable and method names
 Constant should be in uppercase letters such as RED, YELLOW.
 Never leave a Catch Blocks empty.
 Using enhanced for loops instead of for loops with counter

More Related Content

PPTX
Coding standards
PDF
UNIT I cloud computing ppt cloud ccd all about the cloud computing
PPTX
CLEAN CODING AND DEVOPS Final.pptx
PPTX
Clean code
PPTX
Coding standards
PDF
Crafting high quality code
PPT
Clean code
PDF
Coding standards
UNIT I cloud computing ppt cloud ccd all about the cloud computing
CLEAN CODING AND DEVOPS Final.pptx
Clean code
Coding standards
Crafting high quality code
Clean code

Similar to Coding Best Practices.docx (20)

PPTX
Coding standard and coding guideline
PPTX
Variables
PPT
Clean Code summary
PPTX
Clean code - DSC DYPCOE
PPTX
Best-Practices-in-Writing-Clean-Maintainable-Code
PDF
Source Code Quality
PDF
Coding Guidelines in CPP
PDF
Coding Guidelines - Crafting Clean Code
PPT
9-Coding.ppt
PDF
Software Development Standard Operating Procedure
PPT
11. Lecture 19 Code standards and review.ppt
PPTX
Writing Clean Code (Recommendations by Robert Martin)
PPT
Clean Code
PPT
Coding Standards
PPTX
Clean Code - Writing code for human
PDF
Clean Code
PPT
Writing Good Code
PDF
[DevDay2018] Let’s all get along. Clean Code please! - By: Christophe K. Ngo,...
PPTX
Programming style guildelines
Coding standard and coding guideline
Variables
Clean Code summary
Clean code - DSC DYPCOE
Best-Practices-in-Writing-Clean-Maintainable-Code
Source Code Quality
Coding Guidelines in CPP
Coding Guidelines - Crafting Clean Code
9-Coding.ppt
Software Development Standard Operating Procedure
11. Lecture 19 Code standards and review.ppt
Writing Clean Code (Recommendations by Robert Martin)
Clean Code
Coding Standards
Clean Code - Writing code for human
Clean Code
Writing Good Code
[DevDay2018] Let’s all get along. Clean Code please! - By: Christophe K. Ngo,...
Programming style guildelines
Ad

Recently uploaded (20)

PPTX
KTU 2019 -S7-MCN 401 MODULE 2-VINAY.pptx
PPTX
additive manufacturing of ss316l using mig welding
PDF
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...
PDF
Evaluating the Democratization of the Turkish Armed Forces from a Normative P...
PDF
PPT on Performance Review to get promotions
PPTX
OOP with Java - Java Introduction (Basics)
PDF
R24 SURVEYING LAB MANUAL for civil enggi
PDF
keyrequirementskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
PPTX
Lecture Notes Electrical Wiring System Components
PDF
July 2025 - Top 10 Read Articles in International Journal of Software Enginee...
DOCX
573137875-Attendance-Management-System-original
PDF
BMEC211 - INTRODUCTION TO MECHATRONICS-1.pdf
PDF
Operating System & Kernel Study Guide-1 - converted.pdf
PPTX
UNIT-1 - COAL BASED THERMAL POWER PLANTS
PDF
Well-logging-methods_new................
PPTX
MET 305 2019 SCHEME MODULE 2 COMPLETE.pptx
PPTX
CH1 Production IntroductoryConcepts.pptx
PPT
Project quality management in manufacturing
PPT
CRASH COURSE IN ALTERNATIVE PLUMBING CLASS
PPTX
CARTOGRAPHY AND GEOINFORMATION VISUALIZATION chapter1 NPTE (2).pptx
KTU 2019 -S7-MCN 401 MODULE 2-VINAY.pptx
additive manufacturing of ss316l using mig welding
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...
Evaluating the Democratization of the Turkish Armed Forces from a Normative P...
PPT on Performance Review to get promotions
OOP with Java - Java Introduction (Basics)
R24 SURVEYING LAB MANUAL for civil enggi
keyrequirementskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
Lecture Notes Electrical Wiring System Components
July 2025 - Top 10 Read Articles in International Journal of Software Enginee...
573137875-Attendance-Management-System-original
BMEC211 - INTRODUCTION TO MECHATRONICS-1.pdf
Operating System & Kernel Study Guide-1 - converted.pdf
UNIT-1 - COAL BASED THERMAL POWER PLANTS
Well-logging-methods_new................
MET 305 2019 SCHEME MODULE 2 COMPLETE.pptx
CH1 Production IntroductoryConcepts.pptx
Project quality management in manufacturing
CRASH COURSE IN ALTERNATIVE PLUMBING CLASS
CARTOGRAPHY AND GEOINFORMATION VISUALIZATION chapter1 NPTE (2).pptx
Ad

Coding Best Practices.docx

  • 1. Hello, My name is Raman and I am the CTO for McKinsey’s India Build Hub. Congratulations for clearing the Hackerrank test. You will now be moving to our code-pairing interviews. In this interview, you will be given a problem and we would expect you to develop a solution (in a programming language of your choice) using your problem-solving skills and adhering to software engineering best practices. Both these aspects (problem solving and SE best practices) are very important for succeeding in this round. You will be assigned a colleague of mine who will be evaluating you on its basis. Given below are some guidelines which will help you demonstrate your skills clearly to the evaluator. 1. Ask questions and state your assumptions: This will help establish a common understanding of the problem statement and clarify some of the ambiguous aspects of the given problem statement. 2. Write pseudo-code first: Pseudo code helps you to think clearly without getting bogged down by syntax and other constructs of programming languages. 3. Think of edge cases and solve for them too in consultation with your evaluator. 4. Think of optimization opportunities in terms of recursion, nested loops etc. Think of algorithm classes (Backtracking, Dynamic Programming, Greedy or others) that will help you optimize further. 5. Develop code in your favourite programming language but avoid using internal algorithm/collection libraries. The intention here is to demonstrate how strong your fundamentals are and not how good you are at using libraries. 6. Please give extra attention to good coding practices. We have attached coding practices for some of the commonly used programming languages. Please practice adhering to them before the code-pairing round. Well-written, readable, maintainable code is of paramount importance to us and that is a skill that we expect from all in our team. 7. Develop adequate test cases and test your solution before attempting to submit to the system. We also want to see how well you test your code before letting the system do it. Your evaluation will be based on all how well you do in all of the above aspects. Needless to say, we consider this as one of the most critical part of our evaluation and we want you to do extremely well here. Given below are some of the general programming best practices guidelines for you to start practicing and come prepared. We all look forward to meeting you. All the best.
  • 2. General Guidelines: 1. Writing well-structured codes 2. Working code is better than non-working code 3. Having Proper Comments 4. Avoid heavy nesting a. Loops can become very slow if you don’t do them right b. keep computation-heavy code outside loops 5. Optimize loops 6. Proper Naming of Variables, Classes, Functions and Modules 7. Do not use Language Specific Build-in Methods E.g. - Do not use Build In String Methods, Array Methods, Data Structures, etc JavaScript Coding Best Practices: Naming Convention We sometimes come across variables like x1, fe2 or abc in JavaScript, or — on the other end of the spectrum — variable names like incrementorForMainLoopWhichSpansFromTenToTwenty or createNewMemberIfAgeOv erTwentyOneAndMoonIsFull. None of these make much sense — good variable and function names should be easy to understand and tell you what is going on.  camelCase for identifier names (variables and functions)  names start with a letter  spaces around operators  2 spaces for indentation of code blocks  Comments with // or /* */
  • 3. Python Coding Best Practices: Naming Convention  A variable name must start with a letter or the underscore character  A variable name cannot start with a number  A variable name can only contain alpha-numeric characters and underscores (A-z, 0-9, and _ )  Variable names are case-sensitive  comment starts with a hash character (#)  multiline comment (""") C++ Coding Best Practices: Naming Convention  The first character of function/ method argument names should be lower case  No special symbols can be used in variable names except for the underscore  Digits may be used in the variable name but only after the alphabet  The global constants should be all capital letters separated with ‘_’  Pointer variables should be prepended with ‘p’ and place the asterisk ‘*’ close to the variable name instead of pointer type  The /* (slash, asterisk) characters, followed by any sequence of characters (including new lines), followed by the */ characters. This syntax is the same as ANSI C.  The // (two slashes) characters, followed by any sequence of characters. Java Coding Best Practices: Naming Convention  Method name should start with lowercase letter, be a verb such as main(), print(), println()  If the method name contains multiple words, start it with a lowercase letter followed by an uppercase letter such as actionPerformed().  Variable should start with a lowercase letter such as id, name. We should use camelcases variable names. E.g. firstName, lastName  Avoid using one-character variables such as x, y, z.  Have meaningful variable and method names  Constant should be in uppercase letters such as RED, YELLOW.  Never leave a Catch Blocks empty.  Using enhanced for loops instead of for loops with counter