The document discusses the benefits of using the Erlang programming language. It highlights Erlang's abilities in horizontal and vertical scalability, hot swapping of code, asynchronous processing, supervision, live debugging, predictability, and requiring 4-10x less code that is faster to create, easier to reason about, and has fewer bugs. It compares Erlang favorably to other languages in terms of scalability, speed, and reliability due to its built-in concurrency, error handling, fault detection and recovery capabilities.
43. function greet( Gender, Name )
if Gender == male then
print( "Hello, Mr. %s!", Name )
else if Gender == female then
print( "Hello, Mrs. %s!", Name )
else
print( "Hello, %s!", Name )
end
vs greet( male, Name ) ->
print_out( “Hello Mr. ”, Name );
greet( female, Name ) ->
print_out( “Greetings Mrs. ”, Name );
greet( _, Name ) ->
print_out( “Wotcher ”, Name ).
Functions From http://learnyousomeerlang.com/
47. …
proc:spawn( fun( X ) -> do_stuff( X ) end ),
…
do_stuff( OnePerson ) -> change_the_world( OnePerson ).
Processes
48. if ( X instanceof Integer ) {
try {
change_position( X );
} catch ( ArithmeticException a ) {
// can't happen. ignore
} catch ( PositionException p ) {
// why would this happen?
} catch ( Exception e ) {
// The other code has this here
} catch ( Throwable t ) {
// Dunno why this was in the other code
vs
}
}
proc:spawn( fun( X ) -> change_position( X ) end ),
Defensive Programming