Lập trình tinh giản

  • Published on
    04-Aug-2015

  • View
    196

  • Download
    5

Embed Size (px)

Transcript

<p> 1. T P C H L P T R N H https://tapchilaptrinh.wordpress.com2Vol.04/2013 2. tr chuyn v Tinh gnTinh gn hay ting Anh l Lean khng thc s l mt khi nim mi m trn th gii, nhng Vit Nam ngi bit khng nhiu, ngi hiu cng t, ngi thc hnh li cng him. Khng r Lean vo Vit Nam chnh xc t thi im no, nhng chng ti phng on cng phi c hn hai thp k. Toyota vo Vit Nam nm 1995, v t nht th h cng mang n hi th Lean t y. Lean bt ngun t Nht Bn, gip cc cng ty Nht v ngy nay l cc cng ty trn ton cu trong vic tng li nhun, cht lng, nng sut, tc ng thi gim thiu n lc, thi gian v chi ph. Thy r nhng gi tr m Lean c th mang li cho pht trin phn mm ni ring v cuc sng ni chung, chng ti chn Lean lm ch ca s 2 ln ny. Tp Ch Lp Trnh hy vng s mang n cho bn nhng hiu bit v gi nht nh thc hnh Lean. Chc cc bn c nhng pht giy th v cng cc bi vit ca Tp Ch Lp Trnh! H Ni, thng 4 nm 2013 Ban bin tp Tp Ch Lp Trnh2 3. trong s nyS kinVo l . 2 Thng 4 2 0 1 34.ScrumDay Vit Nam 20125.Kha hc Lean Mindset6.Summer Coderetreat 2013Tinh gin 7. Bn v s n gin10. 7 nguyn l ca Pht trin phn mm Tinh gn14. 10 nguyn tc ca Lp trnh Tinh gn21. Ti cu trc n gin hn23. Hy tinh gn trong hc tp v cuc sng25. Thit k khng cht28. Kanban cho mi ngi31. Kim th n v vi PHPUnit trn NetbeansChia s 36. 37.3Th tnh bn Computer Bn c vi Tp ch Lp trnh 4. ScrumDay Vit Nam 2012 Ngy 09/12/2012, i hc FPT v Hanoi Scrum t chc hi tho v Phng php Pht trin Phn mm Linh hot (Agile Software Development) - ScrumDay Vit Nam 2012. y l ln u tin mt hi tho ln v Agile c t chc ti H Ni. Hi tho tp trung vo cc ni dung pht trin phn mm t qun l pht trin sn phm, k thut, cng c, quy trnh, cho n chin lc pht trin sn phm da trn trit l Agile. Chnh thc xut hin t nm 2001, n nay Agile tr thnh trit l ph bin nht th gii trong vic pht trin cc phn mm t n gin n phc tp. Tuy vy, Vit Nam, Agile mi ch xut hin trong mt cng ng CNTT hp v cn l mt n s vi i a s gii CNTT. ScrumDay Vit Nam 2012, c s tham gia ca cc din gi hng u trong nc lnh vc pht trin phn mm v Agile. Ch ca hi tho tp trung vo cc lnh vc pht trin phn mm t qun l pht trin sn phm, k thut, cng c, quy trnh, cho n chin lc pht trin sn phm da trn trit l Agile. V vy, ngi tham d c c hi tm hiu v phng php pht trin phn mm tin tin ang lm thay i trit l pht trin ca ngnh cng nghip phn mm, cng nh giao lu, chia s kinh nghim trong pht trin v ng dng AgileScrum vi cc chuyn gia v ng nghip khc. Mong rng, ScrumDay Vit Nam cng vi AgileTour (s kin thng nin c t chc ti Si Gn t nm 2011) s gp phn thc y vic ng dng AgileScrum trong cng ng CNTT Vit Nam, a ngnh cng nghip phn mm Vit Nam ngy cng pht trin.4 5. Kha hc Lean Mindset Ngy 07/03/2013, i hc FPT t chc kha hc Lean Mindset. Hc vin ca kha hc c lm vic vi Tom Poppendieck v Marry Poppendieck, hai tc gi ca Pht trin Phn mm Tinh gn (Lean Software Development). y l mt phng php sn xut phn mm theo trit l Agile, s dng T duy Tinh gn v cc nguyn l c trng ca Tinh gn (vn xut pht t ngnh sn xut t Lean Manufacturing) c p dng cho lnh vc pht trin phn mm. Trong chuyn ving thm Vit Nam theo li mi ca AgileVietnam.org hai ng b mang n cho cng ng CNTT hai kha hc Lean Mindset ti hai thnh ph ln l Si Gn v H Ni. Kha hc ch din ra trong duy nht mt ngy. Nhng ni dung c cp ti trong kha hc xoay quanh cc vn nh: ti sao cc cng ty li c kh nng bin nhng mi nguy him thnh thnh cng? Cch khm ph ra nhng g khch hng thc s mun? Lm th no cung cp sn phm ng tin cy hn bng cch qun l cng vic? v.v..Theo nh gi ca nhiu hc vin sau kha hc, k thut Value Stream Mapping (nh x Dng Gi tr) l iu th v nht m h hc c t kha hc ny. y l k thut c trin khai nhiu trong Sn xut Tinh gn, n gip tm ra cch thc gia tng hiu qu cho dng sn xut. Kha hc tuy ngn song n cung cp cho hc vin nhiu tng mi, trit l mi TINH GN hn trong cng vic cng nh cuc sng hng ngy. Mong rng s c thm nhng kha hc b ch nh vy dnh cho cng ng CNTT ti Vit Nam.5 6. SummerCoderetreat 2013 Coderetreat l g? Coderetreat l mt hot ng c khi xng vo khong 4 nm trc ti hi tho v m ngun Sandusky Ohio. C rt nhiu nhng cuc tho lun xoay quanh vic chng ta thc hnh khng . Trong nhng lnh vc c yu t sng to, ngi ta c rn luyn thng xuyn. Nhng hu ht cc lp trnh vin li c rn luyn ch yu t thc t cng vic. V vy h khng hc tp tt theo cch thng thy vi kh nng vn c nh khi h ri xa nhng p lc t thc t. Coderetreat ln u tin c t chc ti Ann Arbor, Michigan. Sau nhiu n lc, gi y Coderetreat c nh dng nh chng ta thy hm nay: n gin, hiu qu v c tnh lan ta.y cng l ln u tin Vit Nam tham gia s kin ny vi hai u cu l H Ni v Si Gn (do HanoiScrum v AgileVietnam ng ra phi hp t chc), kt ni trc tip vi cc im t chc khc ti cc quc gia Singapore, Trung Quc, Nht Bn.Gi y hot ng ny tr thnh thng l vi nhiu ngi vo mi dp cui tun.Sau s kin u tin ny, ban t chc nhn c nhiu phn hi tch cc t pha ngi tham d. V vy, vo ma h ny, Coderetreat s tip tc ph sng ti Vit Nam vi s kin Summer Coderetreat 2013. Pha H Ni, HanoiScrum v nhng thnh vin CocoDojo s phi hp cng cc im cu khc trong c nc cng t chc mt ngy hi dnh cho cc lp trnh vin v nhng ngi v ang rn luyn cc k nng lp trnh chuyn su.Hnh dung v Coderetreat Coderetreat l mt s kin thc hnh chuyn su, tp trung vo cc nguyn tc c bn ca pht trin phn mm v thit k. Bng cch cung cp cho cc nh pht trin c hi tham gia vo thc hnh c ch , trnh xa nhng p lc ca vic hon thnh nhim v. Coderetreat chng t l mt hot ng c hiu qu cao gip ci thin k nng vit m nhm gim thiu cc chi ph thay i theo thi gian.Hy vng vi sc nng ca ma h, mt ngy trn vn vi Coderetreat s mang n cho cc lp trnh vin nhng tri nghim ng nh.S kin Coderetreat din ra trong thi gian mt ngy vi cc c im c bn nh sau: Chia phin lm vic. Mi phin 45 pht. Gii bi ton Game of life ca Conway. Lp trnh theo cp (pair programming). Sau mi phin th o cp. Xa ht m ngun sau mi phin. Thc hin ci tin sau mi phin.a im v thi gian chi tit s c ban t chc thng bo n cc bn ti a ch: hanoiscrum.net facebook.com/groups/cocodojo Hn gp ti Summer Coderetreat Vit Nam 2013!Hot ng Coderetreat ti Vit Nam S kin Global Day of Coderetreat 2012 thu ht hn 3000 lp trnh vin trn ton th gii tri di trn 24 mi gi v c truyn trc tip thng qua cng c Hangout trn Google+.6 7. Bn v s n ginM Kim DungNu bn th nhn vo s pht trin logo qua cc thi k ca Nike, Mercedes, hay l Microsoft Windows, bn s thy c mt im chung: s n gin. Cc logo cng ngy cng n gin. Xu hng n gin ha hin khng ch trong thit k ha, m cn nh hng rt nhiu ti th gii cng ngh ngy naym khm ph, cn li i a s ngi s dng bnh thng thch mt sn phm ng n l bit cch dng. Ngi ta k rng Steve Jobs yu cu i ng k s thit k iPod lm th no ngi nghe c th chn c bi ht a thch trong vng 3 thao tc. Hoc nh Google, ngoi cht lng tm kim, mt phn cng quan trng cho s thnh cng ca h l thit k n gin, n gin n mc hu nh bt k ai cng c th s dng c m khng phi hc hi g nhiu. Kt qu l 70% s ngi dng my MP3 nghe nhc bng iPod v trn 80% lng tm kim Internet dng Google.Xu hng n gin ha Trc khi iPhone nh m ca Apple xut hin, nhng chic in thoi trng nh th no? Hnh vung, hnh bu dc, gp, trt, bt, nhiu nt, bn phm y , loi ng nt gc cnh, v.v.. Sau khi iPhone ra i vi ng mt nt bm, hnh dng gn nh phng l, ton ng nt c bn, th in thoi by gi trng nh Hnh 2.Khng ch d dng, vic n gin ha sn phm gip cho cc nh pht trin c tp trung vo cht lng. Nhng ngi theo ch ngha n gin c cu t hn tc l nhiu hn (Less is More). Cng mt cng sc b ra, phn mm n gin hn, t chc nng hn ng ngha vi cht lng mi chc nng s nhiu hn. Hy nghe li Steve Jobs khuyn Larry Page, CEO ca Google: Xc nh 5 sn phm chnh ca anh l g, ri qung ht nhng th cn li i. Nhng th ch c km hm anh li thi. Chng ta khng thc s bit c phi Larry Page nghe li Jobs hay khng, nhng danh sch nhng sn phm, dch v m Google khai t di thi Larry Page cng kh di: Bookmarks Lists, Friend Connect, Google Gears,Cc hng in thoi ua nhau tm kim nhng thit k n gin nht c th, nhiu ng thng, mt phng, t nt. C my tnh, phn mm, hay giao din website (hnh 3, 4, 5), tt c u ngy mt n gin hn.u im ca n gin n gin th d dng. Sn phm cng n gin cng d dng. Ch tr mt s ngi chuyn su hay my7 8. Trang ch Yahoo phc tp pha sau.Google Search Timeline, Google Wave, Knol, CalDAV API, Google Building Maker, Google Cloud Connect, v.v.. Thay vo , Google Search, sn phm ch lc ca Google, mi ngy li mt thm ci tin, tin li hn cho ngi dng v doanh thu ca Google tng u trong my nm qua.Chng ta th nhn vo logo ca Apple, mt qu to cn d trng rt va mt c to nn bi vi ng trn n gin, th nhng n sau vi ci ng trn n gin y l c mt cng trnh phc tp, tnh ton k cng p dng t l vng, t l hi ha nht trong t nhin, nh hnh di.Du n ca n gin in m nt trong tt c cc sn phm c sc nhiu lnh vc khc nhau trong cuc sng, khng ch ring cng ngh. Nhng chic siu xe khng bao gi nhiu mu, thm ch a s ch mt mu rt c bn l en hoc trng. Nhng b trang phc sang trng khng bao gi tua rua. Nhng vn bn chuyn nghip khng c qu hai phng ch.Vy n gin y phi hiu l n gin pha ngi dng, khng phi n gin cho ngi lm sn phm. Thc t, cng n gin cho ngi dng bao nhiu, cng phc tp cho ngi pht trin by nhiu. Hi ti cn hc trong trng i hc, lm bi tp lp trnh, chng trnh chy ra c kt qu th nhanh, nhng lp trnh cho thy gio kim tra bi mt cch thun tin nht, t thao tc nht, trnh by ra mn hnh mt cch p nht c th th tn rt nhiu thi gian v cng sc. T l cng sc i khi n mc 20-80, vi ch 20% dnh cho vic chng trnh chy ra kt qu.Vy ti sao ngi ta khng lm mi th u n gin? Bi v lm n gin rt kh.S phc tp ca n gin Jonathan Ive, thit k trng Apple, tc gi nhng chic my Mac n gin m snh iu, ni: lm ra mt th n gin, ngi ta phi lm rt nhiu iuThit k Logo ca Apple8 9. Giao din Microsoft Office Ti gin giao din. B tt c nhng chi tit rm r. Giu i nhng thanh cng c, nhng phm bm t khi dng. Ti a ha khng gian lm vic cho ngi s dng. Lm nh Google khi thit k Chrome: Chng ti mun dnh cho ngi dng khng gian lt web rng nht c th. Chrome b ht cc trnh n truyn thng, gp thanh tm kim v a ch vo thnh mt, tn dng vin ca s (window border) t cc tab, thanh trng thi ch hin ln khi cn. Hy nhn s thay i giao din ca Firefox, i th sng s trong trn chin trnh duyt, trang trc thy s thnh cng ca giao din ti gin nh th no.Vic n gin ha sn phm l mt vic rt kh m nhiu khi nhng hng khng l cng khng lm ni. Hy th xem mt ngi dng bnh thng mun xem thng s DNS trong Windows 7 bng giao din ha mt bao lu: 10 ci nhp chut. Trong khi Mac OS ch mt 4, cha n mt na. l l do ti sao ngi ta c cu mt khi dng Mac s khng bao gi mun quay li Windows.Lm th no n gin iu u tin hy mnh dn gt b bt chc nng nh lm trong sn phm. Ch li mt s t nhng chc nng ti cn thit cho ngi dng. Thng k cho thy trong mt h thng thng thng c n 45% s lng chc nng khng bao gi dng n, 35% t khi dng, ch c 20% l thng s dng. Vy ng lo vic lc bt chc nng s lm phn mm ca bn khng p ng c yu cu ngi s dng. Thc t, nhiu chc nng ch lm i chi ph v thm bi ri cho pha khch hng m thi.Thay i t duy. Ch trng vo cht hn lng ca sn phm. Mt trong nhng t duy tiu biu theo hng ny l ng li ca nhng nh pht trin h iu hnh Unix: Lm ng mt vic, v lm tht tt vic (Do one thing and do it well). H khng khuyn khch ngi lp trnh lm ra nhng phn mm nhiu chc nng, nhiu hiu ng. H yu cu mi phn mm ch cn lm ng mt vic v gii quyt rt ro tt c vn xung quanh n. Copy ch lm ng vic copy, khng thm cut hay chc nng khc. Kt qu l cc h iu hnh h nix c mt h thng phn mm c bn hot ng rt n nh v v cng mnh m.Hnh pha trn vn thng c em ra ch trch vic Microsoft m m qu nhiu chc nng vo trong Office khin ngi s dng phi tr thm tin cho nhng chc nng m h hu nh khng bao gi ng n. Hy iu tra th trng tht k. Sp xp th t u tin cc chc nng. Dng cm loi b nhng chc nng khng bao gi hoc thm ch t khi dng. Ngy trc, khi Apple b a mm ra khi my Mac, h cng b ph phn rt nhiu. Nhng ch t lu sau, mm bin mt sch khi cc PC mi xut xng ca nhng hng sn xut my tnh ln cn li. Thi gian s cho cu tr li. kt thc, xin li trch li qui kit n gin Jonathan Ive: Lm ra nhng sn phm n gin, n gin n mc ngi s dng khng h nhn thy sn phm gii quyt c nhng cng vic phc tp n th no.9 10. Tom v Mary Poppendieck7 Nguyn l ca Pht trin Phn mm Tinh gn Dng Trng TnNh l mt trong cc phng php thuc h Pht trin Phn mm Linh hot (Agile Software Development), Pht trin Phn Mm Tinh gn (Lean Software Development, hay gi tt l Lean Development) l mt phin bn ca phng php Sn xut Tinh gn (Lean Manufacturing) p dng cho lnh vc pht trin phn mm. Thut ng Lean Software Development xut x t cun sch cng tn ca Mary Poppendieck v Tom Poppendieck. Cun sch din dch li t duy Tinh gn vi ngha mi km theo cc cng c hu hiu trin khai thc tin. Trong By nguyn l din gii T duy Tinh gn trong vic pht trin phn mm l linh hn cho qu trnh pht tin phn mm tinh gn. Chng c m t ngn gn nh di y:1. Loi b lng ph Tt c mi th khng tng thm gi tr cho khch hng c coi l lng ph (Muda). Chng bao gm: M ngun v chc nng khng cn thit S chm tr trong qu trnh pht trin phn mm Yu cu khng r rng Kim th khng , lp li qu trnh c th trnh c Quan liu Giao tip ni b chm chp c th loi b lng ph, ngi ta phi nhn ra n. Nu mt s hot ng c th c b qua, hoc kt qu c th t c m khng cn c n, chnh l lng ph. V d v lng ph trong pht trin phn mm c th k n: lm ra cc on m cha hon thnh ri b i trong qu trnh pht trin; cc quy trnh ph v cc tnh nng khng thng xuyn c s dng bi khch hng; ch i cc hot ng khc, cc i khc, quy trnh khc; sn phm c li v cht lng thp; cc cng vic qun l khng to ra gi tr thc s. Pht trin Tinh gn tp trung loi b cc lng ph t trng thi Tinh gn, to iu kin t hiu qu ti a. phn bit v nhn ra lng ph, k thut nh x dng gi tr c s dng. Trong , mt dng gi tr bt u khi mt n v kinh doanh quyt nh rng thng tin tt hn s gip tng doanh thu hoc gim chi ph. y l s bt u ca dng gi tr. Cc dng gi tr kt thc khi phn mm c trin khai bt u to thm doanh thu hoc gim chi ph. Tn kho (inventory) trong dng gi tr pht trin phn mm l mt phn cng vic c thc hin nh: yu cu khng c phn tch v thit k, bn thit k khng c m ha, m ngun khng c kim10 11. th v tch hp, cc tnh nng khng c trin khai, cc tnh nng trin khai nhng khng tit kim tin hoc gim chi ph. Khi dng gi tr phn mm c t cng vic kiu nh th, ri ro s c gim v nng sut c ci thin rt nhiu. Bc tip theo l ch ra ngun lng ph v loi b n. Vic ny cng nn c thc hin lp i lp li loi b ht cc quy trnh v th tc khng cn thit.2. Khuch trng vic hc Pht trin phn mm l mt qu trnh hc tp lin tc to ra tri thc mi. Phng php tt nht ci thin mt mi trng pht trin phn mm l khuch trng vic hc tp. Qu trnh hc tp c y nhanh tin bng cch s dng cc chu k lp i lp li ngn cng vi k thut ti cu trc (refactoring) v kim th tch hp. Tng cng thng tin phn hi thng qua cc bui hp ngn vi khch hng xc nh tnh hnh hin ti v phc tho nhng n lc pht trin v iu chnh nhm ci thin trong tng lai. Trong nhng phin lm vic ny, c hai i din khch hng v i ng pht trin tm hiu thm v vn v tm ra cc gii php i tip. V vy, khch hng hiu r hn v nhu cu ca h, da trn kt qu hin c ca cc n lc pht trin, cn cc nh pht trin th c th tm hiu lm th no p ng tt hn nhng nhu cu . Thay v b sung thm ti liu hoc k hoch chi tit, cc tng khc nhau c th c th nghim bng cch vit m v to ra cc bn build. Qu trnh thu thp yu cu ngi dng c th c n gin ha bng vic lm cc bn mu: trnh din cc giao din trn mn hnh (screen) cho ngi dng cui v thu thp d liu t h. Mt tng quan trng khc trong qu trnh giao tip v hc tp vi khch hng l pht trin da-theo-l (set-based development) k thut ny gip tp trung vo trao i v cc rng buc ca cc gii php trong tng lai, nhng tng no khng thc s l gii php; t thc y vic a ra gii php thng qua i thoi vi khch hng.cng phc tp, th cng cha nhiu kh nng thay i, do cn thit phi to ra cc tr cho cc quyt nh quan trng....</p>