$30 off During Our Annual Pro Sale. View Details »

2023 - WebConf - 選擇適合你的技能組合

2023 - WebConf - 選擇適合你的技能組合

近十年來軟體產業蓬勃發展,許多新語言、框架跟工具都不斷被推出,我們應該如何選擇?我以一名 Ruby 愛好者的角度來說明持續選用 Ruby 的理由,來解釋問題沒有想像中困難,也不那麼單純。更多是我們自身的個性、環境影響,當我們了解一個語言跟框架的特性,就很好找到適合自己的工具和技能。

蒼時弦や

August 12, 2023
Tweet

More Decks by 蒼時弦や

Other Decks in Programming

Transcript

  1. C 1972 1983 C++ Python 1991 1995 Java PHP Ruby

    JavaScript 200 1990 年代,World Wide Web(全球資訊網)被提出
  2. PHP Ruby JavaScript C# 2000 2009 Go Node.js Rust 2013

    2006 年代,Amazon Web Service 推出
  3. Spring 2002 2005 Rails Django .NET MVC 2007 2010 Angular

    Laravel 2011 Web 2.0 後當代主流的網站開發框架才逐漸成形
  4. 2005 Rails Django .NET MVC 2007 2010 Angular Laravel 2011

    2013 React Vue 2014 後端成型後的十年,前端框架也開始被提出
  5. # Ruby def end (value) value inspect inspect [ ]

    inspect puts "string" "array"
  6. // Golang // ... func switch := case string case

    string string (obj any) { v obj.(type) { : fmt. (v) [] : fmt. (v) } } ( ) ([] { }) Inspect Println Println Inspect Inspect "string" "array"
  7. # Ruby Person Struct :name :age Person name: age: 28

    Person name: age: . ( , ) bob . ( , ) john . ( , ) = new = new = new "Bob" "John" "John"
  8. // Golang // cannot use "John" (untyped string constant) as

    int value in struct literal type struct string int := := { Name Age } bob Person{Name: , Age: } john Person{Name: , Age: } Person "Bob" "John" "John" 28
  9. # Ruby def do new end & end (services) services

    .map |service| . { service.start } .each( ) run Thread :join
  10. // Golang // select { ... } package type interface

    func ... := for := range go func {
 (ctx context.Context)
 } (services Service) { ctx context. () _, svc services { () { svc. (ctx) } } } daemon Service Run Start Background Start
  11. // Golang // ... package type struct func * {}

    (s Server) (ctx context.Context) { } http Server Start
  12. // C# namespace interface void class void Service foreach IService

    in { { () } { ( [] ) { ( services) { service. () } } } } Daemon IService Start Main Run services service Start
  13. // C# // ... namespace class Daemon IService { :

    . { () { } } } Http Server Start
  14. # Ruby class < def new + + end end

    = new = new + ( , ) (other) (x other.x, y other.y) p1 . ( , ) p2 . ( , ) p1 p2 Point Struct.new + :x :y Point x: 1 y: 1 Point x: 2 y: 2 puts
  15. # Elixir # ... defmodule do defstruct def + +

    end = = |> [ , ] (%{ x, y}, %{ x2, y2}), % { x x2, y y2 } p1 % { , } p2 % { , } . p1 . (p2) Point add Point Point Point IO inspect Point add :x :y x: y: x: y: do: x: y: x: 1 y: 1 x: 2 y: 2
  16. typedef struct int int = = + = + return

    int = = = = = = = return { x; y; } Point; Point (Point , Point ) { Point p { .x p1.x p2.x, .y p1.y p2.y }; p; } () { Point p1 { .x , .y }; Point p2 { .x , .y }; Point p (p1, p2); ( , p.x, p.y); ; } add main add printf p1 p2 1 1 2 2 %d %d 0 "x = , y = "
  17. Point(1, 1) Object Add(p1, p2) Method Point(3, 3) Object 物件是一組有意義的資料,類別(Class)則是定義哪些函示能對資

    料發揮作用,稱為方法(Method) https://hackmd.io/@sysprog/c-oop#物件導向是一種態度
  18. # Ruby # ... module def end end class include

    include end (other) Addable add Point Addable Printable
  19. # Python # ... class def class pass : (self,

    other): ( , ): Addable add Point Addable Printable
  20. // Go // 這是對的嗎? type interface type struct { (other

    Addable) Addable } { Addable } Addable Point Add
  21. // Go // Yes, But! type interface type struct :=

    & { (other Addable) Addable } { Addable } p Point { Addable: Vec2{ , } } Addable Point Add 1 1
  22. // C // Usage: p.addable->vec2 // 更像這個狀況 typedef struct union

    * * = = = = = * { { Vec2 vec2; Vec3 vec3; } addable; } Point; Vec2 vec2 { .x , .y }; Point p { .addable vec2 }; 1 1
  23. 2023 Later - Rails 開發實踐 2024 Early - Cucumber 的文件測試法

    2024 Later - Rails 架構設計(規劃中) https://blog.aotoki.me