- Ruby is no longer considered a "cool" language according to the author, who examines several languages that are currently popular including Swift, Rust, Go, Elixir, Julia, and Dart.
- Swift was created by Apple to replace Objective-C and adds modern features while removing the complexity of C. Rust was created to be safe, concurrent, and practical while combining high and low level capabilities. Go was created at Google to be understandable, productive, and scale well for networking and multiprocessing. Elixir builds on Erlang's concurrency model and adds a Ruby-like syntax. Julia targets scientific computing by combining speed and interactivity. Dart was created by Google to replace JavaScript but never gained
12. “We absolutely loved Objective-C, but
we had to ask ourselves a question -
what would it be like if we had
Objective-C without the baggage of C?”
Tim Cook
14. @interface Foo : NSObject
@property (readonly) int bar;
- (instancetype)initWithBar:(int)bar;
+ (instancetype)fooWithBar:(int)bar;
@end
@implementation Foo
- (instancetype)initWithBar:(int)bar {
self = [super init];
if (self) {
_bar = bar;
}
return self;
}
+ (instancetype)fooWithBar:(int)bar {
return [[self alloc] initWithBar:bar];
}
@end
How bad is Objective-C?
http://www.antonzherdev.com/post/70064588471/top-13-worst-things-about-objective-c
15. Swift is easier to read
Objective-C
if (myDelegate != nil) {
if ([myDelegate respondsToSelector:
@selector(scrollViewDidScroll:)]) {
[myDelegate scrollViewDidScroll:myScrollView]
}
}
Swift
myDelegate?.scrollViewDidScroll?(myScrollView)
16. Why also Swift is better?
● no need to have two separate files (code and headers)
● it’s safer (runtime crash on null pointer)
● it has automatic ARC (Automatic Reference Counting)
● it’s faster
● it requires less code
● it has namespaces
17. It’s not only a language
XCode 8
https://developer.apple.com/xcode/
18. It’s not only a language
Swift Playgrounds
http://www.apple.com/swift/playgrounds/
19.
20. ● sponsored by Mozilla
● announced in 2010
● first release in 2012
● stable release in 2015
● statically, strongly typed
● multi-paradigm
● compiled
21. “The goal of the project is to
design and implement a safe,
concurrent, practical systems
language”
Rust FAQ
23. Current languages are wrong
● there is too little attention paid to safety
● they have poor concurrency support
● they offer limited control over resources
● they stick too much to paradigm
25. Rust is a high level language!
● generics
● traits
● pattern matching
● closures
● type inference
● automatic memory allocation and deallocation
● guaranteed memory safety
● threads without data races
26. Rust is a low level language!
● no garbage collector
● manual memory management
● zero-cost abstractions
● minimal runtime
● as fast as C/C++
32. Future of Rust
● currently two big projects: servo and rust
● other smaller projects: redox, cgmath, Iron, rust-doom
● it changes very quickly
● it has a good opinion in the community
● it will be hard to replace C/C++
● It has a steep learning curve
34. Go
● designed in Google in 2007
● first release in 2009
● stable release in 2016
● statically, strongly typed
● multi-paradigm, concurrent
● compiled
35. Standard languages (Java, C++)
● are very strong: type-safe, effective, efficient
● great in hands of experts
● used to build huge systems and companies
36. Standard languages (Java, C++)
● hard to use
● compilers are slow
● binaries are huge
● desperately need language-aware tools
● poorly adapt to clouds, multicore CPUs
37. Simpler languages (Python, Ruby, JS)
● easier to learn
● dynamically typed (fewer keystrokes)
● interpreted (no compiler to wait for)
● good tools (interpreters make things easier)
38. Simpler languages (Python, Ruby, JS)
● slow
● not type-safe
● hard to maintain in a big project
● very poor at scale
● not very modern
39. What if we had a static language with
dynamic-like syntax?
40. A niche for a language
● understandable
● statically typed
● productive and readable
● fast to work in
● scales well
● doesn't require tools, but supports them well
● good at networking and multiprocessing
41. Features of Go
● syntax typical for dynamic languages
● type inference
● fast compilation
● garbage collector
● memory safety features
● built-in concurrency
● object oriented without classes and inheritance
● lack of generics
● compiles to small statically linked binaries
42. Interfaces
type Animal interface {
Speak() string
}
type Dog struct {
}
func (d Dog) Speak() string {
return "Woof!"
}
func SaySomething(a Animal) {
fmt.Println(a.Speak())
}
func main() {
dog := Dog{}
SaySomething(dog)
}
45. Channels
func main() {
ch := make(chan int)
go expensiveComputation(x, y, z, ch)
v2 := anotherExpensiveComputation(a, b, c)
v1 := <- ch
fmt.Println(v1, v2)
}
46. Future of Go
● it’s popularity constantly raises
● it’s backed by Google
● it’s used by Docker, Netflix, Dropbox, CloudFare,
SoundCloud, BBC, New York Times, Uber and others
● it’s seen as a good balance between Java-like languages
and Python-like
● it easy to learn and powerful
● it runs well in cloud environments
● might be a good choice for microservices approach
47.
48. ● created by José Valim
● released in 2012
● functional
● dynamically, strongly typed
● compiled to Erlang VM byte code
54. Controllers in Rails
class PagesController < ApplicationController
def index
@title = params[:title]
@members = [
{name: "Chris McCord"},
{name: "Matt Sears"},
{name: "David Stump"},
{name: "Ricardo Thompson"}
]
render "index"
end
end
http://www.littlelines.com/blog/2014/07/08/elixir-vs-ruby-showdown-phoenix-vs-rails/
55. Controllers in Phoenix
defmodule Benchmarker.Controllers.Pages do
use Phoenix.Controller
def index(conn, %{"title" => title}) do
render conn, "index", title: title, members: [
%{name: "Chris McCord"},
%{name: "Matt Sears"},
%{name: "David Stump"},
%{name: "Ricardo Thompson"}
]
end
end
http://www.littlelines.com/blog/2014/07/08/elixir-vs-ruby-showdown-phoenix-vs-rails/
56. Future of Elixir
● new Erlang for the masses
● fits highly concurrent niche
● attracts Ruby developers
● no big company behind
● used by Pinterest
● will fly on the wings of Phoenix?
57.
58. ● created by data scientists
● released in 2012
● dynamically, strongly typed
● compiled
59. Compiled one for fast stuff.
Interpreted one for visualisation.
Data scientists’ two languages problem:
60. Julia features
● solves scientists’ two language problem
● familiar syntax
● extensive scientific library
● user-defined types
● multiple dispatch
● built-in parallelism
● good performance (comparing to C)
67. Dart vs JavaScript
● class-based (not prototype-based)
● normal foreach
● named parameters
● operator overriding
● string interpolation
● optional typing
● false is false
● easy DOM operations
68. Looks familiar
class Point {
num x;
num y;
Point(this.x, this.y);
distanceFromOrigin() {
return sqrt(x * x + y * y);
}
}
main() {
var p = new Point(2, 3);
print(p.distanceFromOrigin());
}
70. Future of Dart
● 2016 AdWord UI built in Dart
● no Dart VM in browsers
● fragmented community
● client-side future is dim
● backend future looks much better