IT討論區(78)

1001 回覆
3 Like 0 Dislike
2020-03-25 02:01:11
舊post
(1): https://lihkg.na.cx/thread/4990/page/1
(2): https://lihkg.na.cx/thread/69444/page/1
(3): https://lihkg.na.cx/thread/89460/page/1
(4): https://lihkg.com/thread/116590/page/1
(5): https://lihkg.com/thread/130061/page/1
(6): https://lihkg.com/thread/148992/page/1
(7): https://lihkg.com/thread/170835/page/1
(8): https://lihkg.com/thread/208042/page/1
(9): https://lihkg.com/thread/233717/page/1
(10): https://lihkg.com/thread/250870/page/1
(11): https://lihkg.com/thread/269901/page/1
(12): https://lihkg.com/thread/287135/page/1
(13): https://lihkg.com/thread/303147/page/1
(14): https://lihkg.com/thread/323813/page/1
(15): https://lihkg.com/thread/346843/page/1
(16): https://lihkg.com/thread/385374/page/1
(17): https://lihkg.com/thread/407488/page/1
(18): https://lihkg.com/thread/432444/page/1
(19): https://lihkg.com/thread/456486/page/1
(20): https://lihkg.com/thread/471984/page/1
(21): https://lihkg.com/thread/503507/page/1
(22): https://lihkg.com/thread/547628/page/1
(23): https://lihkg.com/thread/576562/page/1
(24): https://lihkg.com/thread/602397/page/1
(25): https://lihkg.com/thread/627728/page/1
(26): https://lihkg.com/thread/651466/page/1
(27): https://lihkg.com/thread/673484/page/1
(28): https://lihkg.com/thread/690968/page/1
(29): https://lihkg.com/thread/701812/page/1
(30): https://lihkg.com/thread/718050/page/1
(31): https://lihkg.com/thread/729926/page/1
(32): https://lihkg.com/thread/739411/page/1
(33): https://lihkg.com/thread/746333/page/1
(34): https://lihkg.com/thread/754096/page/1
(35): https://lihkg.com/thread/762089/page/1
(36): https://lihkg.com/thread/769677/page/1
(37): https://lihkg.com/thread/776679/page/1
(38): https://lihkg.com/thread/784699/page/1
(39): https://lihkg.com/thread/791805/page/1
(40): https://lihkg.com/thread/800016/page/1
(41): https://lihkg.com/thread/807460/page/1
(42): https://lihkg.com/thread/816001/page/1
(43): https://lihkg.com/thread/828694/page/1
(44): https://lihkg.com/thread/837713/page/1
(45): https://lihkg.com/thread/855218/page/1
(46): https://lihkg.com/thread/871851/page/1
(47): https://lihkg.com/thread/895032/page/1
(48): https://lihkg.com/thread/906329/page/1
(49): https://lihkg.com/thread/921824/page/1
(50): https://lihkg.com/thread/933250/page/1
(51): https://lihkg.com/thread/941628/page/1
(52): https://lihkg.com/thread/954097/page/1
(53): https://lihkg.com/thread/966642/page/1
(54): https://lihkg.com/thread/975683/page/1
(55): https://lihkg.com/thread/986392/page/1
(56): https://lihkg.com/thread/1001177/page/1
(57): https://lihkg.com/thread/1018974/page/1
(58): https://lihkg.com/thread/1040860/page/1
(59): https://lihkg.com/thread/1055888/page/1
(60): https://lihkg.com/thread/1081932/page/1
(61): https://lihkg.com/thread/1101303/page/1
(62): https://lihkg.com/thread/1122848/page/1
(63): https://lihkg.com/thread/1144684/page/1
(64): https://lihkg.com/thread/1173865/page/1
(65): https://lihkg.com/thread/1221713/page/1
(66): https://lihkg.com/thread/1279229/page/1
(67): https://lihkg.com/thread/1311338/page/1
(68): https://lihkg.com/thread/1364346/page/1
(69):https://lihkg.com/thread/1494024/page/1
(70):https://lihkg.com/thread/1657743/page/1
(71):https://lihkg.com/thread/1698184/page/1
(72):https://lihkg.com/thread/1791753/page/1
(73):https://lihkg.com/thread/1791761/page/1
(74):https://lihkg.com/thread/1845165/page/1
(75):https://lihkg.com/thread/1888137/page/1
(76):https://lihkg.com/thread/1904680/page/1
(77):https://lihkg.com/thread/1928521
P仔 頂爛市參考價 :
乜都唔識 + HD: 16k - 18k
識少少 + HD: 17k-19k
u grad + 白紙: 18k~25k
P仔 頂爛市參考價 :
乜都唔識 + HD: 16k - 18k
識少少 + HD: 17k-19k
u grad + 白紙: 18k~25k
2020-03-25 02:01:42
https://medium.com/@p5d12000/工程師應該放心大膽地創造技術負債-a8022d85810
身為軟體工程師,你應該放心大膽地創造技術負債。這麼做唯一的風險,就只有在你換工作的時候,也會接手一大筆前人留下來的技術負債。不過,這種事情反正也早就已經發生了。
2020-03-25 02:05:21
有冇人用java 會跟Design Pattern去寫code
2020-03-25 06:16:08
2020-03-25 07:10:36
ecosystem:ts >> go
job market: ts/js > go (暫時香港冇乜 go 工)
simplicity: go >> ts (但係要注意 golang 有時係太簡單,簡單到連啲必要 feature 都無,俾人 complain 完,下個 release 好似話會有 generics
performance: go > ts
containerization: go > ts (golang compile 做一個 binary 就可以塞入 container,簡單方便快捷)
dependency management: go >> ts (create-react-app 行完個 node_ modules 冇記錯已經幾十至幾百mb,之前仲出咗單有人攞咗個 oss lib 嚟hack一個 crypto wallet,呢方面 deno 個 solution fix 緊)
避免寫爛code:go > ts
frontend/gui: ts >> go (golang 寫法太簡單,冇完整oop,注定係只可以寫 system/backend language)

其實 js 唔係有 google 大神寫個 v8 俾佢嘅話,速度應該同 Python/ruby 寫 server 嘅話差唔多


note:copy 前 po 1000

關於OOP 呢點我自己以前就成日用 ,依家就FP溝OOP 唔想debug 個陣太難追,開始討厭起state management ,同埋稍為補充下,
效能黎講有分Request per second ,以單機24GB 走SSD AWS黎講,GO routine GO keyword 一條8kb
玩websocket 係足以handle 同時間on hold 到100萬connection keep 到under 500 milesecond broadcasting
我自己用GO就係有機會用到呢個spec,同時唔想煩太多infra野

但其實TS 一樣可以做到呢樣野,AWS Lambda + API GATEWAY 由AWS幫你做serverless 既管理都可以,只係對我黎講用GO routine + channel 係容易d寫到我想做既野

依家GO出到1.4 大概18年個陣已經有提過generic ,RFC 都有人propose 左好耐,但對Google黎講GO = web 既C 擺脫好難寫既C++,所以取向係好明顯for google 內部stable 既distributed system(docker) 去用。因為build 出黎就一個package 無dependency,更意味住大改syntax update GO 導致無法兼容現有system 係不可接受

Official RFC 去加新feature 同既SOP GitHub issue 非常嚴謹,係要講個use case 後達到共識有人肯理你先改,裡面既人相當Geek,要知道GO 既歷史係由一班俾C++ 陷害過既人去考慮出黎,所以佢地極度限制新feature 呢樣野 ,要等到GO 2.0 等覺得仲要一段時間
2020-03-25 07:56:08
2020-03-25 10:01:59
2020-03-25 10:31:38
一個pj做得好
係吹水果個部門拎獎加人工
一個pj做得差
it9食死貓

咁it9做得好果陣有咩得著
2020-03-25 10:33:12
通常係跟多
2020-03-25 10:33:38
個人滿足感
2020-03-25 10:36:25
柒羊
2020-03-25 10:42:57
“Well done”
2020-03-25 10:54:35
2020-03-25 10:56:59
2020-03-25 10:58:21
IT狗需要依D?
乜唔係頒獎前就跳左槽咩?
2020-03-25 11:01:45
一個pj做得好
係吹水果個部門拎獎加人工
一個pj做得差
it9食死貓

咁it9做得好果陣有咩得著
IT狗需要依D?
乜唔係頒獎前就炒咗咩?


FTFY
2020-03-25 11:05:55
2020-03-25 11:16:27
打咗好耐
覺得遲啲可以出返篇文去 medium/dev.to

而家都唔係幾鍾意寫 oop
之前寫開react之後都覺得 java 個隻重型 oop 有啲煩
golang 個 model 係算恰到好處嘅
但係佢就係差無generics
冇 generics 啲code想寫到比較 fp 少少都唔得
例如 js 寫 map 就得嘅嘢
佢要開過 for loop 逐個 append 落去

仲有就係成日逼住用 interface + reflection
你可以見到最出名嘅 orm gorm 因為用 reflection 所以對比起用 codegen 嘅 orm 慢幾多
https://github.com/volatiletech/sqlboiler/blob/master/README.md#benchmarks
仲未計冇咗嘅 type-safety (non-typesafe 嘅 code goland/intellij 好少比到 intellisense)

實測我哋個 project 有一 set gen graph 嘅 code
backend golang frotnend typescript 都會用到所以兩隻 lang 都要 (上手格硬用 golang compile 落 typescript 搞到唔係好掂)
graph 個部份係幾個 mode 通用嘅
但係個 graph 要點 gen 嘅 logic 都係每個 mode 唔同
咁我嘅 approach 就係共用 gen graph 嘅 code
然後 gen graph 嘅 code 會食一個 function 去控制個 logic
你當個 structure 大約係
struct A, B, C
([]A, func (A) int) -> [][]C
([]B, func (B) int) -> [][]C
func gen(arr WhatType1, logic func (WhatType2) int) [][]C


因為 go 無 generics 所以寫到我頭都大埋
而且 []interface{} 佢都唔當係 interface{}
所以我 WhatType1 想塞個 interface{} 或者 []interface{} 落去都唔得
turns out 我define 多 一個 interface I 對應 A, B -> I
然後 WhatType1[]I, WhatType2I
跟住用 reflection 寫 glue code 去 convert []I <-> []A/[]B
當然寫一次就得唔洗逐個 type A,B,C
然後 logic func 就用 I.(A/B) 去處理
搞咗我一大輪
reflection 嘅 code 都要另外寫 test 確保無問題唔會行行下 panic
(其實可以係 gen 入面 reflect 到 arr[i].(A/B) 出嚟,但係我想確保 typesafety ,想盡量將要用 interface{} 嘅嘢 abstract 晒佢,同埋之前寫落嘅 gen 無預要 reflect,入面啲 code 好複雜唔想亂改)

至於 typescript 個 part
塞個 generics 落去輕鬆搞掂
自己 inference 到個 type 連 <> 都唔使
咁你話 generics 幾重要

我都好明白 Go team 班人個 concern
如果 Go 玩到變 C++ 嗰啲 template 咁寫個 std::vector 都整埋啲一匹布 嘅 compile error
我都唔會想再用
但係有啲好 basic 嘅 feature 對於 enterprise programming 係好難避免到
之前佢哋話想改 error handling 俾好多人 complain
我都覺得個 try/check proposal 可以接受到
但係其實都係純粹 syntax sugar
無話無咗唔得
反正大家都寫慣 if err != nil 用落唔算話太 verbose
亦都可以迫到新手做 error checking
但係 generics 呢啲嘢冇就係冇
雖然generics個 implementation 係會有 compile performance (好似 C++ 咁逐個 每個用到 generics 嘅 type gen 一次 code)或者 runtime performance (好似 C# 嗰啲做個 container 裝晒唔同type會係有影響?其實我都係第二度睇返嚟) 嘅影響
而且個 syntax change 都會影響深遠
但係我相信佢哋會攞到個好嘅 balance
佢寫得出嚟係 blog 到就真係希望會有
https://blog.golang.org/go1.15-proposals

有關 performance 果度
c10k 甚至 c100k 嘅效能係一回事
nodejs 一開始係用 non blocking io 做賣點
自然做得好
但係我最 concern 嘅係 runtime performance 同埋 compile-time performance

睇番 https://benchmarksgame-team.pages.debian.net/benchmarksgame/fastest/go-node.html
你可以見到 Go 係 consistently 食少啲 memory (其實係 v8 出名 memory hungry?)
而且 5/7 行得快啲
regex 個個快相信係因為佢係 c++ lib back 住自然快過 go
你可以見到 go 嘅 runtime performance 令到佢除咗 web development 之外
係 system development 方面都有好多人用
例如 cockroachdb tidb docker 等等都係用 golang 去寫
而 nodejs 嘅 use case 都係偏向 web development
好少人會用黎寫 system

至於 compile-time performance 果度
一個 compile 得快嘅 toolchain 係可以令成個 development 方便好多
尤其是係大 project
golang 嘅 compile performance 係出名快
typescript 淨係 transpile 未計 v8 去 interpret 做 byte code 再 optimize 去 machine code 都已經慢一截
用功能幾乎一樣嘅 js 同 go 版本 lib (上面果個) clean build 實測
mkdir -p /tmp/gocompilespeedtest
rm -r /tmp/gocompilespeedtest/*
go clean -cache
time go build -o /tmp/gocompilespeedtest ./...

real    0m1.314s
user    0m3.971s
sys     0m0.466s

rm -r ./build
time tsc --build tsconfig.json

real    0m4.117s
user    0m7.474s
sys     0m0.101s

雖然個 lib 暫時好細所以冇乜分別
但係大起上嚟個 difference 就好易 notice 到
以前寫 react incremental compile 都要等
成個 project build 有時要等幾分鐘
go toolchain 真心快好多

我自己 prefer 寫 server 會用啲至少有 static typing 嘅 language
static typing 感覺安全好多無咁容易出 bug
當然 performance 都係快一截
可惜好多 lang 都係 scripting lang
暫時黎講出名兼多人用嘅都係得 c/c++ go java c#
希望 kotlin dart rust 嗰啲上到位會有多啲競爭
但係 so far 如果你想有 static compile 嘅 type safe 同埋 performance
唔想玩 c/c++ 嗰啲 manual memory management
唔想用 m$ 嘅嘢
又唔想行 jvm 嘅話 (個人認為無 jvm 會比較 container friendly)
go 其實係唯一選擇
kotlin native 感覺比較少人用
dart 主打都唔係寫 server
rust 做 web server 感覺都係過咗火

可能因為咁所以 go 明明冇咁多 enterprise development 嘅 feature 啲人都係焗住用
2020-03-25 11:17:42
有咩 design pattern
2020-03-25 11:21:52
2020-03-25 11:26:38
MVC嗰啲
2020-03-25 11:29:30
跟 I mean 有 Tech Lead 定咗 我照跟
2020-03-25 11:44:42
多數佢定落個pattern就算幾柒 or 完全無pattern可言做小薯既都係要照跟
2020-03-25 12:03:27
spring boot 嗰啲唔係gen出嚟就係 mvc 嘅咩
吹水台自選台熱 門最 新手機台時事台政事台World體育台娛樂台動漫台Apps台遊戲台影視台講故台健康台感情台潮流台上班台財經台房屋台飲食台旅遊台學術台校園台汽車台音樂台創意台硬件台攝影台玩具台寵物台軟件台活動台電訊台直播台站務台成人台黑 洞