SlideShare a Scribd company logo
1 of 47
Download to read offline
CODE REVIEW PROCESSCODE REVIEW PROCESS
BOGDAN GUSIEVBOGDAN GUSIEV
CODE REVIEW TENDS TO BE NATURALCODE REVIEW TENDS TO BE NATURAL
CODE REVIEW YOURSELFCODE REVIEW YOURSELF
ASKING FOR HELPASKING FOR HELP
SPONDANUOUS CODE REVIEW PROBLEM:SPONDANUOUS CODE REVIEW PROBLEM:
TOO LATETOO LATE
EVERYTHING HAD CHANGED BYEVERYTHING HAD CHANGED BY
GITHUBGITHUB
DO I NEED A CODE REVIEW?DO I NEED A CODE REVIEW?
IMHO: NEW PROJECTSIMHO: NEW PROJECTS
DON'T NEED A FORMAL CODE REVIEW AT ALLDON'T NEED A FORMAL CODE REVIEW AT ALL
CODE REVIEW EVOLUTIONCODE REVIEW EVOLUTION
1. Spontanuous Code Reviews
2. "When I am not sure" code reviews
3. Formal Code Review Process
4. Required code review for certain changes
5. Required code reviews for everything
Fails Driven Process
CODE REVIEW PROPERTIESCODE REVIEW PROPERTIES
NECESSITYNECESSITY
Optional
Required
PROCESSPROCESS
Informal
Formal
PEOPLEPEOPLE
Dedicated
Distributed
POSITION IN A PROCESSPOSITION IN A PROCESS
1. Planning
2. Coding
3. Code Review
4. QA
5. Release
QA <-> Code Review
Formally QA a er Code Review
1. Make a fork (optional)
2. Create a Branch
3. Open a Pull Request
4. Wait for review
5. Discuss & Fix
6. Merge
CODE REVIEW ISCODE REVIEW IS
A PROCESS OFA PROCESS OF REVIEWING AND APPROVINGREVIEWING AND APPROVING CODE CHANGESCODE CHANGES
BEFOREBEFORE THEY GET ACCEPTED TO THE MAINSTREAMTHEY GET ACCEPTED TO THE MAINSTREAM
HOW TO REVIEW?HOW TO REVIEW?
FIX COMMON THINGS FIRST?FIX COMMON THINGS FIRST?
Typos
Whitespace
Code Style
Wrong Direction!
WHERE TO LOOK?WHERE TO LOOK?
Things that are most significant should be reviewed first
which are ones that are the most hard to change.
TOP TO BOTTOM CODE REVIEWTOP TO BOTTOM CODE REVIEW
1. Architecture
1. Problem Solution
2. Public APIs
3. Database Schema
4. Object Oriented Design
5. Public Method Signatures
2. Implementation
1. Classes & Methods
2. Views
3. Tests
4. Code Style, Typos, Whitespace
PROBLEM SOLUTIONPROBLEM SOLUTION
1. Problem makes sense
2. Problem Solved
3. High Level Security
4. High Level Performance
ONLY SHOW CUSTOM PROPERTIES WITH AT LEAST ONE VALUE IN SELECTONLY SHOW CUSTOM PROPERTIES WITH AT LEAST ONE VALUE IN SELECT
def selectable_product_categories
+ ProductCategory.with_at_least_one_product
- ProductCategory.all
end
ProductCategory.
where("not exists(select * from products where ...)").
count # => 0
HIGH LEVEL SECURITYHIGH LEVEL SECURITY
EX. FEATURE:EX. FEATURE:
LOGIN USER AUTOMATICALLY WHEN IT CLICKS ON THE LINK IN THE EMAILLOGIN USER AUTOMATICALLY WHEN IT CLICKS ON THE LINK IN THE EMAIL
THIS IS NOT VERY SECURETHIS IS NOT VERY SECURE
HIGH LEVEL PERFORMANCEHIGH LEVEL PERFORMANCE
CHECK IF THE CHANGECHECK IF THE CHANGE
Touches Performance sensitive code
Will be slow for particular data
No pagination when there are 1000+ records to display
PUBLIC APISPUBLIC APIS
USING HTTP API AS EXAMPLEUSING HTTP API AS EXAMPLE
1. Efficiency
2. Logical Endpoints
3. Request Parameters
4. Response Format
WHATEVER THAT IS DOCUMENTEDWHATEVER THAT IS DOCUMENTED
API INEFFICIENCY EXAMPLEAPI INEFFICIENCY EXAMPLE
EFFICIENT WAY?EFFICIENT WAY?
Purchase.has_one :referral
GET /purchases/:order_number
{
id: 1,
order_number: '1838382',
referral_id: 17
}
POST /referrals/:id/approve
POST /purchases/:order_number/referral/approve
RESPONSE FORMATRESPONSE FORMAT
# Easier
render json: @campaign.view_setups.to_json
# Extensible
render json: {view_setups: @campaign.view_setups.to_json}
BAD API EXAMPLEBAD API EXAMPLE
Talkable.publish('talkable_offer_close', null, true);
Talkable.publish('offer_close', null, true);
ANALYZE USAGE FIRSTANALYZE USAGE FIRST
BUT NOT IMPLEMENTATIONBUT NOT IMPLEMENTATION
setCustomProperty: function (person, properties) {
...
}
setCustomProperty('advocate', {key: value})
setCustomProperty('friend', {key: value})
setAdvocateCustomProperty: function(properties) {
private_stuff.setCustomProperty("advocate", properties);
},
setFriendCustomProperty: function(properties) {
private_stuff.setCustomProperty("friend", properties);
},
DATABASE SCHEMADATABASE SCHEMA
1. Relations between tables
2. Data Columns
3. Naming
EFFICIENT RELATIONSEFFICIENT RELATIONS
1. What are the variants?
2. Was the best one selected?
EFFICIENT SCHEMAEFFICIENT SCHEMA
add_column :images, :dimension, :string
class Image < AR::Base
def width
dimension.split("x").first
end
def height
dimension.split("x").last
end
end
add_column :images, :width, :integer
add_column :images, :height, :integer
DATA SHOULD BEDATA SHOULD BE EASY TO READEASY TO READ
EVEN IF IT MAKES ITEVEN IF IT MAKES IT HARDER TO WRITEHARDER TO WRITE
OBJECT ORIENTED DESIGNOBJECT ORIENTED DESIGN
1. Reflects Real World
2. Inheritance
3. Constructors
REVIEWING CONSTRUCTORSREVIEWING CONSTRUCTORS
CIRCULAR DEPENDENCYCIRCULAR DEPENDENCY
class Field
def initialize
@cells = Array.new(10) do
Array.new(10) { Cell.new(self) }
end
end
end
class Cell
def initialize(field)
@field = field
end
end
OBJECT CONSTRUCTORS ARE IMPORTANT:OBJECT CONSTRUCTORS ARE IMPORTANT:
Which things are required to use an object?
What are the object responsibilities?
Theoretical limit
Which methods can be implemented in the object?
Which things would need to be passed to methods as arguments?
Constructor defines object API
REVIEWING CONSTRUCTORSREVIEWING CONSTRUCTORS
UNDEFINED CONTEXTUNDEFINED CONTEXT
class ApplicationController
before_action do
WhateverRequestAnalyzer.new(request).analyze
end
end
CrawlerRequestAnalyzer.new(
request.user_agent, request.url, request.content_type
).analyze
PUBLIC METHOD SIGNATURESPUBLIC METHOD SIGNATURES
1. Placement
2. Arguments
3. Name
METHOD PLACEMENTMETHOD PLACEMENT
class User
def approve!(referral)
end
# OR
class Referral
def approve!(user)
end
METHOD ARGUMENTSMETHOD ARGUMENTS
this.extractUserData(this.data)
IMPLEMENTATIONIMPLEMENTATION
CLASSES & METHOD BODIESCLASSES & METHOD BODIES
Each method or class separately
Check one by one:
1. Approach & Algorithm
2. Performance
3. Security
4. Minimalism
5. Local Variable Names
PERFORMANCE & VULNERABILITIESPERFORMANCE & VULNERABILITIES
In the ideal world performance and vulnerabilities
should not change the code structure.
In practice it can but we should try hard
to fix performance problems only at the implementation level
GOOD PERFORMANCE PATCHGOOD PERFORMANCE PATCH
def core_options
- { header: name, description: description, group: group }
+ @core_options ||= { header: name, description: description, grou
end
- @campaign.locale_entries.each do
+ @campaign.locale_entries.preload(:variants).each do
GOOD VULNERABILITY PATCHGOOD VULNERABILITY PATCH
-{{ advocate_info.first_name }}
+{{ advocate_info.first_name | escape }}
SECURITYSECURITY
Approach Security (Step 1)
Is it secure to have this feature?
Is it secure to implement the feature this way?
Vulnerabilities
XSS
Allowed Parameters
Backend Authorisation check
Authorisation for UI elements
TESTSTESTS
1. Use Cases Coverage
2. Formal Code Coverage
3. Tests Implementation
TOP TO BOTTOM IDEATOP TO BOTTOM IDEA
IT IS BAD TO:IT IS BAD TO:
Discuss the method name before the method existence as a fact
Discuss Code Style before implementation itself
BOSS CONTROL APPROACHBOSS CONTROL APPROACH
Ensure top points from the list are always performed
Choose X things on top of the list to double-check and delegate the rest
completely
CODE REVIEW CULTURECODE REVIEW CULTURE
Be Polite
Admit good things
First things first
Reduce number of cycles
Save Author's time
Save Your time
TOP TO BOTTOM CODE REVIEWTOP TO BOTTOM CODE REVIEW
1. Architecture
1. Problem Solution
2. Public APIs
3. Database Schema
4. Object Oriented Design
5. Public Method Signatures
2. Implementation
1. Classes & Methods
2. Views
3. Test Coverage
4. Code Style, Typos, Whitespace

More Related Content

What's hot

XPDays Ukraine: Legacy
XPDays Ukraine: LegacyXPDays Ukraine: Legacy
XPDays Ukraine: LegacyVictor_Cr
 
Working with Legacy Code
Working with Legacy CodeWorking with Legacy Code
Working with Legacy CodeEyal Golan
 
Working Effectively with Legacy Code: Lessons in Practice
Working Effectively with Legacy Code: Lessons in PracticeWorking Effectively with Legacy Code: Lessons in Practice
Working Effectively with Legacy Code: Lessons in PracticeAmar Shah
 
Test-Driven Development (TDD)
Test-Driven Development (TDD)Test-Driven Development (TDD)
Test-Driven Development (TDD)Brian Rasmussen
 
Design Patterns For 70% Of Programmers In The World
Design Patterns For 70% Of Programmers In The WorldDesign Patterns For 70% Of Programmers In The World
Design Patterns For 70% Of Programmers In The WorldSaurabh Moody
 
Working With Legacy Code
Working With Legacy CodeWorking With Legacy Code
Working With Legacy CodeAndrea Polci
 
Refactoring Applications using SOLID Principles
Refactoring Applications using SOLID PrinciplesRefactoring Applications using SOLID Principles
Refactoring Applications using SOLID PrinciplesSteven Smith
 
Design Patterns: From STUPID to SOLID code
Design Patterns: From STUPID to SOLID codeDesign Patterns: From STUPID to SOLID code
Design Patterns: From STUPID to SOLID codePaulo Gandra de Sousa
 
Why Your Test Suite Sucks - PHPCon PL 2015
Why Your Test Suite Sucks - PHPCon PL 2015Why Your Test Suite Sucks - PHPCon PL 2015
Why Your Test Suite Sucks - PHPCon PL 2015CiaranMcNulty
 
Back-2-Basics: Code Contracts
Back-2-Basics: Code ContractsBack-2-Basics: Code Contracts
Back-2-Basics: Code ContractsDavid McCarter
 
Writing clean code in C# and .NET
Writing clean code in C# and .NETWriting clean code in C# and .NET
Writing clean code in C# and .NETDror Helper
 
A journey to_be_a_software_craftsman
A journey to_be_a_software_craftsmanA journey to_be_a_software_craftsman
A journey to_be_a_software_craftsmanJaehoon Oh
 

What's hot (20)

XPDays Ukraine: Legacy
XPDays Ukraine: LegacyXPDays Ukraine: Legacy
XPDays Ukraine: Legacy
 
Working with Legacy Code
Working with Legacy CodeWorking with Legacy Code
Working with Legacy Code
 
Refactoring
RefactoringRefactoring
Refactoring
 
Working Effectively with Legacy Code: Lessons in Practice
Working Effectively with Legacy Code: Lessons in PracticeWorking Effectively with Legacy Code: Lessons in Practice
Working Effectively with Legacy Code: Lessons in Practice
 
Test-Driven Development (TDD)
Test-Driven Development (TDD)Test-Driven Development (TDD)
Test-Driven Development (TDD)
 
Design Patterns For 70% Of Programmers In The World
Design Patterns For 70% Of Programmers In The WorldDesign Patterns For 70% Of Programmers In The World
Design Patterns For 70% Of Programmers In The World
 
BDD Primer
BDD PrimerBDD Primer
BDD Primer
 
Working Effectively with Legacy Code
Working Effectively with Legacy CodeWorking Effectively with Legacy Code
Working Effectively with Legacy Code
 
Working With Legacy Code
Working With Legacy CodeWorking With Legacy Code
Working With Legacy Code
 
Refactoring Applications using SOLID Principles
Refactoring Applications using SOLID PrinciplesRefactoring Applications using SOLID Principles
Refactoring Applications using SOLID Principles
 
Write readable tests
Write readable testsWrite readable tests
Write readable tests
 
Design Patterns: From STUPID to SOLID code
Design Patterns: From STUPID to SOLID codeDesign Patterns: From STUPID to SOLID code
Design Patterns: From STUPID to SOLID code
 
Why Your Test Suite Sucks - PHPCon PL 2015
Why Your Test Suite Sucks - PHPCon PL 2015Why Your Test Suite Sucks - PHPCon PL 2015
Why Your Test Suite Sucks - PHPCon PL 2015
 
Back-2-Basics: Code Contracts
Back-2-Basics: Code ContractsBack-2-Basics: Code Contracts
Back-2-Basics: Code Contracts
 
Creational Design Patterns
Creational Design PatternsCreational Design Patterns
Creational Design Patterns
 
Writing clean code in C# and .NET
Writing clean code in C# and .NETWriting clean code in C# and .NET
Writing clean code in C# and .NET
 
SAD10 - Refactoring
SAD10 - RefactoringSAD10 - Refactoring
SAD10 - Refactoring
 
A journey to_be_a_software_craftsman
A journey to_be_a_software_craftsmanA journey to_be_a_software_craftsman
A journey to_be_a_software_craftsman
 
Spring AOP
Spring AOPSpring AOP
Spring AOP
 
Clean tests good tests
Clean tests   good testsClean tests   good tests
Clean tests good tests
 

Similar to Professional Code Reviews - Bogdan Gusiev

New Ideas for Old Code - Greach
New Ideas for Old Code - GreachNew Ideas for Old Code - Greach
New Ideas for Old Code - GreachHamletDRC
 
6 Traits of a Successful Test Automation Architecture
6 Traits of a Successful Test Automation Architecture6 Traits of a Successful Test Automation Architecture
6 Traits of a Successful Test Automation ArchitectureErdem YILDIRIM
 
Measuring Your Code
Measuring Your CodeMeasuring Your Code
Measuring Your CodeNate Abele
 
Measuring Your Code 2.0
Measuring Your Code 2.0Measuring Your Code 2.0
Measuring Your Code 2.0Nate Abele
 
A Future where we don’t write tests
A Future where we don’t write testsA Future where we don’t write tests
A Future where we don’t write testsFelix Dobslaw
 
2011-02-03 LA RubyConf Rails3 TDD Workshop
2011-02-03 LA RubyConf Rails3 TDD Workshop2011-02-03 LA RubyConf Rails3 TDD Workshop
2011-02-03 LA RubyConf Rails3 TDD WorkshopWolfram Arnold
 
How I Learned to Stop Worrying and Love Legacy Code - Ox:Agile 2018
How I Learned to Stop Worrying and Love Legacy Code - Ox:Agile 2018How I Learned to Stop Worrying and Love Legacy Code - Ox:Agile 2018
How I Learned to Stop Worrying and Love Legacy Code - Ox:Agile 2018Mike Harris
 
Agile_goa_2013_clean_code_tdd
Agile_goa_2013_clean_code_tddAgile_goa_2013_clean_code_tdd
Agile_goa_2013_clean_code_tddSrinivasa GV
 
Assuring the code quality of share point solutions and apps - Matthias Einig
Assuring the code quality of share point solutions and apps - Matthias EinigAssuring the code quality of share point solutions and apps - Matthias Einig
Assuring the code quality of share point solutions and apps - Matthias EinigSPC Adriatics
 
Behavior Driven Development by Example
Behavior Driven Development by ExampleBehavior Driven Development by Example
Behavior Driven Development by ExampleNalin Goonawardana
 
Testing in a glance
Testing in a glanceTesting in a glance
Testing in a glanceRajesh Kumar
 
Grails unit testing
Grails unit testingGrails unit testing
Grails unit testingpleeps
 
Working Effectively With Legacy Perl Code
Working Effectively With Legacy Perl CodeWorking Effectively With Legacy Perl Code
Working Effectively With Legacy Perl Codeerikmsp
 
GlobalLogic Test Automation Online TechTalk “Test Driven Development as a Per...
GlobalLogic Test Automation Online TechTalk “Test Driven Development as a Per...GlobalLogic Test Automation Online TechTalk “Test Driven Development as a Per...
GlobalLogic Test Automation Online TechTalk “Test Driven Development as a Per...GlobalLogic Ukraine
 
It's all about behaviour, also in php - phpspec
It's all about behaviour, also in php - phpspecIt's all about behaviour, also in php - phpspec
It's all about behaviour, also in php - phpspecGiulio De Donato
 
3 Ways to test your ColdFusion API - 2017 Adobe CF Summit
3 Ways to test your ColdFusion API - 2017 Adobe CF Summit3 Ways to test your ColdFusion API - 2017 Adobe CF Summit
3 Ways to test your ColdFusion API - 2017 Adobe CF SummitOrtus Solutions, Corp
 
Testing ASP.NET - Progressive.NET
Testing ASP.NET - Progressive.NETTesting ASP.NET - Progressive.NET
Testing ASP.NET - Progressive.NETBen Hall
 
Code Quality Practice and Tools
Code Quality Practice and ToolsCode Quality Practice and Tools
Code Quality Practice and ToolsBob Paulin
 

Similar to Professional Code Reviews - Bogdan Gusiev (20)

New Ideas for Old Code - Greach
New Ideas for Old Code - GreachNew Ideas for Old Code - Greach
New Ideas for Old Code - Greach
 
6 Traits of a Successful Test Automation Architecture
6 Traits of a Successful Test Automation Architecture6 Traits of a Successful Test Automation Architecture
6 Traits of a Successful Test Automation Architecture
 
Measuring Your Code
Measuring Your CodeMeasuring Your Code
Measuring Your Code
 
Measuring Your Code 2.0
Measuring Your Code 2.0Measuring Your Code 2.0
Measuring Your Code 2.0
 
A Future where we don’t write tests
A Future where we don’t write testsA Future where we don’t write tests
A Future where we don’t write tests
 
UI Testing
UI TestingUI Testing
UI Testing
 
2011-02-03 LA RubyConf Rails3 TDD Workshop
2011-02-03 LA RubyConf Rails3 TDD Workshop2011-02-03 LA RubyConf Rails3 TDD Workshop
2011-02-03 LA RubyConf Rails3 TDD Workshop
 
How I Learned to Stop Worrying and Love Legacy Code - Ox:Agile 2018
How I Learned to Stop Worrying and Love Legacy Code - Ox:Agile 2018How I Learned to Stop Worrying and Love Legacy Code - Ox:Agile 2018
How I Learned to Stop Worrying and Love Legacy Code - Ox:Agile 2018
 
Agile_goa_2013_clean_code_tdd
Agile_goa_2013_clean_code_tddAgile_goa_2013_clean_code_tdd
Agile_goa_2013_clean_code_tdd
 
Clean code
Clean codeClean code
Clean code
 
Assuring the code quality of share point solutions and apps - Matthias Einig
Assuring the code quality of share point solutions and apps - Matthias EinigAssuring the code quality of share point solutions and apps - Matthias Einig
Assuring the code quality of share point solutions and apps - Matthias Einig
 
Behavior Driven Development by Example
Behavior Driven Development by ExampleBehavior Driven Development by Example
Behavior Driven Development by Example
 
Testing in a glance
Testing in a glanceTesting in a glance
Testing in a glance
 
Grails unit testing
Grails unit testingGrails unit testing
Grails unit testing
 
Working Effectively With Legacy Perl Code
Working Effectively With Legacy Perl CodeWorking Effectively With Legacy Perl Code
Working Effectively With Legacy Perl Code
 
GlobalLogic Test Automation Online TechTalk “Test Driven Development as a Per...
GlobalLogic Test Automation Online TechTalk “Test Driven Development as a Per...GlobalLogic Test Automation Online TechTalk “Test Driven Development as a Per...
GlobalLogic Test Automation Online TechTalk “Test Driven Development as a Per...
 
It's all about behaviour, also in php - phpspec
It's all about behaviour, also in php - phpspecIt's all about behaviour, also in php - phpspec
It's all about behaviour, also in php - phpspec
 
3 Ways to test your ColdFusion API - 2017 Adobe CF Summit
3 Ways to test your ColdFusion API - 2017 Adobe CF Summit3 Ways to test your ColdFusion API - 2017 Adobe CF Summit
3 Ways to test your ColdFusion API - 2017 Adobe CF Summit
 
Testing ASP.NET - Progressive.NET
Testing ASP.NET - Progressive.NETTesting ASP.NET - Progressive.NET
Testing ASP.NET - Progressive.NET
 
Code Quality Practice and Tools
Code Quality Practice and ToolsCode Quality Practice and Tools
Code Quality Practice and Tools
 

More from Ruby Meditation

Is this Legacy or Revenant Code? - Sergey Sergyenko | Ruby Meditation 30
Is this Legacy or Revenant Code? - Sergey Sergyenko  | Ruby Meditation 30Is this Legacy or Revenant Code? - Sergey Sergyenko  | Ruby Meditation 30
Is this Legacy or Revenant Code? - Sergey Sergyenko | Ruby Meditation 30Ruby Meditation
 
Life with GraphQL API: good practices and unresolved issues - Roman Dubrovsky...
Life with GraphQL API: good practices and unresolved issues - Roman Dubrovsky...Life with GraphQL API: good practices and unresolved issues - Roman Dubrovsky...
Life with GraphQL API: good practices and unresolved issues - Roman Dubrovsky...Ruby Meditation
 
Where is your license, dude? - Viacheslav Miroshnychenko | Ruby Meditation 29
Where is your license, dude? - Viacheslav Miroshnychenko | Ruby Meditation 29Where is your license, dude? - Viacheslav Miroshnychenko | Ruby Meditation 29
Where is your license, dude? - Viacheslav Miroshnychenko | Ruby Meditation 29Ruby Meditation
 
Dry-validation update. Dry-validation vs Dry-schema 1.0 - Aleksandra Stolyar ...
Dry-validation update. Dry-validation vs Dry-schema 1.0 - Aleksandra Stolyar ...Dry-validation update. Dry-validation vs Dry-schema 1.0 - Aleksandra Stolyar ...
Dry-validation update. Dry-validation vs Dry-schema 1.0 - Aleksandra Stolyar ...Ruby Meditation
 
How to cook Rabbit on Production - Bohdan Parshentsev | Ruby Meditation 28
How to cook Rabbit on Production - Bohdan Parshentsev | Ruby Meditation 28 How to cook Rabbit on Production - Bohdan Parshentsev | Ruby Meditation 28
How to cook Rabbit on Production - Bohdan Parshentsev | Ruby Meditation 28 Ruby Meditation
 
How to cook Rabbit on Production - Serhiy Nazarov | Ruby Meditation 28
How to cook Rabbit on Production - Serhiy Nazarov | Ruby Meditation 28How to cook Rabbit on Production - Serhiy Nazarov | Ruby Meditation 28
How to cook Rabbit on Production - Serhiy Nazarov | Ruby Meditation 28Ruby Meditation
 
Reinventing the wheel - why do it and how to feel good about it - Julik Tarkh...
Reinventing the wheel - why do it and how to feel good about it - Julik Tarkh...Reinventing the wheel - why do it and how to feel good about it - Julik Tarkh...
Reinventing the wheel - why do it and how to feel good about it - Julik Tarkh...Ruby Meditation
 
Performance Optimization 101 for Ruby developers - Nihad Abbasov (ENG) | Ruby...
Performance Optimization 101 for Ruby developers - Nihad Abbasov (ENG) | Ruby...Performance Optimization 101 for Ruby developers - Nihad Abbasov (ENG) | Ruby...
Performance Optimization 101 for Ruby developers - Nihad Abbasov (ENG) | Ruby...Ruby Meditation
 
Use cases for Serverless Technologies - Ruslan Tolstov (RUS) | Ruby Meditatio...
Use cases for Serverless Technologies - Ruslan Tolstov (RUS) | Ruby Meditatio...Use cases for Serverless Technologies - Ruslan Tolstov (RUS) | Ruby Meditatio...
Use cases for Serverless Technologies - Ruslan Tolstov (RUS) | Ruby Meditatio...Ruby Meditation
 
The Trailblazer Ride from the If Jungle into a Civilised Railway Station - Or...
The Trailblazer Ride from the If Jungle into a Civilised Railway Station - Or...The Trailblazer Ride from the If Jungle into a Civilised Railway Station - Or...
The Trailblazer Ride from the If Jungle into a Civilised Railway Station - Or...Ruby Meditation
 
What/How to do with GraphQL? - Valentyn Ostakh (ENG) | Ruby Meditation 27
What/How to do with GraphQL? - Valentyn Ostakh (ENG) | Ruby Meditation 27What/How to do with GraphQL? - Valentyn Ostakh (ENG) | Ruby Meditation 27
What/How to do with GraphQL? - Valentyn Ostakh (ENG) | Ruby Meditation 27Ruby Meditation
 
New features in Rails 6 - Nihad Abbasov (RUS) | Ruby Meditation 26
New features in Rails 6 -  Nihad Abbasov (RUS) | Ruby Meditation 26New features in Rails 6 -  Nihad Abbasov (RUS) | Ruby Meditation 26
New features in Rails 6 - Nihad Abbasov (RUS) | Ruby Meditation 26Ruby Meditation
 
Security Scanning Overview - Tetiana Chupryna (RUS) | Ruby Meditation 26
Security Scanning Overview - Tetiana Chupryna (RUS) | Ruby Meditation 26Security Scanning Overview - Tetiana Chupryna (RUS) | Ruby Meditation 26
Security Scanning Overview - Tetiana Chupryna (RUS) | Ruby Meditation 26Ruby Meditation
 
Teach your application eloquence. Logs, metrics, traces - Dmytro Shapovalov (...
Teach your application eloquence. Logs, metrics, traces - Dmytro Shapovalov (...Teach your application eloquence. Logs, metrics, traces - Dmytro Shapovalov (...
Teach your application eloquence. Logs, metrics, traces - Dmytro Shapovalov (...Ruby Meditation
 
Best practices. Exploring - Ike Kurghinyan (RUS) | Ruby Meditation 26
Best practices. Exploring - Ike Kurghinyan (RUS) | Ruby Meditation 26Best practices. Exploring - Ike Kurghinyan (RUS) | Ruby Meditation 26
Best practices. Exploring - Ike Kurghinyan (RUS) | Ruby Meditation 26Ruby Meditation
 
Road to A/B testing - Alexey Vasiliev (ENG) | Ruby Meditation 25
Road to A/B testing - Alexey Vasiliev (ENG) | Ruby Meditation 25Road to A/B testing - Alexey Vasiliev (ENG) | Ruby Meditation 25
Road to A/B testing - Alexey Vasiliev (ENG) | Ruby Meditation 25Ruby Meditation
 
Concurrency in production. Real life example - Dmytro Herasymuk | Ruby Medita...
Concurrency in production. Real life example - Dmytro Herasymuk | Ruby Medita...Concurrency in production. Real life example - Dmytro Herasymuk | Ruby Medita...
Concurrency in production. Real life example - Dmytro Herasymuk | Ruby Medita...Ruby Meditation
 
Data encryption for Ruby web applications - Dmytro Shapovalov (RUS) | Ruby Me...
Data encryption for Ruby web applications - Dmytro Shapovalov (RUS) | Ruby Me...Data encryption for Ruby web applications - Dmytro Shapovalov (RUS) | Ruby Me...
Data encryption for Ruby web applications - Dmytro Shapovalov (RUS) | Ruby Me...Ruby Meditation
 
Rails App performance at the limit - Bogdan Gusiev
Rails App performance at the limit - Bogdan GusievRails App performance at the limit - Bogdan Gusiev
Rails App performance at the limit - Bogdan GusievRuby Meditation
 
GDPR. Next Y2K in 2018? - Anton Tkachov | Ruby Meditation #23
GDPR. Next Y2K in 2018? - Anton Tkachov | Ruby Meditation #23GDPR. Next Y2K in 2018? - Anton Tkachov | Ruby Meditation #23
GDPR. Next Y2K in 2018? - Anton Tkachov | Ruby Meditation #23Ruby Meditation
 

More from Ruby Meditation (20)

Is this Legacy or Revenant Code? - Sergey Sergyenko | Ruby Meditation 30
Is this Legacy or Revenant Code? - Sergey Sergyenko  | Ruby Meditation 30Is this Legacy or Revenant Code? - Sergey Sergyenko  | Ruby Meditation 30
Is this Legacy or Revenant Code? - Sergey Sergyenko | Ruby Meditation 30
 
Life with GraphQL API: good practices and unresolved issues - Roman Dubrovsky...
Life with GraphQL API: good practices and unresolved issues - Roman Dubrovsky...Life with GraphQL API: good practices and unresolved issues - Roman Dubrovsky...
Life with GraphQL API: good practices and unresolved issues - Roman Dubrovsky...
 
Where is your license, dude? - Viacheslav Miroshnychenko | Ruby Meditation 29
Where is your license, dude? - Viacheslav Miroshnychenko | Ruby Meditation 29Where is your license, dude? - Viacheslav Miroshnychenko | Ruby Meditation 29
Where is your license, dude? - Viacheslav Miroshnychenko | Ruby Meditation 29
 
Dry-validation update. Dry-validation vs Dry-schema 1.0 - Aleksandra Stolyar ...
Dry-validation update. Dry-validation vs Dry-schema 1.0 - Aleksandra Stolyar ...Dry-validation update. Dry-validation vs Dry-schema 1.0 - Aleksandra Stolyar ...
Dry-validation update. Dry-validation vs Dry-schema 1.0 - Aleksandra Stolyar ...
 
How to cook Rabbit on Production - Bohdan Parshentsev | Ruby Meditation 28
How to cook Rabbit on Production - Bohdan Parshentsev | Ruby Meditation 28 How to cook Rabbit on Production - Bohdan Parshentsev | Ruby Meditation 28
How to cook Rabbit on Production - Bohdan Parshentsev | Ruby Meditation 28
 
How to cook Rabbit on Production - Serhiy Nazarov | Ruby Meditation 28
How to cook Rabbit on Production - Serhiy Nazarov | Ruby Meditation 28How to cook Rabbit on Production - Serhiy Nazarov | Ruby Meditation 28
How to cook Rabbit on Production - Serhiy Nazarov | Ruby Meditation 28
 
Reinventing the wheel - why do it and how to feel good about it - Julik Tarkh...
Reinventing the wheel - why do it and how to feel good about it - Julik Tarkh...Reinventing the wheel - why do it and how to feel good about it - Julik Tarkh...
Reinventing the wheel - why do it and how to feel good about it - Julik Tarkh...
 
Performance Optimization 101 for Ruby developers - Nihad Abbasov (ENG) | Ruby...
Performance Optimization 101 for Ruby developers - Nihad Abbasov (ENG) | Ruby...Performance Optimization 101 for Ruby developers - Nihad Abbasov (ENG) | Ruby...
Performance Optimization 101 for Ruby developers - Nihad Abbasov (ENG) | Ruby...
 
Use cases for Serverless Technologies - Ruslan Tolstov (RUS) | Ruby Meditatio...
Use cases for Serverless Technologies - Ruslan Tolstov (RUS) | Ruby Meditatio...Use cases for Serverless Technologies - Ruslan Tolstov (RUS) | Ruby Meditatio...
Use cases for Serverless Technologies - Ruslan Tolstov (RUS) | Ruby Meditatio...
 
The Trailblazer Ride from the If Jungle into a Civilised Railway Station - Or...
The Trailblazer Ride from the If Jungle into a Civilised Railway Station - Or...The Trailblazer Ride from the If Jungle into a Civilised Railway Station - Or...
The Trailblazer Ride from the If Jungle into a Civilised Railway Station - Or...
 
What/How to do with GraphQL? - Valentyn Ostakh (ENG) | Ruby Meditation 27
What/How to do with GraphQL? - Valentyn Ostakh (ENG) | Ruby Meditation 27What/How to do with GraphQL? - Valentyn Ostakh (ENG) | Ruby Meditation 27
What/How to do with GraphQL? - Valentyn Ostakh (ENG) | Ruby Meditation 27
 
New features in Rails 6 - Nihad Abbasov (RUS) | Ruby Meditation 26
New features in Rails 6 -  Nihad Abbasov (RUS) | Ruby Meditation 26New features in Rails 6 -  Nihad Abbasov (RUS) | Ruby Meditation 26
New features in Rails 6 - Nihad Abbasov (RUS) | Ruby Meditation 26
 
Security Scanning Overview - Tetiana Chupryna (RUS) | Ruby Meditation 26
Security Scanning Overview - Tetiana Chupryna (RUS) | Ruby Meditation 26Security Scanning Overview - Tetiana Chupryna (RUS) | Ruby Meditation 26
Security Scanning Overview - Tetiana Chupryna (RUS) | Ruby Meditation 26
 
Teach your application eloquence. Logs, metrics, traces - Dmytro Shapovalov (...
Teach your application eloquence. Logs, metrics, traces - Dmytro Shapovalov (...Teach your application eloquence. Logs, metrics, traces - Dmytro Shapovalov (...
Teach your application eloquence. Logs, metrics, traces - Dmytro Shapovalov (...
 
Best practices. Exploring - Ike Kurghinyan (RUS) | Ruby Meditation 26
Best practices. Exploring - Ike Kurghinyan (RUS) | Ruby Meditation 26Best practices. Exploring - Ike Kurghinyan (RUS) | Ruby Meditation 26
Best practices. Exploring - Ike Kurghinyan (RUS) | Ruby Meditation 26
 
Road to A/B testing - Alexey Vasiliev (ENG) | Ruby Meditation 25
Road to A/B testing - Alexey Vasiliev (ENG) | Ruby Meditation 25Road to A/B testing - Alexey Vasiliev (ENG) | Ruby Meditation 25
Road to A/B testing - Alexey Vasiliev (ENG) | Ruby Meditation 25
 
Concurrency in production. Real life example - Dmytro Herasymuk | Ruby Medita...
Concurrency in production. Real life example - Dmytro Herasymuk | Ruby Medita...Concurrency in production. Real life example - Dmytro Herasymuk | Ruby Medita...
Concurrency in production. Real life example - Dmytro Herasymuk | Ruby Medita...
 
Data encryption for Ruby web applications - Dmytro Shapovalov (RUS) | Ruby Me...
Data encryption for Ruby web applications - Dmytro Shapovalov (RUS) | Ruby Me...Data encryption for Ruby web applications - Dmytro Shapovalov (RUS) | Ruby Me...
Data encryption for Ruby web applications - Dmytro Shapovalov (RUS) | Ruby Me...
 
Rails App performance at the limit - Bogdan Gusiev
Rails App performance at the limit - Bogdan GusievRails App performance at the limit - Bogdan Gusiev
Rails App performance at the limit - Bogdan Gusiev
 
GDPR. Next Y2K in 2018? - Anton Tkachov | Ruby Meditation #23
GDPR. Next Y2K in 2018? - Anton Tkachov | Ruby Meditation #23GDPR. Next Y2K in 2018? - Anton Tkachov | Ruby Meditation #23
GDPR. Next Y2K in 2018? - Anton Tkachov | Ruby Meditation #23
 

Recently uploaded

A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxComplianceQuest1
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfkalichargn70th171
 
What is Binary Language? Computer Number Systems
What is Binary Language?  Computer Number SystemsWhat is Binary Language?  Computer Number Systems
What is Binary Language? Computer Number SystemsJheuzeDellosa
 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio, Inc.
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...gurkirankumar98700
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdfWave PLM
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideChristina Lin
 
chapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptchapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptkotipi9215
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...harshavardhanraghave
 
Engage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The UglyEngage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The UglyFrank van der Linden
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackVICTOR MAESTRE RAMIREZ
 
Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...aditisharan08
 
DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about usDynamic Netsoft
 
Introduction to Decentralized Applications (dApps)
Introduction to Decentralized Applications (dApps)Introduction to Decentralized Applications (dApps)
Introduction to Decentralized Applications (dApps)Intelisync
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...MyIntelliSource, Inc.
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Modelsaagamshah0812
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVshikhaohhpro
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...MyIntelliSource, Inc.
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...OnePlan Solutions
 

Recently uploaded (20)

A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
What is Binary Language? Computer Number Systems
What is Binary Language?  Computer Number SystemsWhat is Binary Language?  Computer Number Systems
What is Binary Language? Computer Number Systems
 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
 
chapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptchapter--4-software-project-planning.ppt
chapter--4-software-project-planning.ppt
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
 
Engage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The UglyEngage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The Ugly
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStack
 
Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...
 
DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about us
 
Introduction to Decentralized Applications (dApps)
Introduction to Decentralized Applications (dApps)Introduction to Decentralized Applications (dApps)
Introduction to Decentralized Applications (dApps)
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...
 

Professional Code Reviews - Bogdan Gusiev

  • 1. CODE REVIEW PROCESSCODE REVIEW PROCESS BOGDAN GUSIEVBOGDAN GUSIEV
  • 2. CODE REVIEW TENDS TO BE NATURALCODE REVIEW TENDS TO BE NATURAL
  • 3. CODE REVIEW YOURSELFCODE REVIEW YOURSELF
  • 5. SPONDANUOUS CODE REVIEW PROBLEM:SPONDANUOUS CODE REVIEW PROBLEM: TOO LATETOO LATE
  • 6. EVERYTHING HAD CHANGED BYEVERYTHING HAD CHANGED BY GITHUBGITHUB
  • 7. DO I NEED A CODE REVIEW?DO I NEED A CODE REVIEW? IMHO: NEW PROJECTSIMHO: NEW PROJECTS DON'T NEED A FORMAL CODE REVIEW AT ALLDON'T NEED A FORMAL CODE REVIEW AT ALL
  • 8. CODE REVIEW EVOLUTIONCODE REVIEW EVOLUTION 1. Spontanuous Code Reviews 2. "When I am not sure" code reviews 3. Formal Code Review Process 4. Required code review for certain changes 5. Required code reviews for everything Fails Driven Process
  • 9. CODE REVIEW PROPERTIESCODE REVIEW PROPERTIES NECESSITYNECESSITY Optional Required PROCESSPROCESS Informal Formal PEOPLEPEOPLE Dedicated Distributed
  • 10. POSITION IN A PROCESSPOSITION IN A PROCESS 1. Planning 2. Coding 3. Code Review 4. QA 5. Release QA <-> Code Review Formally QA a er Code Review
  • 11. 1. Make a fork (optional) 2. Create a Branch 3. Open a Pull Request 4. Wait for review 5. Discuss & Fix 6. Merge
  • 12. CODE REVIEW ISCODE REVIEW IS A PROCESS OFA PROCESS OF REVIEWING AND APPROVINGREVIEWING AND APPROVING CODE CHANGESCODE CHANGES BEFOREBEFORE THEY GET ACCEPTED TO THE MAINSTREAMTHEY GET ACCEPTED TO THE MAINSTREAM
  • 13. HOW TO REVIEW?HOW TO REVIEW?
  • 14. FIX COMMON THINGS FIRST?FIX COMMON THINGS FIRST? Typos Whitespace Code Style Wrong Direction!
  • 15. WHERE TO LOOK?WHERE TO LOOK? Things that are most significant should be reviewed first which are ones that are the most hard to change.
  • 16. TOP TO BOTTOM CODE REVIEWTOP TO BOTTOM CODE REVIEW 1. Architecture 1. Problem Solution 2. Public APIs 3. Database Schema 4. Object Oriented Design 5. Public Method Signatures 2. Implementation 1. Classes & Methods 2. Views 3. Tests 4. Code Style, Typos, Whitespace
  • 17. PROBLEM SOLUTIONPROBLEM SOLUTION 1. Problem makes sense 2. Problem Solved 3. High Level Security 4. High Level Performance
  • 18. ONLY SHOW CUSTOM PROPERTIES WITH AT LEAST ONE VALUE IN SELECTONLY SHOW CUSTOM PROPERTIES WITH AT LEAST ONE VALUE IN SELECT def selectable_product_categories + ProductCategory.with_at_least_one_product - ProductCategory.all end ProductCategory. where("not exists(select * from products where ...)"). count # => 0
  • 19. HIGH LEVEL SECURITYHIGH LEVEL SECURITY EX. FEATURE:EX. FEATURE: LOGIN USER AUTOMATICALLY WHEN IT CLICKS ON THE LINK IN THE EMAILLOGIN USER AUTOMATICALLY WHEN IT CLICKS ON THE LINK IN THE EMAIL THIS IS NOT VERY SECURETHIS IS NOT VERY SECURE
  • 20. HIGH LEVEL PERFORMANCEHIGH LEVEL PERFORMANCE CHECK IF THE CHANGECHECK IF THE CHANGE Touches Performance sensitive code Will be slow for particular data No pagination when there are 1000+ records to display
  • 21. PUBLIC APISPUBLIC APIS USING HTTP API AS EXAMPLEUSING HTTP API AS EXAMPLE 1. Efficiency 2. Logical Endpoints 3. Request Parameters 4. Response Format WHATEVER THAT IS DOCUMENTEDWHATEVER THAT IS DOCUMENTED
  • 22. API INEFFICIENCY EXAMPLEAPI INEFFICIENCY EXAMPLE EFFICIENT WAY?EFFICIENT WAY? Purchase.has_one :referral GET /purchases/:order_number { id: 1, order_number: '1838382', referral_id: 17 } POST /referrals/:id/approve POST /purchases/:order_number/referral/approve
  • 23. RESPONSE FORMATRESPONSE FORMAT # Easier render json: @campaign.view_setups.to_json # Extensible render json: {view_setups: @campaign.view_setups.to_json}
  • 24. BAD API EXAMPLEBAD API EXAMPLE Talkable.publish('talkable_offer_close', null, true); Talkable.publish('offer_close', null, true);
  • 25. ANALYZE USAGE FIRSTANALYZE USAGE FIRST BUT NOT IMPLEMENTATIONBUT NOT IMPLEMENTATION setCustomProperty: function (person, properties) { ... } setCustomProperty('advocate', {key: value}) setCustomProperty('friend', {key: value}) setAdvocateCustomProperty: function(properties) { private_stuff.setCustomProperty("advocate", properties); }, setFriendCustomProperty: function(properties) { private_stuff.setCustomProperty("friend", properties); },
  • 26. DATABASE SCHEMADATABASE SCHEMA 1. Relations between tables 2. Data Columns 3. Naming
  • 27. EFFICIENT RELATIONSEFFICIENT RELATIONS 1. What are the variants? 2. Was the best one selected?
  • 28. EFFICIENT SCHEMAEFFICIENT SCHEMA add_column :images, :dimension, :string class Image < AR::Base def width dimension.split("x").first end def height dimension.split("x").last end end add_column :images, :width, :integer add_column :images, :height, :integer
  • 29. DATA SHOULD BEDATA SHOULD BE EASY TO READEASY TO READ EVEN IF IT MAKES ITEVEN IF IT MAKES IT HARDER TO WRITEHARDER TO WRITE
  • 30. OBJECT ORIENTED DESIGNOBJECT ORIENTED DESIGN 1. Reflects Real World 2. Inheritance 3. Constructors
  • 31. REVIEWING CONSTRUCTORSREVIEWING CONSTRUCTORS CIRCULAR DEPENDENCYCIRCULAR DEPENDENCY class Field def initialize @cells = Array.new(10) do Array.new(10) { Cell.new(self) } end end end class Cell def initialize(field) @field = field end end
  • 32. OBJECT CONSTRUCTORS ARE IMPORTANT:OBJECT CONSTRUCTORS ARE IMPORTANT: Which things are required to use an object? What are the object responsibilities? Theoretical limit Which methods can be implemented in the object? Which things would need to be passed to methods as arguments? Constructor defines object API
  • 33. REVIEWING CONSTRUCTORSREVIEWING CONSTRUCTORS UNDEFINED CONTEXTUNDEFINED CONTEXT class ApplicationController before_action do WhateverRequestAnalyzer.new(request).analyze end end CrawlerRequestAnalyzer.new( request.user_agent, request.url, request.content_type ).analyze
  • 34. PUBLIC METHOD SIGNATURESPUBLIC METHOD SIGNATURES 1. Placement 2. Arguments 3. Name
  • 35. METHOD PLACEMENTMETHOD PLACEMENT class User def approve!(referral) end # OR class Referral def approve!(user) end
  • 38. CLASSES & METHOD BODIESCLASSES & METHOD BODIES Each method or class separately Check one by one: 1. Approach & Algorithm 2. Performance 3. Security 4. Minimalism 5. Local Variable Names
  • 39. PERFORMANCE & VULNERABILITIESPERFORMANCE & VULNERABILITIES In the ideal world performance and vulnerabilities should not change the code structure. In practice it can but we should try hard to fix performance problems only at the implementation level
  • 40. GOOD PERFORMANCE PATCHGOOD PERFORMANCE PATCH def core_options - { header: name, description: description, group: group } + @core_options ||= { header: name, description: description, grou end - @campaign.locale_entries.each do + @campaign.locale_entries.preload(:variants).each do
  • 41. GOOD VULNERABILITY PATCHGOOD VULNERABILITY PATCH -{{ advocate_info.first_name }} +{{ advocate_info.first_name | escape }}
  • 42. SECURITYSECURITY Approach Security (Step 1) Is it secure to have this feature? Is it secure to implement the feature this way? Vulnerabilities XSS Allowed Parameters Backend Authorisation check Authorisation for UI elements
  • 43. TESTSTESTS 1. Use Cases Coverage 2. Formal Code Coverage 3. Tests Implementation
  • 44. TOP TO BOTTOM IDEATOP TO BOTTOM IDEA IT IS BAD TO:IT IS BAD TO: Discuss the method name before the method existence as a fact Discuss Code Style before implementation itself
  • 45. BOSS CONTROL APPROACHBOSS CONTROL APPROACH Ensure top points from the list are always performed Choose X things on top of the list to double-check and delegate the rest completely
  • 46. CODE REVIEW CULTURECODE REVIEW CULTURE Be Polite Admit good things First things first Reduce number of cycles Save Author's time Save Your time
  • 47. TOP TO BOTTOM CODE REVIEWTOP TO BOTTOM CODE REVIEW 1. Architecture 1. Problem Solution 2. Public APIs 3. Database Schema 4. Object Oriented Design 5. Public Method Signatures 2. Implementation 1. Classes & Methods 2. Views 3. Test Coverage 4. Code Style, Typos, Whitespace