SlideShare a Scribd company logo
1 of 85
Download to read offline
Clean Code – Guidelines Proposal
Arnaud Bouchez – Synopse / LiveMon
CLEAN CODE
Guidelines Proposal
Clean Code – Guidelines Proposal
Arnaud Bouchez
– Delphi / FPC
• Various solutions (from Vatican to gaming industry)
• IoT solution (RSI)
• Real-time Monitoring solution (LiveMon)
– Open Source
• mORMot (SOA ORM MVC framework)
• SynPDF SynMustache SynDB SynCrypto
– Training and consultancy
• Synopse one-man company
Clean Code – Guidelines Proposal
Clean Code – Guidelines Proposal
Clean Code Guidelines Proposal
• Guidance
• Target
• Repository
• Code Formatting
• Types definition
Clean Code – Guidelines Proposal
Clean Code Guidelines Proposal
• Guidance
• Target
• Repository
• Code Formatting
• Types definition
Clean Code – Guidelines Proposal
Guidance Proposal
• We focus on Server-Side code
Client side is more expandable
• We wonder not only HOW but WHY
Even if coding is an art form,
it is sadly not yet in the modern art market
so most employers don’t care about code
Clean Code – Guidelines Proposal
Guidance Proposal
• Proposal
There is no single policy to rule them all
This session should be interactive
Some proposals may not fit your needs
Some proposals may hurt you
Clean Code – Guidelines Proposal
Guidance Proposal
• Proposal
There is no single policy to rule them all
This session should be interactive
Some proposals may not fit your needs
Some proposals may hurt you
- at least let’s try to understand
each one point of view
Clean Code – Guidelines Proposal
Guidance Proposal
• Proposal
Start from the current LiveMon Guidance
(because I wrote it)
Clean Code – Guidelines Proposal
Guidance Proposal
• Proposal
Start from the current LiveMon Guidance
(because I wrote it
and because you will help me improve it)
Clean Code – Guidelines Proposal
Guidance Proposal
• Proposal
Start from the current LiveMon Guidance
but this is a work-in-progress
→ make yourself your idea!
Clean Code – Guidelines Proposal
Guidance
• Team work needs some rules
especially for our most valuable asset:
use the source, Luke!
- your padawans will thank you
Clean Code – Guidelines Proposal
Guidance
• Ease maintainability and interoperability
don’t write for yourself
eventually help yourself
Clean Code – Guidelines Proposal
Guidance
• Ease maintainability and interoperability
as if the final maintainer of your code
would be a psychopath
knowing your personal address
Clean Code – Guidelines Proposal
Guidance
• Goal: fails at compile time
or fails at code peer review
to avoid (some/most) errors at runtime
Runtime errors are the worse to fix
• Test-Driven Design
Testing is (the main/worse) part of writing
Clean Code – Guidelines Proposal
Guidance
• Up to Domain-Driven Design
The Domain code is isolated from
all dependencies (e.g. DB or applications)
→ non technical domain experts
should be able to read, understand and validate
the Domain source code
Clean Code – Guidelines Proposal
Guidance
• SOLID Principles
Single Responsibility Principle
Open Closed Principle
Liskov Substitution Principle
Interface Segregation Principle
Dependency Inversion Principle
are Out Of Scope of this presentation
(but worth a full session or workshop)
Clean Code – Guidelines Proposal
Clean Code Guidelines Proposal
• Guidance
• Target
• Repository
• Code Formatting
• Types definition
Clean Code – Guidelines Proposal
Compiler Target
• For which Compiler and OS (eventually)
Delphi
FPC
others (TMSWebCore, SMS, EWB…)
Clean Code – Guidelines Proposal
Compiler Target
• Isolate OS and compiler specific code
don’t abuse of {$ifdef…}
use a leading {$I conditionals.inc} file
isolate in specific units
Clean Code – Guidelines Proposal
Compiler Target
• Isolate OS and compiler specific code
use third party libraries
use shared syntax e.g. FPC {$mode Delphi}
with automated testing on all targets
Clean Code – Guidelines Proposal
Compiler Target
• Third Parties
Well identified and chosen
Documented as such
Part of the source code tree (or as external)
Stability in the long term
Cross-OS and Cross-compilers support
Clean Code – Guidelines Proposal
Compiler Target
• Static linked C code or raw asm
Sometimes needed for performance
Always with “pure pascal” fallback
Includes documentation
Includes script to rebuild from C sources
Clean Code – Guidelines Proposal
Clean Code Guidelines Proposal
• Guidance
• Target
• Repository
• Code Formatting
• Types definition
Clean Code – Guidelines Proposal
Source Code Repository
• As part of the Code requirements
Where and how
we maintain the source code
is part of daily development work
but also of the whole solution design
Clean Code – Guidelines Proposal
Source Code Repository
• Git / Mercurial / Bazar / Fossil / SVN …
Centralized or Distributed
Local copy or Fork/Branch
In-house hosted or Cloud PaaS
• Linked with other tools
Documentation, Project management,
Issues, Support, CRM…
Clean Code – Guidelines Proposal
Source Code Repository
• As part of the Code requirements
main branch should always compile
and pass the regression tests
on all supported platforms
• Continuous Integration
Automated Commit – Build – Test cycle
Clean Code – Guidelines Proposal
Source Code Repository
• Branches and Forks
Per-feature branches on distributed SCM
e.g. git/fossil/bazar
Pull requests with explicit review
before merge by team leaders
Continuous Integration from branches
Clean Code – Guidelines Proposal
Source Code Repository
• Folders Hierarchy
Source code may be project-oriented:
one folder per project + “common” units
(this is a typical layout)
Clean Code – Guidelines Proposal
Source Code Repository
• Folders Hierarchy
Why not use them
to uncouple the logic
and avoid dependencies?
e.g. split data, logic, tests and UI
Clean Code – Guidelines Proposal
Source Code Repository
• Folders Hierarchy at LiveMon
data
daemon
ext
serv
test
tools
ui
Clean Code – Guidelines Proposal
Source Code Repository
• Folders Hierarchy at LiveMon
data daemon ext serv test tools ui
Unit names follow the folder name
e.g. DataMetrics.pas is located in Data
TestAll.dpr is located in Test
DaemonShopMain.pas is located in Daemon
Clean Code – Guidelines Proposal
Source Code Repository
• Sensitive code and files
(private keys, default passwords…)
are better stored outside the repository
(especially on PaaS like github)
Clean Code – Guidelines Proposal
Source Code Repository
• Dependencies
are hosted in several repositories
External dependencies for 3rd parties
Internal dependencies for cross-teams work
Clean Code – Guidelines Proposal
Source Code Repository
• Test-Driven Design are part of the source
Unit tests & Integration tests
to avoid regressions and enhance agility
as part of the integration, or stand-alone
on staging/pre-prod environment
Clean Code – Guidelines Proposal
Source Code Repository
• Test-Driven Design are part of the source
Performance / load stressing tests
if it matters on customer side
as part of the integration, or stand-alone
on staging/pre-prod environment
Clean Code – Guidelines Proposal
Source Code Repository
• Documentation as Code
Reference material as .md files
maintained in synch with the source
complementary to comments
sometimes generated from source
(e.g. mORMOt SOA API via Mustache template)
Clean Code – Guidelines Proposal
Source Code Repository
• Documentation as Code
Reference material as .md files
duplicated in a semi-public “doc” repo
(e.g. for support people, or front-end dev)
Clean Code – Guidelines Proposal
Source Code Repository
• Infrastructure as Code
Automate Containers
– virtualized cloud-based hosting
– containers defined as code
– work with IT to generate (or host) scripts
Clean Code – Guidelines Proposal
Source Code Repository
• Infrastructure as Code at LiveMon
Daemons services endpoints (IP, ports, URI)
are all defined in shared pascal code
– favor convention over configuration
– favor logical over physical
– pascal as expressive script language
Clean Code – Guidelines Proposal
Source Code Repository
• Infrastructure as Code at LiveMon
Daemons services endpoints (IP, ports, URI)
are all defined in shared pascal code
Clean Code – Guidelines Proposal
Source Code Repository
• Infrastructure as Code at LiveMon
Daemons services endpoints (IP, ports, URI)
are all defined in shared pascal code
– auto-configuration even on barebones servers
– ease scaling and testing
– work with IT to generate (or host) scripts
e.g. with Mustache templates, or internal REST services
Clean Code – Guidelines Proposal
Clean Code Guidelines Proposal
• Guidance
• Target
• Repository
• Code Formatting
• Types definition
Clean Code – Guidelines Proposal
Code Formatting
• Define some canonical rules
The most sensitive: begin … end blocks,
nested if … then, naming conventions
Avoid blank lines (refactor in methods)
Clean Code – Guidelines Proposal
Code Formatting
• Define some canonical rules
Use some reformatting tool
CnPack, Castalia, …
will make all team members aware of it
As part of review step (or commit?)
Clean Code – Guidelines Proposal
Code Formatting
• Define some canonical rules
https://blog.golang.org/go-fmt-your-code
“easier to write, read and maintain
and uncontroversial”
Clean Code – Guidelines Proposal
Code Formatting
• Define some canonical rules
Comments
not revision history – use a SCM
not (****) – use regions
as specs = as valuable as code
Clean Code – Guidelines Proposal
Code Formatting
• Define some canonical rules
But this is not the main point,
since formatting is a matter of
convention, not logic
Clean Code – Guidelines Proposal
Clean Code Guidelines Proposal
• Guidance
• Target
• Repository
• Code Formatting
• Types definition
Clean Code – Guidelines Proposal
Types Definitions
• Follow Common Delphi Convention
TCamelCase
ISomeInterface
TSomeEnum = (seOne, seTwo…);
TOnSomeEvent = procedure of object;
CONSTANT_NUMBER
Clean Code – Guidelines Proposal
Types Definitions
• No Hungarian Notation
TSomeCounterInteger
SOMEVALUE_KONST
ParameterInput
sounds like polluting the modelization
→ rather use the IDE features
Clean Code – Guidelines Proposal
Types Definitions
• Class definition
TMyClass = class(TOtherClass)
private
fSomeProperty: TSomeType;
public
property SomeProperty: TSomeType read…
Clean Code – Guidelines Proposal
Types Definitions
• Class definition
TMyClass = class(TOtherClass)
private
fSomeProperty: TSomeType;
function GetSomeProperty: TSomeType;
public
property SomeProperty: TSomeType read…
Clean Code – Guidelines Proposal
Types Definitions
• Class definition
use myclassvar.fSomeProperty
or myclassvar.GetSomeProperty
myclassvar.SetSomeProperty()
to make method calls explicit
for internal calls
Clean Code – Guidelines Proposal
Types Definitions
• Class definition
TMyClass = class(TOtherClass)
private
fSomeProperty: TSomeType;
published
property someproperty: TSomeType read…
(when JSON serialized for JS API)
Clean Code – Guidelines Proposal
Types Definitions
• Class definition
follow SOLID principles, mainly:
smaller dedicated classes
favor composition over inheritance
abstraction via interfaces
as few unit dependency as possible
Clean Code – Guidelines Proposal
Types Definitions
• Naming is modelizing
Follows the modelized reality, not the tech
cf. DDD Ubiquitous Language
e.g. TInvoiceTotalValue
not double
not TSQLSumResult
Clean Code – Guidelines Proposal
Types Definitions
• Naming is about grammar
method = verb in infinitive form
event or enumerate = verb in past form
variable = reality name
(or verb in past form for counts/boolean)
Clean Code – Guidelines Proposal
Types Definitions
• Naming is about grammar
method = SendEmail()
event or enumerate = eeEmailSent
variable = TEmailTitle, EmailWasSent
Clean Code – Guidelines Proposal
Types Definitions
• Naming is about grammar
method = Email()
event or enumerate = eeSuccess
variable = Text, ok
Clean Code – Guidelines Proposal
Types Definitions
• Naming is about meaning
i.e. reading the code should be as close as
reading the logic in plain English
→ avoid technical or anemic model
Clean Code – Guidelines Proposal
Types Definitions
• Naming is about meaning
i.e. reading the code should be as close as
reading the logic in plain German
→ avoid technical or anemic model
Clean Code – Guidelines Proposal
Types Definitions
• Naming is about meaning
method = SMTPExecute()
event or enumerate = 200
variable = s, b
Clean Code – Guidelines Proposal
Types Definitions
• Enumerations
are a very powerful feature of pascal
convenient way to modelize state or errors
you could use RTTI to retrieve text (logs)
Clean Code – Guidelines Proposal
Types Definitions
• Enumerations
are a very powerful feature of pascal
by convention, first (=0) item is success
especially with stubs/mocks
Clean Code – Guidelines Proposal
Types Definitions
• Enumerations
are a very powerful feature of pascal
convenient way for compile-time errors
e.g. when defining DTOs
const
CONV: array[TDomainEnum] of TAppEnum =
(….);
Clean Code – Guidelines Proposal
Types Definitions
• Naming is about consistency
once you defined some rules, stick to them
procedure MyMethod(param: integer);
procedure MyMethod(Param: integer);
procedure MyMethod(aParam: integer);
Clean Code – Guidelines Proposal
Types Definitions
• Naming is about consistency
once you defined some rules, stick to them
var Current: TEmailSender;
var current: TEmailSender;
Clean Code – Guidelines Proposal
Types Definitions
• Naming is absolute in public
but it won’t hurt to use i,j,k for local loops
(or the for item in items do syntax)
local variables may be named according
to the technical implementation context
Clean Code – Guidelines Proposal
Types Definitions
• Strongly-Typed Pascal
var a: integer;
begin
a := ‘text’;
end.
Clean Code – Guidelines Proposal
Types Definitions
• Strongly-Typed Pascal
var a: integer;
begin
a := ‘text’; // fails to compile
end.
Clean Code – Guidelines Proposal
Types Definitions
• Strongly-Typed Pascal
JavaScript is (was) not
so TypeScript, Dart, Flow, … appeared
to write and maintain big projects
Clean Code – Guidelines Proposal
Types Definitions
• Strongly-Typed Pascal
not only classes or records, but also
type
TDistanceMeters = type double;
TDistanceMiles = type double;
Clean Code – Guidelines Proposal
Types Definitions
• Strongly-Typed Pascal
type
TDistanceMeters = type double;
TDistanceMiles = type double;
it won’t be slower, but could be much safer!
Clean Code – Guidelines Proposal
Types Definitions
• Strongly-Typed Pascal
type
TDistanceMeters = type double;
TDistanceMiles = type double;
Make the Implicit Explicit !
Clean Code – Guidelines Proposal
Types Definitions
• Strongly-Typed Pascal
function CalculateTrajectory(
altitude: double): TTrajectory;
Make the Implicit Explicit !
Avoid another Mars Climate Orbiter failure!
Clean Code – Guidelines Proposal
Types Definitions
• Strongly-Typed Pascal
function CalculateTrajectory(
altitude: TDistanceMeters): TTrajectory;
Make the Implicit Explicit !
Avoid another Mars Climate Orbiter failure!
Clean Code – Guidelines Proposal
Types Definitions
• Exceptions should be exceptional
Some languages don’t implement them
https://golang.org/doc/faq#exceptions
use Exception in “panic” mode
when DB or network is down, disk is full,
dead branch is reached in code…
Clean Code – Guidelines Proposal
Types Definitions
• Exceptions should be exceptional
Severity is hidden
Is it an user input entry error, or a DB failure?
Not easy to transmit remotely
Exceptions are classes with no persistence
and sometimes some pointers to context
Clean Code – Guidelines Proposal
Types Definitions
• Exceptions should be exceptional
Performance cost
On all platforms
Not debugger-friendly
Did you try to debug Indy calls in the IDE?
Clean Code – Guidelines Proposal
Types Definitions
• Exceptions should be exceptional
Rely on Error Codes
Dedicated Enumerations
Optionally with some text for UI
Complex errors may return a class/record
But not the same class as on success
Clean Code – Guidelines Proposal
Types Definitions
• Exceptions should be exceptional
Don’t rely on HTTP status codes
Logic should be uncoupled from HTTP
What if you execute the code locally?
Only if you really need it
e.g. when implementing a standard
Clean Code – Guidelines Proposal
Types Definitions
• Exceptions should be exceptional
Log and transmit all exceptions
On heavily loaded servers, it would save
you a lot of time filtering real problems
Too much notification is killing the notification!
Clean Code – Guidelines Proposal
Clean Code
i. From consensus comes success
ii. Don’t pollute your code – hide technical
iii. Naming is everything
iv. Code should be like natural language
v. Make the implicit explicit
vi. Exceptions should be exceptional
vii. ….
Clean Code – Guidelines Proposal
• Questions?
Clean Code Guidelines Proposal

More Related Content

What's hot

Off the-shelf components (cots)
Off the-shelf components (cots)Off the-shelf components (cots)
Off the-shelf components (cots)Himanshu
 
Capability maturity model cmm lecture 8
Capability maturity model cmm lecture 8Capability maturity model cmm lecture 8
Capability maturity model cmm lecture 8Abdul Basit
 
Advanced Operating System- Introduction
Advanced Operating System- IntroductionAdvanced Operating System- Introduction
Advanced Operating System- IntroductionDebasis Das
 
Test driven development in C
Test driven development in CTest driven development in C
Test driven development in CAmritayan Nayak
 
AskTom: How to Make and Test Your Application "Oracle RAC Ready"?
AskTom: How to Make and Test Your Application "Oracle RAC Ready"?AskTom: How to Make and Test Your Application "Oracle RAC Ready"?
AskTom: How to Make and Test Your Application "Oracle RAC Ready"?Markus Michalewicz
 
Tizen RT: A Lightweight RTOS Platform for Low-End IoT Devices
Tizen RT: A Lightweight RTOS Platform for Low-End IoT DevicesTizen RT: A Lightweight RTOS Platform for Low-End IoT Devices
Tizen RT: A Lightweight RTOS Platform for Low-End IoT DevicesSamsung Open Source Group
 
SQA - chapter 13 (Software Quality Infrastructure)
SQA - chapter 13 (Software Quality Infrastructure)SQA - chapter 13 (Software Quality Infrastructure)
SQA - chapter 13 (Software Quality Infrastructure)uma sree
 
Operating system architecture
Operating system architectureOperating system architecture
Operating system architectureSabin dumre
 
Syntactic analysis in NLP
Syntactic analysis in NLPSyntactic analysis in NLP
Syntactic analysis in NLPkartikaVashisht
 
RocksDB Performance and Reliability Practices
RocksDB Performance and Reliability PracticesRocksDB Performance and Reliability Practices
RocksDB Performance and Reliability PracticesYoshinori Matsunobu
 
Directory and discovery services
Directory and discovery servicesDirectory and discovery services
Directory and discovery servicesRamchandraRegmi
 
Lect4 software economics
Lect4 software economicsLect4 software economics
Lect4 software economicsmeena466141
 
Best practices for MySQL High Availability Tutorial
Best practices for MySQL High Availability TutorialBest practices for MySQL High Availability Tutorial
Best practices for MySQL High Availability TutorialColin Charles
 
Sizing Your MongoDB Cluster
Sizing Your MongoDB ClusterSizing Your MongoDB Cluster
Sizing Your MongoDB ClusterMongoDB
 
Fortran - concise review
Fortran - concise reviewFortran - concise review
Fortran - concise reviewHans Zimermann
 
phases of compiler-analysis phase
phases of compiler-analysis phasephases of compiler-analysis phase
phases of compiler-analysis phaseSuyash Srivastava
 

What's hot (20)

Off the-shelf components (cots)
Off the-shelf components (cots)Off the-shelf components (cots)
Off the-shelf components (cots)
 
Capability maturity model cmm lecture 8
Capability maturity model cmm lecture 8Capability maturity model cmm lecture 8
Capability maturity model cmm lecture 8
 
Rtos Concepts
Rtos ConceptsRtos Concepts
Rtos Concepts
 
Advanced Operating System- Introduction
Advanced Operating System- IntroductionAdvanced Operating System- Introduction
Advanced Operating System- Introduction
 
Test driven development in C
Test driven development in CTest driven development in C
Test driven development in C
 
AskTom: How to Make and Test Your Application "Oracle RAC Ready"?
AskTom: How to Make and Test Your Application "Oracle RAC Ready"?AskTom: How to Make and Test Your Application "Oracle RAC Ready"?
AskTom: How to Make and Test Your Application "Oracle RAC Ready"?
 
Tizen RT: A Lightweight RTOS Platform for Low-End IoT Devices
Tizen RT: A Lightweight RTOS Platform for Low-End IoT DevicesTizen RT: A Lightweight RTOS Platform for Low-End IoT Devices
Tizen RT: A Lightweight RTOS Platform for Low-End IoT Devices
 
SQA - chapter 13 (Software Quality Infrastructure)
SQA - chapter 13 (Software Quality Infrastructure)SQA - chapter 13 (Software Quality Infrastructure)
SQA - chapter 13 (Software Quality Infrastructure)
 
Operating system architecture
Operating system architectureOperating system architecture
Operating system architecture
 
Syntactic analysis in NLP
Syntactic analysis in NLPSyntactic analysis in NLP
Syntactic analysis in NLP
 
RocksDB Performance and Reliability Practices
RocksDB Performance and Reliability PracticesRocksDB Performance and Reliability Practices
RocksDB Performance and Reliability Practices
 
Dial up security
Dial up securityDial up security
Dial up security
 
Real Time Operating Systems
Real Time Operating SystemsReal Time Operating Systems
Real Time Operating Systems
 
Directory and discovery services
Directory and discovery servicesDirectory and discovery services
Directory and discovery services
 
Lect4 software economics
Lect4 software economicsLect4 software economics
Lect4 software economics
 
Best practices for MySQL High Availability Tutorial
Best practices for MySQL High Availability TutorialBest practices for MySQL High Availability Tutorial
Best practices for MySQL High Availability Tutorial
 
Scheduling algorithms
Scheduling algorithmsScheduling algorithms
Scheduling algorithms
 
Sizing Your MongoDB Cluster
Sizing Your MongoDB ClusterSizing Your MongoDB Cluster
Sizing Your MongoDB Cluster
 
Fortran - concise review
Fortran - concise reviewFortran - concise review
Fortran - concise review
 
phases of compiler-analysis phase
phases of compiler-analysis phasephases of compiler-analysis phase
phases of compiler-analysis phase
 

Similar to Object Pascal Clean Code Guidelines Proposal (at EKON 22)

Clean Infrastructure as Code
Clean Infrastructure as Code Clean Infrastructure as Code
Clean Infrastructure as Code QAware GmbH
 
Magento 2 Workflows
Magento 2 WorkflowsMagento 2 Workflows
Magento 2 WorkflowsRyan Street
 
Code for Startup MVP (Ruby on Rails) Session 1
Code for Startup MVP (Ruby on Rails) Session 1Code for Startup MVP (Ruby on Rails) Session 1
Code for Startup MVP (Ruby on Rails) Session 1Henry S
 
High Quality C# - Codequality in Practice
High Quality C# - Codequality in PracticeHigh Quality C# - Codequality in Practice
High Quality C# - Codequality in PracticeRainer Stropek
 
How to become a Rational Developer for IBM i Power User
How to become a Rational Developer for IBM i Power UserHow to become a Rational Developer for IBM i Power User
How to become a Rational Developer for IBM i Power UserStrongback Consulting
 
Modern Web-site Development Pipeline
Modern Web-site Development PipelineModern Web-site Development Pipeline
Modern Web-site Development PipelineGlobalLogic Ukraine
 
Building iOS App Project & Architecture
Building iOS App Project & ArchitectureBuilding iOS App Project & Architecture
Building iOS App Project & ArchitectureMassimo Oliviero
 
Continuous Integration
Continuous IntegrationContinuous Integration
Continuous IntegrationXPDays
 
PHPFrameworkDay 2020 - Different software evolutions from Start till Release ...
PHPFrameworkDay 2020 - Different software evolutions from Start till Release ...PHPFrameworkDay 2020 - Different software evolutions from Start till Release ...
PHPFrameworkDay 2020 - Different software evolutions from Start till Release ...Alexandr Savchenko
 
"Different software evolutions from Start till Release in PHP product" Oleksa...
"Different software evolutions from Start till Release in PHP product" Oleksa..."Different software evolutions from Start till Release in PHP product" Oleksa...
"Different software evolutions from Start till Release in PHP product" Oleksa...Fwdays
 
SOLID Programming with Portable Class Libraries
SOLID Programming with Portable Class LibrariesSOLID Programming with Portable Class Libraries
SOLID Programming with Portable Class LibrariesVagif Abilov
 
Managing Software Inventories & Automating Open Source Software Compliance
Managing Software Inventories & Automating Open Source Software ComplianceManaging Software Inventories & Automating Open Source Software Compliance
Managing Software Inventories & Automating Open Source Software CompliancenexB Inc.
 
OpenStack Networking: Developing and Delivering a Commercial Solution for Lo...
OpenStack Networking:  Developing and Delivering a Commercial Solution for Lo...OpenStack Networking:  Developing and Delivering a Commercial Solution for Lo...
OpenStack Networking: Developing and Delivering a Commercial Solution for Lo...Radware
 
Coding Standard And Code Review
Coding Standard And Code ReviewCoding Standard And Code Review
Coding Standard And Code ReviewMilan Vukoje
 
Status Quo on the automation support in SOA Suite OGhTech17
Status Quo on the automation support in SOA Suite OGhTech17Status Quo on the automation support in SOA Suite OGhTech17
Status Quo on the automation support in SOA Suite OGhTech17Jon Petter Hjulstad
 
Composable Software Architecture with Spring
Composable Software Architecture with SpringComposable Software Architecture with Spring
Composable Software Architecture with SpringSam Brannen
 
Agile collaborative practices
Agile collaborative practicesAgile collaborative practices
Agile collaborative practicesSreejith Madhavan
 
Enterprise-Grade DevOps Solutions for a Start Up Budget
Enterprise-Grade DevOps Solutions for a Start Up BudgetEnterprise-Grade DevOps Solutions for a Start Up Budget
Enterprise-Grade DevOps Solutions for a Start Up BudgetDevOps.com
 
Design Like a Pro: Scripting Best Practices
Design Like a Pro: Scripting Best PracticesDesign Like a Pro: Scripting Best Practices
Design Like a Pro: Scripting Best PracticesInductive Automation
 

Similar to Object Pascal Clean Code Guidelines Proposal (at EKON 22) (20)

Code Inspection
Code InspectionCode Inspection
Code Inspection
 
Clean Infrastructure as Code
Clean Infrastructure as Code Clean Infrastructure as Code
Clean Infrastructure as Code
 
Magento 2 Workflows
Magento 2 WorkflowsMagento 2 Workflows
Magento 2 Workflows
 
Code for Startup MVP (Ruby on Rails) Session 1
Code for Startup MVP (Ruby on Rails) Session 1Code for Startup MVP (Ruby on Rails) Session 1
Code for Startup MVP (Ruby on Rails) Session 1
 
High Quality C# - Codequality in Practice
High Quality C# - Codequality in PracticeHigh Quality C# - Codequality in Practice
High Quality C# - Codequality in Practice
 
How to become a Rational Developer for IBM i Power User
How to become a Rational Developer for IBM i Power UserHow to become a Rational Developer for IBM i Power User
How to become a Rational Developer for IBM i Power User
 
Modern Web-site Development Pipeline
Modern Web-site Development PipelineModern Web-site Development Pipeline
Modern Web-site Development Pipeline
 
Building iOS App Project & Architecture
Building iOS App Project & ArchitectureBuilding iOS App Project & Architecture
Building iOS App Project & Architecture
 
Continuous Integration
Continuous IntegrationContinuous Integration
Continuous Integration
 
PHPFrameworkDay 2020 - Different software evolutions from Start till Release ...
PHPFrameworkDay 2020 - Different software evolutions from Start till Release ...PHPFrameworkDay 2020 - Different software evolutions from Start till Release ...
PHPFrameworkDay 2020 - Different software evolutions from Start till Release ...
 
"Different software evolutions from Start till Release in PHP product" Oleksa...
"Different software evolutions from Start till Release in PHP product" Oleksa..."Different software evolutions from Start till Release in PHP product" Oleksa...
"Different software evolutions from Start till Release in PHP product" Oleksa...
 
SOLID Programming with Portable Class Libraries
SOLID Programming with Portable Class LibrariesSOLID Programming with Portable Class Libraries
SOLID Programming with Portable Class Libraries
 
Managing Software Inventories & Automating Open Source Software Compliance
Managing Software Inventories & Automating Open Source Software ComplianceManaging Software Inventories & Automating Open Source Software Compliance
Managing Software Inventories & Automating Open Source Software Compliance
 
OpenStack Networking: Developing and Delivering a Commercial Solution for Lo...
OpenStack Networking:  Developing and Delivering a Commercial Solution for Lo...OpenStack Networking:  Developing and Delivering a Commercial Solution for Lo...
OpenStack Networking: Developing and Delivering a Commercial Solution for Lo...
 
Coding Standard And Code Review
Coding Standard And Code ReviewCoding Standard And Code Review
Coding Standard And Code Review
 
Status Quo on the automation support in SOA Suite OGhTech17
Status Quo on the automation support in SOA Suite OGhTech17Status Quo on the automation support in SOA Suite OGhTech17
Status Quo on the automation support in SOA Suite OGhTech17
 
Composable Software Architecture with Spring
Composable Software Architecture with SpringComposable Software Architecture with Spring
Composable Software Architecture with Spring
 
Agile collaborative practices
Agile collaborative practicesAgile collaborative practices
Agile collaborative practices
 
Enterprise-Grade DevOps Solutions for a Start Up Budget
Enterprise-Grade DevOps Solutions for a Start Up BudgetEnterprise-Grade DevOps Solutions for a Start Up Budget
Enterprise-Grade DevOps Solutions for a Start Up Budget
 
Design Like a Pro: Scripting Best Practices
Design Like a Pro: Scripting Best PracticesDesign Like a Pro: Scripting Best Practices
Design Like a Pro: Scripting Best Practices
 

More from Arnaud Bouchez

EKON27-FrameworksTuning.pdf
EKON27-FrameworksTuning.pdfEKON27-FrameworksTuning.pdf
EKON27-FrameworksTuning.pdfArnaud Bouchez
 
EKON27-FrameworksExpressiveness.pdf
EKON27-FrameworksExpressiveness.pdfEKON27-FrameworksExpressiveness.pdf
EKON27-FrameworksExpressiveness.pdfArnaud Bouchez
 
Ekon25 mORMot 2 Server-Side Notifications
Ekon25 mORMot 2 Server-Side NotificationsEkon25 mORMot 2 Server-Side Notifications
Ekon25 mORMot 2 Server-Side NotificationsArnaud Bouchez
 
Ekon25 mORMot 2 Cryptography
Ekon25 mORMot 2 CryptographyEkon25 mORMot 2 Cryptography
Ekon25 mORMot 2 CryptographyArnaud Bouchez
 
Ekon24 from Delphi to AVX2
Ekon24 from Delphi to AVX2Ekon24 from Delphi to AVX2
Ekon24 from Delphi to AVX2Arnaud Bouchez
 
Ekon23 (2) Kingdom-Driven-Design applied to Social Media with mORMot
Ekon23 (2) Kingdom-Driven-Design applied to Social Media with mORMotEkon23 (2) Kingdom-Driven-Design applied to Social Media with mORMot
Ekon23 (2) Kingdom-Driven-Design applied to Social Media with mORMotArnaud Bouchez
 
Ekon21 Microservices - SOLID Meets SOA
Ekon21 Microservices - SOLID Meets SOAEkon21 Microservices - SOLID Meets SOA
Ekon21 Microservices - SOLID Meets SOAArnaud Bouchez
 
Ekon21 Microservices - Event Driven Design
Ekon21 Microservices - Event Driven DesignEkon21 Microservices - Event Driven Design
Ekon21 Microservices - Event Driven DesignArnaud Bouchez
 
Ekon20 mORMot WorkShop Delphi
Ekon20 mORMot WorkShop DelphiEkon20 mORMot WorkShop Delphi
Ekon20 mORMot WorkShop DelphiArnaud Bouchez
 
Ekon20 mORMot SOA Delphi Conference
Ekon20 mORMot SOA Delphi Conference Ekon20 mORMot SOA Delphi Conference
Ekon20 mORMot SOA Delphi Conference Arnaud Bouchez
 
Ekon20 mORMot Legacy Code Technical Debt Delphi Conference
Ekon20 mORMot Legacy Code Technical Debt Delphi Conference Ekon20 mORMot Legacy Code Technical Debt Delphi Conference
Ekon20 mORMot Legacy Code Technical Debt Delphi Conference Arnaud Bouchez
 
D1 from interfaces to solid
D1 from interfaces to solidD1 from interfaces to solid
D1 from interfaces to solidArnaud Bouchez
 
D2 domain driven-design
D2 domain driven-designD2 domain driven-design
D2 domain driven-designArnaud Bouchez
 
Delphi ORM SOA MVC SQL NoSQL JSON REST mORMot
Delphi ORM SOA MVC SQL NoSQL JSON REST mORMotDelphi ORM SOA MVC SQL NoSQL JSON REST mORMot
Delphi ORM SOA MVC SQL NoSQL JSON REST mORMotArnaud Bouchez
 

More from Arnaud Bouchez (20)

EKON27-FrameworksTuning.pdf
EKON27-FrameworksTuning.pdfEKON27-FrameworksTuning.pdf
EKON27-FrameworksTuning.pdf
 
EKON27-FrameworksExpressiveness.pdf
EKON27-FrameworksExpressiveness.pdfEKON27-FrameworksExpressiveness.pdf
EKON27-FrameworksExpressiveness.pdf
 
Ekon25 mORMot 2 Server-Side Notifications
Ekon25 mORMot 2 Server-Side NotificationsEkon25 mORMot 2 Server-Side Notifications
Ekon25 mORMot 2 Server-Side Notifications
 
Ekon25 mORMot 2 Cryptography
Ekon25 mORMot 2 CryptographyEkon25 mORMot 2 Cryptography
Ekon25 mORMot 2 Cryptography
 
Ekon24 from Delphi to AVX2
Ekon24 from Delphi to AVX2Ekon24 from Delphi to AVX2
Ekon24 from Delphi to AVX2
 
Ekon24 mORMot 2
Ekon24 mORMot 2Ekon24 mORMot 2
Ekon24 mORMot 2
 
Ekon23 (2) Kingdom-Driven-Design applied to Social Media with mORMot
Ekon23 (2) Kingdom-Driven-Design applied to Social Media with mORMotEkon23 (2) Kingdom-Driven-Design applied to Social Media with mORMot
Ekon23 (2) Kingdom-Driven-Design applied to Social Media with mORMot
 
Ekon21 Microservices - SOLID Meets SOA
Ekon21 Microservices - SOLID Meets SOAEkon21 Microservices - SOLID Meets SOA
Ekon21 Microservices - SOLID Meets SOA
 
Ekon21 Microservices - Event Driven Design
Ekon21 Microservices - Event Driven DesignEkon21 Microservices - Event Driven Design
Ekon21 Microservices - Event Driven Design
 
Ekon20 mORMot WorkShop Delphi
Ekon20 mORMot WorkShop DelphiEkon20 mORMot WorkShop Delphi
Ekon20 mORMot WorkShop Delphi
 
Ekon20 mORMot SOA Delphi Conference
Ekon20 mORMot SOA Delphi Conference Ekon20 mORMot SOA Delphi Conference
Ekon20 mORMot SOA Delphi Conference
 
Ekon20 mORMot Legacy Code Technical Debt Delphi Conference
Ekon20 mORMot Legacy Code Technical Debt Delphi Conference Ekon20 mORMot Legacy Code Technical Debt Delphi Conference
Ekon20 mORMot Legacy Code Technical Debt Delphi Conference
 
2016 mORMot
2016 mORMot2016 mORMot
2016 mORMot
 
A1 from n tier to soa
A1 from n tier to soaA1 from n tier to soa
A1 from n tier to soa
 
D1 from interfaces to solid
D1 from interfaces to solidD1 from interfaces to solid
D1 from interfaces to solid
 
A3 from sql to orm
A3 from sql to ormA3 from sql to orm
A3 from sql to orm
 
A2 from soap to rest
A2 from soap to restA2 from soap to rest
A2 from soap to rest
 
D2 domain driven-design
D2 domain driven-designD2 domain driven-design
D2 domain driven-design
 
A4 from rad to mvc
A4 from rad to mvcA4 from rad to mvc
A4 from rad to mvc
 
Delphi ORM SOA MVC SQL NoSQL JSON REST mORMot
Delphi ORM SOA MVC SQL NoSQL JSON REST mORMotDelphi ORM SOA MVC SQL NoSQL JSON REST mORMot
Delphi ORM SOA MVC SQL NoSQL JSON REST mORMot
 

Recently uploaded

%in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park %in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park masabamasaba
 
Generic or specific? Making sensible software design decisions
Generic or specific? Making sensible software design decisionsGeneric or specific? Making sensible software design decisions
Generic or specific? Making sensible software design decisionsBert Jan Schrijver
 
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...masabamasaba
 
Define the academic and professional writing..pdf
Define the academic and professional writing..pdfDefine the academic and professional writing..pdf
Define the academic and professional writing..pdfPearlKirahMaeRagusta1
 
%+27788225528 love spells in Vancouver Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Vancouver Psychic Readings, Attraction spells,Br...%+27788225528 love spells in Vancouver Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Vancouver Psychic Readings, Attraction spells,Br...masabamasaba
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplatePresentation.STUDIO
 
SHRMPro HRMS Software Solutions Presentation
SHRMPro HRMS Software Solutions PresentationSHRMPro HRMS Software Solutions Presentation
SHRMPro HRMS Software Solutions PresentationShrmpro
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension AidPhilip Schwarz
 
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfPayment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfkalichargn70th171
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️Delhi Call girls
 
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...masabamasaba
 
%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrandmasabamasaba
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesVictorSzoltysek
 
Announcing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareAnnouncing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareJim McKeeth
 
8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech studentsHimanshiGarg82
 
The Top App Development Trends Shaping the Industry in 2024-25 .pdf
The Top App Development Trends Shaping the Industry in 2024-25 .pdfThe Top App Development Trends Shaping the Industry in 2024-25 .pdf
The Top App Development Trends Shaping the Industry in 2024-25 .pdfayushiqss
 
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfonteinmasabamasaba
 
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyviewmasabamasaba
 
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...SelfMade bd
 

Recently uploaded (20)

%in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park %in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
 
Generic or specific? Making sensible software design decisions
Generic or specific? Making sensible software design decisionsGeneric or specific? Making sensible software design decisions
Generic or specific? Making sensible software design decisions
 
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
 
Define the academic and professional writing..pdf
Define the academic and professional writing..pdfDefine the academic and professional writing..pdf
Define the academic and professional writing..pdf
 
%+27788225528 love spells in Vancouver Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Vancouver Psychic Readings, Attraction spells,Br...%+27788225528 love spells in Vancouver Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Vancouver Psychic Readings, Attraction spells,Br...
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
 
SHRMPro HRMS Software Solutions Presentation
SHRMPro HRMS Software Solutions PresentationSHRMPro HRMS Software Solutions Presentation
SHRMPro HRMS Software Solutions Presentation
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
 
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfPayment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
 
%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
 
Announcing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareAnnouncing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK Software
 
8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students
 
The Top App Development Trends Shaping the Industry in 2024-25 .pdf
The Top App Development Trends Shaping the Industry in 2024-25 .pdfThe Top App Development Trends Shaping the Industry in 2024-25 .pdf
The Top App Development Trends Shaping the Industry in 2024-25 .pdf
 
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
 
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
 
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
 

Object Pascal Clean Code Guidelines Proposal (at EKON 22)

  • 1. Clean Code – Guidelines Proposal Arnaud Bouchez – Synopse / LiveMon CLEAN CODE Guidelines Proposal
  • 2. Clean Code – Guidelines Proposal Arnaud Bouchez – Delphi / FPC • Various solutions (from Vatican to gaming industry) • IoT solution (RSI) • Real-time Monitoring solution (LiveMon) – Open Source • mORMot (SOA ORM MVC framework) • SynPDF SynMustache SynDB SynCrypto – Training and consultancy • Synopse one-man company
  • 3. Clean Code – Guidelines Proposal
  • 4. Clean Code – Guidelines Proposal Clean Code Guidelines Proposal • Guidance • Target • Repository • Code Formatting • Types definition
  • 5. Clean Code – Guidelines Proposal Clean Code Guidelines Proposal • Guidance • Target • Repository • Code Formatting • Types definition
  • 6. Clean Code – Guidelines Proposal Guidance Proposal • We focus on Server-Side code Client side is more expandable • We wonder not only HOW but WHY Even if coding is an art form, it is sadly not yet in the modern art market so most employers don’t care about code
  • 7. Clean Code – Guidelines Proposal Guidance Proposal • Proposal There is no single policy to rule them all This session should be interactive Some proposals may not fit your needs Some proposals may hurt you
  • 8. Clean Code – Guidelines Proposal Guidance Proposal • Proposal There is no single policy to rule them all This session should be interactive Some proposals may not fit your needs Some proposals may hurt you - at least let’s try to understand each one point of view
  • 9. Clean Code – Guidelines Proposal Guidance Proposal • Proposal Start from the current LiveMon Guidance (because I wrote it)
  • 10. Clean Code – Guidelines Proposal Guidance Proposal • Proposal Start from the current LiveMon Guidance (because I wrote it and because you will help me improve it)
  • 11. Clean Code – Guidelines Proposal Guidance Proposal • Proposal Start from the current LiveMon Guidance but this is a work-in-progress → make yourself your idea!
  • 12. Clean Code – Guidelines Proposal Guidance • Team work needs some rules especially for our most valuable asset: use the source, Luke! - your padawans will thank you
  • 13. Clean Code – Guidelines Proposal Guidance • Ease maintainability and interoperability don’t write for yourself eventually help yourself
  • 14. Clean Code – Guidelines Proposal Guidance • Ease maintainability and interoperability as if the final maintainer of your code would be a psychopath knowing your personal address
  • 15. Clean Code – Guidelines Proposal Guidance • Goal: fails at compile time or fails at code peer review to avoid (some/most) errors at runtime Runtime errors are the worse to fix • Test-Driven Design Testing is (the main/worse) part of writing
  • 16. Clean Code – Guidelines Proposal Guidance • Up to Domain-Driven Design The Domain code is isolated from all dependencies (e.g. DB or applications) → non technical domain experts should be able to read, understand and validate the Domain source code
  • 17. Clean Code – Guidelines Proposal Guidance • SOLID Principles Single Responsibility Principle Open Closed Principle Liskov Substitution Principle Interface Segregation Principle Dependency Inversion Principle are Out Of Scope of this presentation (but worth a full session or workshop)
  • 18. Clean Code – Guidelines Proposal Clean Code Guidelines Proposal • Guidance • Target • Repository • Code Formatting • Types definition
  • 19. Clean Code – Guidelines Proposal Compiler Target • For which Compiler and OS (eventually) Delphi FPC others (TMSWebCore, SMS, EWB…)
  • 20. Clean Code – Guidelines Proposal Compiler Target • Isolate OS and compiler specific code don’t abuse of {$ifdef…} use a leading {$I conditionals.inc} file isolate in specific units
  • 21. Clean Code – Guidelines Proposal Compiler Target • Isolate OS and compiler specific code use third party libraries use shared syntax e.g. FPC {$mode Delphi} with automated testing on all targets
  • 22. Clean Code – Guidelines Proposal Compiler Target • Third Parties Well identified and chosen Documented as such Part of the source code tree (or as external) Stability in the long term Cross-OS and Cross-compilers support
  • 23. Clean Code – Guidelines Proposal Compiler Target • Static linked C code or raw asm Sometimes needed for performance Always with “pure pascal” fallback Includes documentation Includes script to rebuild from C sources
  • 24. Clean Code – Guidelines Proposal Clean Code Guidelines Proposal • Guidance • Target • Repository • Code Formatting • Types definition
  • 25. Clean Code – Guidelines Proposal Source Code Repository • As part of the Code requirements Where and how we maintain the source code is part of daily development work but also of the whole solution design
  • 26. Clean Code – Guidelines Proposal Source Code Repository • Git / Mercurial / Bazar / Fossil / SVN … Centralized or Distributed Local copy or Fork/Branch In-house hosted or Cloud PaaS • Linked with other tools Documentation, Project management, Issues, Support, CRM…
  • 27. Clean Code – Guidelines Proposal Source Code Repository • As part of the Code requirements main branch should always compile and pass the regression tests on all supported platforms • Continuous Integration Automated Commit – Build – Test cycle
  • 28. Clean Code – Guidelines Proposal Source Code Repository • Branches and Forks Per-feature branches on distributed SCM e.g. git/fossil/bazar Pull requests with explicit review before merge by team leaders Continuous Integration from branches
  • 29. Clean Code – Guidelines Proposal Source Code Repository • Folders Hierarchy Source code may be project-oriented: one folder per project + “common” units (this is a typical layout)
  • 30. Clean Code – Guidelines Proposal Source Code Repository • Folders Hierarchy Why not use them to uncouple the logic and avoid dependencies? e.g. split data, logic, tests and UI
  • 31. Clean Code – Guidelines Proposal Source Code Repository • Folders Hierarchy at LiveMon data daemon ext serv test tools ui
  • 32. Clean Code – Guidelines Proposal Source Code Repository • Folders Hierarchy at LiveMon data daemon ext serv test tools ui Unit names follow the folder name e.g. DataMetrics.pas is located in Data TestAll.dpr is located in Test DaemonShopMain.pas is located in Daemon
  • 33. Clean Code – Guidelines Proposal Source Code Repository • Sensitive code and files (private keys, default passwords…) are better stored outside the repository (especially on PaaS like github)
  • 34. Clean Code – Guidelines Proposal Source Code Repository • Dependencies are hosted in several repositories External dependencies for 3rd parties Internal dependencies for cross-teams work
  • 35. Clean Code – Guidelines Proposal Source Code Repository • Test-Driven Design are part of the source Unit tests & Integration tests to avoid regressions and enhance agility as part of the integration, or stand-alone on staging/pre-prod environment
  • 36. Clean Code – Guidelines Proposal Source Code Repository • Test-Driven Design are part of the source Performance / load stressing tests if it matters on customer side as part of the integration, or stand-alone on staging/pre-prod environment
  • 37. Clean Code – Guidelines Proposal Source Code Repository • Documentation as Code Reference material as .md files maintained in synch with the source complementary to comments sometimes generated from source (e.g. mORMOt SOA API via Mustache template)
  • 38. Clean Code – Guidelines Proposal Source Code Repository • Documentation as Code Reference material as .md files duplicated in a semi-public “doc” repo (e.g. for support people, or front-end dev)
  • 39. Clean Code – Guidelines Proposal Source Code Repository • Infrastructure as Code Automate Containers – virtualized cloud-based hosting – containers defined as code – work with IT to generate (or host) scripts
  • 40. Clean Code – Guidelines Proposal Source Code Repository • Infrastructure as Code at LiveMon Daemons services endpoints (IP, ports, URI) are all defined in shared pascal code – favor convention over configuration – favor logical over physical – pascal as expressive script language
  • 41. Clean Code – Guidelines Proposal Source Code Repository • Infrastructure as Code at LiveMon Daemons services endpoints (IP, ports, URI) are all defined in shared pascal code
  • 42. Clean Code – Guidelines Proposal Source Code Repository • Infrastructure as Code at LiveMon Daemons services endpoints (IP, ports, URI) are all defined in shared pascal code – auto-configuration even on barebones servers – ease scaling and testing – work with IT to generate (or host) scripts e.g. with Mustache templates, or internal REST services
  • 43. Clean Code – Guidelines Proposal Clean Code Guidelines Proposal • Guidance • Target • Repository • Code Formatting • Types definition
  • 44. Clean Code – Guidelines Proposal Code Formatting • Define some canonical rules The most sensitive: begin … end blocks, nested if … then, naming conventions Avoid blank lines (refactor in methods)
  • 45. Clean Code – Guidelines Proposal Code Formatting • Define some canonical rules Use some reformatting tool CnPack, Castalia, … will make all team members aware of it As part of review step (or commit?)
  • 46. Clean Code – Guidelines Proposal Code Formatting • Define some canonical rules https://blog.golang.org/go-fmt-your-code “easier to write, read and maintain and uncontroversial”
  • 47. Clean Code – Guidelines Proposal Code Formatting • Define some canonical rules Comments not revision history – use a SCM not (****) – use regions as specs = as valuable as code
  • 48. Clean Code – Guidelines Proposal Code Formatting • Define some canonical rules But this is not the main point, since formatting is a matter of convention, not logic
  • 49. Clean Code – Guidelines Proposal Clean Code Guidelines Proposal • Guidance • Target • Repository • Code Formatting • Types definition
  • 50. Clean Code – Guidelines Proposal Types Definitions • Follow Common Delphi Convention TCamelCase ISomeInterface TSomeEnum = (seOne, seTwo…); TOnSomeEvent = procedure of object; CONSTANT_NUMBER
  • 51. Clean Code – Guidelines Proposal Types Definitions • No Hungarian Notation TSomeCounterInteger SOMEVALUE_KONST ParameterInput sounds like polluting the modelization → rather use the IDE features
  • 52. Clean Code – Guidelines Proposal Types Definitions • Class definition TMyClass = class(TOtherClass) private fSomeProperty: TSomeType; public property SomeProperty: TSomeType read…
  • 53. Clean Code – Guidelines Proposal Types Definitions • Class definition TMyClass = class(TOtherClass) private fSomeProperty: TSomeType; function GetSomeProperty: TSomeType; public property SomeProperty: TSomeType read…
  • 54. Clean Code – Guidelines Proposal Types Definitions • Class definition use myclassvar.fSomeProperty or myclassvar.GetSomeProperty myclassvar.SetSomeProperty() to make method calls explicit for internal calls
  • 55. Clean Code – Guidelines Proposal Types Definitions • Class definition TMyClass = class(TOtherClass) private fSomeProperty: TSomeType; published property someproperty: TSomeType read… (when JSON serialized for JS API)
  • 56. Clean Code – Guidelines Proposal Types Definitions • Class definition follow SOLID principles, mainly: smaller dedicated classes favor composition over inheritance abstraction via interfaces as few unit dependency as possible
  • 57. Clean Code – Guidelines Proposal Types Definitions • Naming is modelizing Follows the modelized reality, not the tech cf. DDD Ubiquitous Language e.g. TInvoiceTotalValue not double not TSQLSumResult
  • 58. Clean Code – Guidelines Proposal Types Definitions • Naming is about grammar method = verb in infinitive form event or enumerate = verb in past form variable = reality name (or verb in past form for counts/boolean)
  • 59. Clean Code – Guidelines Proposal Types Definitions • Naming is about grammar method = SendEmail() event or enumerate = eeEmailSent variable = TEmailTitle, EmailWasSent
  • 60. Clean Code – Guidelines Proposal Types Definitions • Naming is about grammar method = Email() event or enumerate = eeSuccess variable = Text, ok
  • 61. Clean Code – Guidelines Proposal Types Definitions • Naming is about meaning i.e. reading the code should be as close as reading the logic in plain English → avoid technical or anemic model
  • 62. Clean Code – Guidelines Proposal Types Definitions • Naming is about meaning i.e. reading the code should be as close as reading the logic in plain German → avoid technical or anemic model
  • 63. Clean Code – Guidelines Proposal Types Definitions • Naming is about meaning method = SMTPExecute() event or enumerate = 200 variable = s, b
  • 64. Clean Code – Guidelines Proposal Types Definitions • Enumerations are a very powerful feature of pascal convenient way to modelize state or errors you could use RTTI to retrieve text (logs)
  • 65. Clean Code – Guidelines Proposal Types Definitions • Enumerations are a very powerful feature of pascal by convention, first (=0) item is success especially with stubs/mocks
  • 66. Clean Code – Guidelines Proposal Types Definitions • Enumerations are a very powerful feature of pascal convenient way for compile-time errors e.g. when defining DTOs const CONV: array[TDomainEnum] of TAppEnum = (….);
  • 67. Clean Code – Guidelines Proposal Types Definitions • Naming is about consistency once you defined some rules, stick to them procedure MyMethod(param: integer); procedure MyMethod(Param: integer); procedure MyMethod(aParam: integer);
  • 68. Clean Code – Guidelines Proposal Types Definitions • Naming is about consistency once you defined some rules, stick to them var Current: TEmailSender; var current: TEmailSender;
  • 69. Clean Code – Guidelines Proposal Types Definitions • Naming is absolute in public but it won’t hurt to use i,j,k for local loops (or the for item in items do syntax) local variables may be named according to the technical implementation context
  • 70. Clean Code – Guidelines Proposal Types Definitions • Strongly-Typed Pascal var a: integer; begin a := ‘text’; end.
  • 71. Clean Code – Guidelines Proposal Types Definitions • Strongly-Typed Pascal var a: integer; begin a := ‘text’; // fails to compile end.
  • 72. Clean Code – Guidelines Proposal Types Definitions • Strongly-Typed Pascal JavaScript is (was) not so TypeScript, Dart, Flow, … appeared to write and maintain big projects
  • 73. Clean Code – Guidelines Proposal Types Definitions • Strongly-Typed Pascal not only classes or records, but also type TDistanceMeters = type double; TDistanceMiles = type double;
  • 74. Clean Code – Guidelines Proposal Types Definitions • Strongly-Typed Pascal type TDistanceMeters = type double; TDistanceMiles = type double; it won’t be slower, but could be much safer!
  • 75. Clean Code – Guidelines Proposal Types Definitions • Strongly-Typed Pascal type TDistanceMeters = type double; TDistanceMiles = type double; Make the Implicit Explicit !
  • 76. Clean Code – Guidelines Proposal Types Definitions • Strongly-Typed Pascal function CalculateTrajectory( altitude: double): TTrajectory; Make the Implicit Explicit ! Avoid another Mars Climate Orbiter failure!
  • 77. Clean Code – Guidelines Proposal Types Definitions • Strongly-Typed Pascal function CalculateTrajectory( altitude: TDistanceMeters): TTrajectory; Make the Implicit Explicit ! Avoid another Mars Climate Orbiter failure!
  • 78. Clean Code – Guidelines Proposal Types Definitions • Exceptions should be exceptional Some languages don’t implement them https://golang.org/doc/faq#exceptions use Exception in “panic” mode when DB or network is down, disk is full, dead branch is reached in code…
  • 79. Clean Code – Guidelines Proposal Types Definitions • Exceptions should be exceptional Severity is hidden Is it an user input entry error, or a DB failure? Not easy to transmit remotely Exceptions are classes with no persistence and sometimes some pointers to context
  • 80. Clean Code – Guidelines Proposal Types Definitions • Exceptions should be exceptional Performance cost On all platforms Not debugger-friendly Did you try to debug Indy calls in the IDE?
  • 81. Clean Code – Guidelines Proposal Types Definitions • Exceptions should be exceptional Rely on Error Codes Dedicated Enumerations Optionally with some text for UI Complex errors may return a class/record But not the same class as on success
  • 82. Clean Code – Guidelines Proposal Types Definitions • Exceptions should be exceptional Don’t rely on HTTP status codes Logic should be uncoupled from HTTP What if you execute the code locally? Only if you really need it e.g. when implementing a standard
  • 83. Clean Code – Guidelines Proposal Types Definitions • Exceptions should be exceptional Log and transmit all exceptions On heavily loaded servers, it would save you a lot of time filtering real problems Too much notification is killing the notification!
  • 84. Clean Code – Guidelines Proposal Clean Code i. From consensus comes success ii. Don’t pollute your code – hide technical iii. Naming is everything iv. Code should be like natural language v. Make the implicit explicit vi. Exceptions should be exceptional vii. ….
  • 85. Clean Code – Guidelines Proposal • Questions? Clean Code Guidelines Proposal