SlideShare uma empresa Scribd logo
1 de 50
Baixar para ler offline
Spot Your White Caml
Make Yourself Happy  in OCaml Projects
BTW J. Furuse aka CamlSpotter 15 years of OCaml programming 3 years of Functional Quants
Scenario You have jumped into an OCaml Project.
Congrats : Your Choice was Correct! OCaml is a good to get your work done: ,[object Object]
Enough Stable
Reasonably fast
Very simple ,[object Object]
Scalable
Strong abstraction
Multi-paradigm
Typical Day 1 : Welcome! ,[object Object]
New Cool Office
Good Machine
Even A Welcome Party!
Typical Day 2 : Real Job Starts
Typical Day 2 : Real Job Starts Overwhelmed type 'a desc = { position : Postion.t; value : 'a }  let rec typecheck env = function Exp_int n ->  open Utils open Sourceloc open Spot module Kind = struct include Kind let to_string = function Value -> &quot;Value&quot; let escaped pred s = let b = Buffer.create (String.length s) in String.iter (fun c -> if pred c then Buffer.add_char b '';  module Make (M : Basic) : S with type 'a monad = 'a M.t = struct let bind = M.bind type error = E2BIG | EACCES | EAGAIN | EBADF let cflag_of_int = function | 0x0001 -> `CASELESS | 0x0002 -> `MULTILINE | 0x0004 -> `DOTALL | 0x0008 -> `EXTENDED  class ['a] gobject_signals obj = object  val obj : 'a obj = obj val after = false method after = {< after = true >} method private connect : 'b. ('a,'b) GtkSignal.t -> callback:'b -> _ =
Typical Day 100
Typical Day 100 Still being Overwhelmed... type 'a desc = { position : Postion.t; value : 'a }  let rec typecheck env = function Exp_int n ->  open Utils open Sourceloc open Spot module Kind = struct include Kind let to_string = function Value -> &quot;Value&quot; let escaped pred s = let b = Buffer.create (String.length s) in String.iter (fun c -> if pred c then Buffer.add_char b '';  module Make (M : Basic) : S with type 'a monad = 'a M.t = struct let bind = M.bind type error = E2BIG | EACCES | EAGAIN | EBADF let cflag_of_int = function | 0x0001 -> `CASELESS | 0x0002 -> `MULTILINE | 0x0004 -> `DOTALL | 0x0008 -> `EXTENDED  class ['a] gobject_signals obj = object  val obj : 'a obj = obj val after = false method after = {< after = true >} method private connect : 'b. ('a,'b) GtkSignal.t -> callback:'b -> _ =
Why ,[object Object]
Seniors look Smarter than you ? You Senior
Answer : Curves Learning vs Code Growth  Time LoC Seniors
Answer : Curves Learning vs Code Growth  Time LoC Eternal Rookies Seniors
Improve Your Learning Curve How to ,[object Object]
Write Good Code
Ask Questions
Minimize Reading Effort
Read .mli First ,[object Object]
Skip implementations (=.ml) if possible
Write Good .mli Good for Yourself and the Others ,[object Object]
Show the things the users should care
With GOOD and SHORT comments
Let TYPES tell details of functions
ocamlc -i gives a good start point
Do NOT Guess .mli ,[object Object]
Ask the Authors write them Write them, or I get Home. Not something automatically created.
Do NOT Ask Silly Questions ,[object Object],Where is it? In foo/bar.ml  Where is this? In bar/boo.mli  What is that? Uh, oh...
Ask Good Questions ,[object Object]
Then Ask WHY, which the Code does NOT tell you Why this data type is  designed like this?  Some combinations never  appear in the algorithm. It could be simpler. Oh, this new guy is Strong...
Still NOT ENOUGH ,[object Object]
But  NOT the most Critical!
Where is Your White ?
80% of Your Energy is for Searching Where is the definition of this and that ? What the type of this ?
Syntax Hilighting It  improves   Local Vicinity  of  your Code. ,[object Object]
tuareg-mode.el  (1.45.6-2 / 1.46.2 / (2.0.1))
{syntax,ftplugin,indent}/ocaml.vim (2010 Aug 07)
Manual Search It NEVER Scales. You are warned. Names are defined ,[object Object]
in Pervasives
in file system (include path)
in opened modules

Mais conteúdo relacionado

Mais procurados

Command Line Applications with Ruby
Command Line Applications with RubyCommand Line Applications with Ruby
Command Line Applications with RubyAlexander Merkulov
 
Java script good_bad_awful
Java script good_bad_awfulJava script good_bad_awful
Java script good_bad_awfulmoamen_mokhtar
 
Low Latency Logging with RabbitMQ (Brno PHP, CZ - 20th Sep 2014)
Low Latency Logging with RabbitMQ (Brno PHP, CZ - 20th Sep 2014)Low Latency Logging with RabbitMQ (Brno PHP, CZ - 20th Sep 2014)
Low Latency Logging with RabbitMQ (Brno PHP, CZ - 20th Sep 2014)James Titcumb
 
Building C and C++ libraries with Perl
Building C and C++ libraries with PerlBuilding C and C++ libraries with Perl
Building C and C++ libraries with PerlAlberto Simões
 
Getting modern with logging via log4perl
Getting modern with logging via log4perlGetting modern with logging via log4perl
Getting modern with logging via log4perlDean Hamstead
 
Low Latency Logging with RabbitMQ (PHP London - 4th Sep 2014)
Low Latency Logging with RabbitMQ (PHP London - 4th Sep 2014)Low Latency Logging with RabbitMQ (PHP London - 4th Sep 2014)
Low Latency Logging with RabbitMQ (PHP London - 4th Sep 2014)James Titcumb
 
Write your Ruby in Style
Write your Ruby in StyleWrite your Ruby in Style
Write your Ruby in StyleBhavin Javia
 
New Stuff In Php 5.3
New Stuff In Php 5.3New Stuff In Php 5.3
New Stuff In Php 5.3Chris Chubb
 
Sinatra Rack And Middleware
Sinatra Rack And MiddlewareSinatra Rack And Middleware
Sinatra Rack And MiddlewareBen Schwarz
 
Pragmatic JavaScript
Pragmatic JavaScriptPragmatic JavaScript
Pragmatic JavaScriptJohn Hann
 
What's new in Perl 5.10?
What's new in Perl 5.10?What's new in Perl 5.10?
What's new in Perl 5.10?acme
 
PHP tutorial | ptutorial
PHP tutorial | ptutorialPHP tutorial | ptutorial
PHP tutorial | ptutorialPTutorial Web
 
Ruby Basics
Ruby BasicsRuby Basics
Ruby BasicsSHC
 
Rails 3 generators
Rails 3 generatorsRails 3 generators
Rails 3 generatorsjoshsmoore
 

Mais procurados (20)

Command Line Applications with Ruby
Command Line Applications with RubyCommand Line Applications with Ruby
Command Line Applications with Ruby
 
Java script good_bad_awful
Java script good_bad_awfulJava script good_bad_awful
Java script good_bad_awful
 
Debugging With Php
Debugging With PhpDebugging With Php
Debugging With Php
 
PHP 5.3
PHP 5.3PHP 5.3
PHP 5.3
 
Low Latency Logging with RabbitMQ (Brno PHP, CZ - 20th Sep 2014)
Low Latency Logging with RabbitMQ (Brno PHP, CZ - 20th Sep 2014)Low Latency Logging with RabbitMQ (Brno PHP, CZ - 20th Sep 2014)
Low Latency Logging with RabbitMQ (Brno PHP, CZ - 20th Sep 2014)
 
Building C and C++ libraries with Perl
Building C and C++ libraries with PerlBuilding C and C++ libraries with Perl
Building C and C++ libraries with Perl
 
Ruby on Rails for beginners
Ruby on Rails for beginnersRuby on Rails for beginners
Ruby on Rails for beginners
 
Erlangfactory
ErlangfactoryErlangfactory
Erlangfactory
 
Getting modern with logging via log4perl
Getting modern with logging via log4perlGetting modern with logging via log4perl
Getting modern with logging via log4perl
 
Low Latency Logging with RabbitMQ (PHP London - 4th Sep 2014)
Low Latency Logging with RabbitMQ (PHP London - 4th Sep 2014)Low Latency Logging with RabbitMQ (PHP London - 4th Sep 2014)
Low Latency Logging with RabbitMQ (PHP London - 4th Sep 2014)
 
Syntax errors
Syntax errorsSyntax errors
Syntax errors
 
Fasterflect
FasterflectFasterflect
Fasterflect
 
Write your Ruby in Style
Write your Ruby in StyleWrite your Ruby in Style
Write your Ruby in Style
 
New Stuff In Php 5.3
New Stuff In Php 5.3New Stuff In Php 5.3
New Stuff In Php 5.3
 
Sinatra Rack And Middleware
Sinatra Rack And MiddlewareSinatra Rack And Middleware
Sinatra Rack And Middleware
 
Pragmatic JavaScript
Pragmatic JavaScriptPragmatic JavaScript
Pragmatic JavaScript
 
What's new in Perl 5.10?
What's new in Perl 5.10?What's new in Perl 5.10?
What's new in Perl 5.10?
 
PHP tutorial | ptutorial
PHP tutorial | ptutorialPHP tutorial | ptutorial
PHP tutorial | ptutorial
 
Ruby Basics
Ruby BasicsRuby Basics
Ruby Basics
 
Rails 3 generators
Rails 3 generatorsRails 3 generators
Rails 3 generators
 

Destaque (7)

Law Skyler
Law SkylerLaw Skyler
Law Skyler
 
Camel
CamelCamel
Camel
 
Camel as zoo animal
Camel as zoo animalCamel as zoo animal
Camel as zoo animal
 
Camel diseases 2016
Camel diseases 2016Camel diseases 2016
Camel diseases 2016
 
Digestive system of camel
Digestive system of camelDigestive system of camel
Digestive system of camel
 
Camel presentation
Camel presentationCamel presentation
Camel presentation
 
The camel
The camelThe camel
The camel
 

Semelhante a Um2010

You shouldneverdo
You shouldneverdoYou shouldneverdo
You shouldneverdodaniil3
 
Don't RTFM, WTFM - Open Source Documentation - German Perl Workshop 2010
Don't RTFM, WTFM - Open Source Documentation - German Perl Workshop 2010Don't RTFM, WTFM - Open Source Documentation - German Perl Workshop 2010
Don't RTFM, WTFM - Open Source Documentation - German Perl Workshop 2010singingfish
 
ooc - A hybrid language experiment
ooc - A hybrid language experimentooc - A hybrid language experiment
ooc - A hybrid language experimentAmos Wenger
 
ooc - A hybrid language experiment
ooc - A hybrid language experimentooc - A hybrid language experiment
ooc - A hybrid language experimentAmos Wenger
 
Beyond the Style Guides
Beyond the Style GuidesBeyond the Style Guides
Beyond the Style GuidesMosky Liu
 
How Xslate Works
How Xslate WorksHow Xslate Works
How Xslate WorksGoro Fuji
 
Debugging and Error handling
Debugging and Error handlingDebugging and Error handling
Debugging and Error handlingSuite Solutions
 
2009 Eclipse Con
2009 Eclipse Con2009 Eclipse Con
2009 Eclipse Conguest29922
 
Developing A Procedural Language For Postgre Sql
Developing A Procedural Language For Postgre SqlDeveloping A Procedural Language For Postgre Sql
Developing A Procedural Language For Postgre SqlJoshua Drake
 
A Bonus to the "Three Interviews About Static Analyzers" Article, or Intervie...
A Bonus to the "Three Interviews About Static Analyzers" Article, or Intervie...A Bonus to the "Three Interviews About Static Analyzers" Article, or Intervie...
A Bonus to the "Three Interviews About Static Analyzers" Article, or Intervie...Andrey Karpov
 
Boo Manifesto
Boo ManifestoBoo Manifesto
Boo Manifestohu hans
 
Best practices in museum search
 Best practices in museum search Best practices in museum search
Best practices in museum searchNate Solas
 
Teflon - Anti Stick for the browser attack surface
Teflon - Anti Stick for the browser attack surfaceTeflon - Anti Stick for the browser attack surface
Teflon - Anti Stick for the browser attack surfaceSaumil Shah
 
Why Students Need the CppCat Code Analyzer
Why Students Need the CppCat Code AnalyzerWhy Students Need the CppCat Code Analyzer
Why Students Need the CppCat Code AnalyzerPVS-Studio
 
Your Library Sucks, and why you should use it.
Your Library Sucks, and why you should use it.Your Library Sucks, and why you should use it.
Your Library Sucks, and why you should use it.Peter Higgins
 

Semelhante a Um2010 (20)

You shouldneverdo
You shouldneverdoYou shouldneverdo
You shouldneverdo
 
Don't RTFM, WTFM - Open Source Documentation - German Perl Workshop 2010
Don't RTFM, WTFM - Open Source Documentation - German Perl Workshop 2010Don't RTFM, WTFM - Open Source Documentation - German Perl Workshop 2010
Don't RTFM, WTFM - Open Source Documentation - German Perl Workshop 2010
 
ooc - A hybrid language experiment
ooc - A hybrid language experimentooc - A hybrid language experiment
ooc - A hybrid language experiment
 
ooc - A hybrid language experiment
ooc - A hybrid language experimentooc - A hybrid language experiment
ooc - A hybrid language experiment
 
Beyond the Style Guides
Beyond the Style GuidesBeyond the Style Guides
Beyond the Style Guides
 
How Xslate Works
How Xslate WorksHow Xslate Works
How Xslate Works
 
Ot performance webinar
Ot performance webinarOt performance webinar
Ot performance webinar
 
Debugging and Error handling
Debugging and Error handlingDebugging and Error handling
Debugging and Error handling
 
Coding standard
Coding standardCoding standard
Coding standard
 
2009 Eclipse Con
2009 Eclipse Con2009 Eclipse Con
2009 Eclipse Con
 
A Life of breakpoint
A Life of breakpointA Life of breakpoint
A Life of breakpoint
 
All of javascript
All of javascriptAll of javascript
All of javascript
 
Developing A Procedural Language For Postgre Sql
Developing A Procedural Language For Postgre SqlDeveloping A Procedural Language For Postgre Sql
Developing A Procedural Language For Postgre Sql
 
A Bonus to the "Three Interviews About Static Analyzers" Article, or Intervie...
A Bonus to the "Three Interviews About Static Analyzers" Article, or Intervie...A Bonus to the "Three Interviews About Static Analyzers" Article, or Intervie...
A Bonus to the "Three Interviews About Static Analyzers" Article, or Intervie...
 
Boo Manifesto
Boo ManifestoBoo Manifesto
Boo Manifesto
 
Best practices in museum search
 Best practices in museum search Best practices in museum search
Best practices in museum search
 
Teflon - Anti Stick for the browser attack surface
Teflon - Anti Stick for the browser attack surfaceTeflon - Anti Stick for the browser attack surface
Teflon - Anti Stick for the browser attack surface
 
Why Students Need the CppCat Code Analyzer
Why Students Need the CppCat Code AnalyzerWhy Students Need the CppCat Code Analyzer
Why Students Need the CppCat Code Analyzer
 
Your Library Sucks, and why you should use it.
Your Library Sucks, and why you should use it.Your Library Sucks, and why you should use it.
Your Library Sucks, and why you should use it.
 
Introduction to Parallelization and performance optimization
Introduction to Parallelization and performance optimizationIntroduction to Parallelization and performance optimization
Introduction to Parallelization and performance optimization
 

Mais de Jun Furuse

Tezos 008 Edo protocol
Tezos 008 Edo protocolTezos 008 Edo protocol
Tezos 008 Edo protocolJun Furuse
 
Plebeia, a new storage for Tezos blockchain state
Plebeia, a new storage for Tezos blockchain statePlebeia, a new storage for Tezos blockchain state
Plebeia, a new storage for Tezos blockchain stateJun Furuse
 
SCaml update 2020-06
SCaml update 2020-06SCaml update 2020-06
SCaml update 2020-06Jun Furuse
 
Tezso and on-chain governanace: towards "Kyoto amendment"
Tezso  and on-chain governanace: towards "Kyoto amendment"Tezso  and on-chain governanace: towards "Kyoto amendment"
Tezso and on-chain governanace: towards "Kyoto amendment"Jun Furuse
 
Comparison of Proof of Stakes
Comparison of Proof of StakesComparison of Proof of Stakes
Comparison of Proof of StakesJun Furuse
 
SCaml compiler
SCaml compilerSCaml compiler
SCaml compilerJun Furuse
 
SCaml compiler
SCaml compilerSCaml compiler
SCaml compilerJun Furuse
 
Blockchain and Smart Contract Simulation
Blockchain and Smart Contract SimulationBlockchain and Smart Contract Simulation
Blockchain and Smart Contract SimulationJun Furuse
 
Blockchain and formal verification (Japanese)
Blockchain and formal verification (Japanese)Blockchain and formal verification (Japanese)
Blockchain and formal verification (Japanese)Jun Furuse
 
Blockchain and Formal verification (English)
Blockchain and Formal verification (English)Blockchain and Formal verification (English)
Blockchain and Formal verification (English)Jun Furuse
 
Tezos Hands on 2019-06-15 Exercise (Japanese)
Tezos Hands on 2019-06-15 Exercise (Japanese)Tezos Hands on 2019-06-15 Exercise (Japanese)
Tezos Hands on 2019-06-15 Exercise (Japanese)Jun Furuse
 
Tezos Hands on 2019-06-15 (Japanese)
Tezos Hands on 2019-06-15 (Japanese)Tezos Hands on 2019-06-15 (Japanese)
Tezos Hands on 2019-06-15 (Japanese)Jun Furuse
 
Tezos and its formal verification (Japanese)
Tezos and its formal verification (Japanese)Tezos and its formal verification (Japanese)
Tezos and its formal verification (Japanese)Jun Furuse
 
Tezos hands-on : Tezos exercise
Tezos hands-on : Tezos exerciseTezos hands-on : Tezos exercise
Tezos hands-on : Tezos exerciseJun Furuse
 
Tezos hands-on : Tezos overview
Tezos hands-on : Tezos overviewTezos hands-on : Tezos overview
Tezos hands-on : Tezos overviewJun Furuse
 
Tezos: Self-amending crypt ledger (Japanese)
Tezos: Self-amending crypt ledger (Japanese)Tezos: Self-amending crypt ledger (Japanese)
Tezos: Self-amending crypt ledger (Japanese)Jun Furuse
 
ブロックチェーンと形式検証
ブロックチェーンと形式検証ブロックチェーンと形式検証
ブロックチェーンと形式検証Jun Furuse
 
Recent tezos core developments
Recent tezos core developmentsRecent tezos core developments
Recent tezos core developmentsJun Furuse
 
Challenges in blockchain certification (Nov 19, 2018 for TPP2018)
Challenges in blockchain certification (Nov 19, 2018 for TPP2018)Challenges in blockchain certification (Nov 19, 2018 for TPP2018)
Challenges in blockchain certification (Nov 19, 2018 for TPP2018)Jun Furuse
 
OCamlOScope: a New OCaml API Search
OCamlOScope: a New OCaml API SearchOCamlOScope: a New OCaml API Search
OCamlOScope: a New OCaml API SearchJun Furuse
 

Mais de Jun Furuse (20)

Tezos 008 Edo protocol
Tezos 008 Edo protocolTezos 008 Edo protocol
Tezos 008 Edo protocol
 
Plebeia, a new storage for Tezos blockchain state
Plebeia, a new storage for Tezos blockchain statePlebeia, a new storage for Tezos blockchain state
Plebeia, a new storage for Tezos blockchain state
 
SCaml update 2020-06
SCaml update 2020-06SCaml update 2020-06
SCaml update 2020-06
 
Tezso and on-chain governanace: towards "Kyoto amendment"
Tezso  and on-chain governanace: towards "Kyoto amendment"Tezso  and on-chain governanace: towards "Kyoto amendment"
Tezso and on-chain governanace: towards "Kyoto amendment"
 
Comparison of Proof of Stakes
Comparison of Proof of StakesComparison of Proof of Stakes
Comparison of Proof of Stakes
 
SCaml compiler
SCaml compilerSCaml compiler
SCaml compiler
 
SCaml compiler
SCaml compilerSCaml compiler
SCaml compiler
 
Blockchain and Smart Contract Simulation
Blockchain and Smart Contract SimulationBlockchain and Smart Contract Simulation
Blockchain and Smart Contract Simulation
 
Blockchain and formal verification (Japanese)
Blockchain and formal verification (Japanese)Blockchain and formal verification (Japanese)
Blockchain and formal verification (Japanese)
 
Blockchain and Formal verification (English)
Blockchain and Formal verification (English)Blockchain and Formal verification (English)
Blockchain and Formal verification (English)
 
Tezos Hands on 2019-06-15 Exercise (Japanese)
Tezos Hands on 2019-06-15 Exercise (Japanese)Tezos Hands on 2019-06-15 Exercise (Japanese)
Tezos Hands on 2019-06-15 Exercise (Japanese)
 
Tezos Hands on 2019-06-15 (Japanese)
Tezos Hands on 2019-06-15 (Japanese)Tezos Hands on 2019-06-15 (Japanese)
Tezos Hands on 2019-06-15 (Japanese)
 
Tezos and its formal verification (Japanese)
Tezos and its formal verification (Japanese)Tezos and its formal verification (Japanese)
Tezos and its formal verification (Japanese)
 
Tezos hands-on : Tezos exercise
Tezos hands-on : Tezos exerciseTezos hands-on : Tezos exercise
Tezos hands-on : Tezos exercise
 
Tezos hands-on : Tezos overview
Tezos hands-on : Tezos overviewTezos hands-on : Tezos overview
Tezos hands-on : Tezos overview
 
Tezos: Self-amending crypt ledger (Japanese)
Tezos: Self-amending crypt ledger (Japanese)Tezos: Self-amending crypt ledger (Japanese)
Tezos: Self-amending crypt ledger (Japanese)
 
ブロックチェーンと形式検証
ブロックチェーンと形式検証ブロックチェーンと形式検証
ブロックチェーンと形式検証
 
Recent tezos core developments
Recent tezos core developmentsRecent tezos core developments
Recent tezos core developments
 
Challenges in blockchain certification (Nov 19, 2018 for TPP2018)
Challenges in blockchain certification (Nov 19, 2018 for TPP2018)Challenges in blockchain certification (Nov 19, 2018 for TPP2018)
Challenges in blockchain certification (Nov 19, 2018 for TPP2018)
 
OCamlOScope: a New OCaml API Search
OCamlOScope: a New OCaml API SearchOCamlOScope: a New OCaml API Search
OCamlOScope: a New OCaml API Search
 

Um2010