SlideShare ist ein Scribd-Unternehmen logo
1 von 22
Downloaden Sie, um offline zu lesen
Globalcode – Open4education
Trilha – iOS
Daniel Souza
iOS Developer
Globalcode – Open4education
Small changes,
great outcomes
Globalcode – Open4education
danielCarlosCE commented on Apr 18
You should start with a
Capital Letter when naming
classes
Globalcode – Open4education
Name of types and protocols UpperCamelCase
Variables and functions lowerCamelCase
Enum cases lowerCamelCase
Constants lowerCamelCase
Globalcode – Open4education
class LoginViewController { }
struct Place { }
protocol PlacesDataSource { }
enum Result { }
Globalcode – Open4education
var passwordRules = "8 characters"
let maximumAttempts = 16
func sendRequest() {}
enum Result {
case success
}
Globalcode – Open4education
danielCarlosCE commented on Apr 18
view is a pretty ambiguous
name. What about something like
contentView?
Globalcode – Open4education
@IBOutlet var label: UILabel!
@IBOutlet var errorLabel: UILabel!




var string = "No places found!"
var error = "No places found!"
Globalcode – Open4education
danielCarlosCE commented on Apr 18
You should start with a verb
when naming this function
Globalcode – Open4education
func findNearbyStores()
func distance(to: Store) -> Distance
Globalcode – Open4education
danielCarlosCE commented on Apr 18
those two lines are common for
both cases, you can call them
outside the switch
Globalcode – Open4education
case .success:
stopLoading()
hideCurrentError()
showFoundPlaces()
Globalcode – Open4education
case .success:
stopLoading()
hideCurrentError()
showFoundPlaces()
case .failure (let error):
stopLoading()
hideCurrentError()
show(error)
Globalcode – Open4education
case .success:
stopLoading()
hideCurrentError()
showFoundPlaces()
case .failure (let error):
stopLoading()
hideCurrentError()
show(error)
Globalcode – Open4education
danielCarlosCE commented on Apr 18
Remove all commented out code,
please
Globalcode – Open4education
Globalcode – Open4education
danielCarlosCE commented on Apr 18
You should handle this case of
failure
Globalcode – Open4education
switch result {
case .success:
showFoundPlaces()
case .failure (let error):
print(error)
}
Globalcode – Open4education
danielCarlosCE commented on Apr 18
Remove the force unwrap here
and make sure you actually have
a value
Globalcode – Open4education
if let phone = phone {}
api?.findUsers()
guard let address = address else {}
Globalcode – Open4education
• Clean Code
• Swift API Design Guidelines
• Swift Style Guide (raywenderlich)
• Lint (SwiftLint)
Globalcode – Open4education
danielcarlosce

Weitere ähnliche Inhalte

Ähnlich wie Small Changes, great outcomes

Re Descubriendo A Linq
Re Descubriendo A LinqRe Descubriendo A Linq
Re Descubriendo A Linq
Jose Bonnin
 
SOLID, DRY, SLAP design principles
SOLID, DRY, SLAP design principlesSOLID, DRY, SLAP design principles
SOLID, DRY, SLAP design principles
Sergey Karpushin
 
Large Scale JavaScript with TypeScript
Large Scale JavaScript with TypeScriptLarge Scale JavaScript with TypeScript
Large Scale JavaScript with TypeScript
Oliver Zeigermann
 

Ähnlich wie Small Changes, great outcomes (20)

TechkTalk #12 Grokking: Writing code that writes code – Nguyen Luong
TechkTalk #12 Grokking: Writing code that writes code – Nguyen LuongTechkTalk #12 Grokking: Writing code that writes code – Nguyen Luong
TechkTalk #12 Grokking: Writing code that writes code – Nguyen Luong
 
Re Descubriendo A Linq
Re Descubriendo A LinqRe Descubriendo A Linq
Re Descubriendo A Linq
 
Porting Applications From Oracle To PostgreSQL
Porting Applications From Oracle To PostgreSQLPorting Applications From Oracle To PostgreSQL
Porting Applications From Oracle To PostgreSQL
 
Clean code
Clean codeClean code
Clean code
 
SOLID, DRY, SLAP design principles
SOLID, DRY, SLAP design principlesSOLID, DRY, SLAP design principles
SOLID, DRY, SLAP design principles
 
Advanced REXX Programming Techniques
Advanced REXX Programming TechniquesAdvanced REXX Programming Techniques
Advanced REXX Programming Techniques
 
Introduction to Advanced Javascript
Introduction to Advanced JavascriptIntroduction to Advanced Javascript
Introduction to Advanced Javascript
 
Scylla Summit 2017: How to Use Gocql to Execute Queries and What the Driver D...
Scylla Summit 2017: How to Use Gocql to Execute Queries and What the Driver D...Scylla Summit 2017: How to Use Gocql to Execute Queries and What the Driver D...
Scylla Summit 2017: How to Use Gocql to Execute Queries and What the Driver D...
 
2018 05-11 the way we teach tech - phpday
2018 05-11 the way we teach tech - phpday2018 05-11 the way we teach tech - phpday
2018 05-11 the way we teach tech - phpday
 
Coding standard
Coding standardCoding standard
Coding standard
 
Considered the brain of the computer gpu cpu/tutorialoutlet
Considered the brain of the computer gpu cpu/tutorialoutletConsidered the brain of the computer gpu cpu/tutorialoutlet
Considered the brain of the computer gpu cpu/tutorialoutlet
 
Java script the weird part (PART I )
Java script the weird part (PART I )Java script the weird part (PART I )
Java script the weird part (PART I )
 
C# coding standards, good programming principles & refactoring
C# coding standards, good programming principles & refactoringC# coding standards, good programming principles & refactoring
C# coding standards, good programming principles & refactoring
 
Ravi software faculty
Ravi software facultyRavi software faculty
Ravi software faculty
 
Large Scale JavaScript with TypeScript
Large Scale JavaScript with TypeScriptLarge Scale JavaScript with TypeScript
Large Scale JavaScript with TypeScript
 
Flow or Type - how to React to that?
Flow or Type - how to React to that?Flow or Type - how to React to that?
Flow or Type - how to React to that?
 
Decompiling Java - SCAM2009 Presentation
Decompiling Java - SCAM2009 PresentationDecompiling Java - SCAM2009 Presentation
Decompiling Java - SCAM2009 Presentation
 
resolvendo problemas de comunicação em equipes distribuídas com bdd
resolvendo problemas de comunicação em equipes distribuídas com bddresolvendo problemas de comunicação em equipes distribuídas com bdd
resolvendo problemas de comunicação em equipes distribuídas com bdd
 
Oop java Concept
Oop java ConceptOop java Concept
Oop java Concept
 
Objects, Testing, and Responsibility
Objects, Testing, and ResponsibilityObjects, Testing, and Responsibility
Objects, Testing, and Responsibility
 

Small Changes, great outcomes