Welcome! My name is ArmNo. I'm computer engineering student of Chiang Mai University, Thailand. This blog is about my internship program summer 2009. Enjoy!

Introduction to Tequila Framework

Tequila Framework เป็น PHP Framework แบบ MVC ที่พัฒนาโดยบลูบอล กรุ๊ป มีจุดเด่นคือสามารถพัฒนา application ได้อย่างรวดเร็ว มีโครงสร้างที่แข็งแกร่ง และง่ายต่อการ maintenance ซึ่งประกอบด้วย 2 ส่วนหลักคือ Tequila Core เป็นไฟล์หลักของ framework และอีกส่วนหนึ่งคือ Tequila Application ซึ่งก็คือ application ที่เราต้องการพัฒนาขึ้นมา โดยทั้งสองส่วนจะอยู่ขนานกัน (บน file server) และจะกำหนด path ของกันและกันได้ที่ configuration file ของ application

ข้อดีของ Tequila Framework

  • มี Page Generator ให้ โดยสามารถสร้างเพจที่เกี่ยวข้อง หรือไม่เกี่ยวข้องกับฐานข้อมูล หรือแม้กระทั่งหน้าเปล่าๆได้ ทำให้ช่วยประหยัดเวลาในการเขียนโค้ดไปได้มาก
  • มีฟังก์ชั่นและคลาสพร้อมให้เรียกใช้มากมาย ซึ่งส่วนมากเป็นฟังก์ชั่นและคลาสที่มักจะได้ใช้บ่อยๆในการเขียนโปรแกรม การเรียกใช้ฟังก์ชั่นจาก Framework ทำให้ลดจำนวนโค้ดจากหลายสิบบรรทัด เหลือเพียงหนึ่งหรือสองบรรทัดได้
  • เรียกข้อมูลมาแสดงผลได้อย่างง่ายดาย
  • สามารถเข้าถึงข้อมูลในฐานข้อมูลได้ ด้วยโค้ดเพียงหนึ่งบรรทัด
  • มี Packages ให้เรียกใช้สำหรับโค้ดส่วนที่ต้องใช้บ่อยๆ
  • สามารถนำโค้ดกลับมาใช้งานใหม่ได้เรื่อยๆ
  • ใช้กับฐานข้อมูลได้มากชนิด เช่น MySQL, MSSQL, Oracle, AdoDB, MS Access, SQLite เป็นต้น

ส่วนประกอบที่สำคัญของ Tequila Application

· Model เป็นส่วนที่ทำหน้าที่ติดต่อกับข้อมูล เป็นตัวเรียกข้อมูลที่จะไปแสดงผล ประกอบไปด้วยคำสั่งในการเรียกข้อมูลจากฐานข้อมูล (ซึ่ง Model สามารถเข้าถึงฐานข้อมูลได้โดยใช้ DAO หรือไม่ใช้ก็ได้) และ Business Rules

· View เป็นส่วนที่ทำหน้าที่แสดงผลข้อมูลออกไปยังหน้าจอผู้ใช้ และจัดการเกี่ยวกับ template โดยจะรับข้อมูลจาก controller หรือจะเรียกขอข้อมูลเองไปที่ Model เลยก็ได้

· Controller เป็นส่วนที่ทำหน้าติดต่อกับ user ผ่านทาง user interface จะเป็นตัวรับคำสั่งจาก user ว่าต้องการข้อมูลอะไร จากนั้น controller จึงเป็นตัวสั่ง model ให้ค้นหาข้อมูล แล้วสั่งให้ view แสดงผลข้อมูลนั้น

· DAO หรือ Data Access Object เป็น object ที่จะเข้าไปจัดการกับข้อมูลในฐานข้อมูล เป็นคลาสที่มีฟังก์ชั่นเกี่ยวกับการเข้าถึงข้อมูลไว้มากมาย ทำให้ไม่ต้องเขียนคำสั่งเอง โดยสามารถเลือกชนิดของข้อมูลที่จะ return ไปได้ ซึ่งปกติแล้ว DAO จะ return VO

· VO หรือ Value Object เป็น object ของข้อมูลที่ return มาจาก DAO

· Language files เป็น PHP file ที่เก็บ Strings ต่างๆที่ใช้ใน application

· Template files เป็นส่วนที่เก็บ html file, javascript file, และ css file ที่ใช้ใน template ซึ่ง Tequila Framework สนับสนุนการใช้ template engine ที่มีชื่อว่า template power

โครงสร้างไฟล์ของ Tequila Application

ดังที่ได้กล่าวไปข้างต้น Tequila Framework มีลักษณะโครงสร้างที่แข็งแกร่ง และง่ายต่อการบำรุงรักษาระบบ เนื่องจาก Tequila Application มีการเก็บไฟล์แยกเป็นส่วนๆอย่างชัดเจน ดังภาพ

(รูปจาก http://sites.google.com/site/phptequila)

การมีโครงสร้างที่ชัดเจนเช่นนี้ ทำให้สามารถบำรุงรักษาระบบได้อย่างรวดเร็ว เพราะใครก็ตามที่รู้โครงสร้างไฟล์ของ Tequila ก็จะสามารถเข้าไปแก้ปัญหาได้อย่างถูกจุดอย่างรวดเร็ว

หลังจากฝึกงานเสร็จ

หลังจากฝึกงานเสร็จ ฉันก็ไม่ได้โพสต์อีกเลย .. คิดว่าคงเป็นเพราะฉันต้องทำสิ่งอื่นมากกว่า เลยแทบจะลืมบล็อกนี้ไปแล้ว .. จริงๆแล้วเรื่องฝึกงาน ก็ไม่มีอะไรแล้วล่ะ ตอนนี้เหลือแค่รอส่งรายงานฝึกงาน (ที่ฉันทำใกล้จะเสร็จแล้ว) การฝึกงานครั้งนี้ก็จะเสร็จสมบูรณ์ .. แต่ยังไงฉันก็คิดว่าไม่ควรจะปล่อยบล็อกนี้ทิ้งไว้อย่างนี้หรอกนะ อย่างน้อยก็น่าจะมีสรุปอะไรไว้บ้างแหละ

ฉันเสร็จงานตาม requirement ใน phase ของฉัน หลังจากนั้นก็ส่งมอบโปรเจ็คต่อให้กับโปรแกรมเมอร์ที่บลูบอลเวียดนาม ซึ่งก็คือคุณ Han และคุณ Tien และมี tester ในทีมอีกหนึ่งคน คือคุณ Thanh .. ทุกคนล้วนเป็นมิตรดี สุภาพ และเป็นกันเอง ฉันชอบคุยกับพวกเขานะ พวกเขาไม่ถือตัวเลย (ฉันบอกตั้งแต่แรกว่าฉันเป็นนักศึกษาฝึกงาน) แต่ทุกคนก็ยังให้ความร่วมมือดี

ฉันรู้สึกว่าโปรแกรมเมอร์ที่เวียดนามเก่งกว่าฉันมาก พวกเขาโค้ดเร็ว และแม่น (ถึงแม้การสื่อสารกันจะลำบากหน่อย ภาษาอังกฤษแบบ snake snake fish fish กันทั้งฉันและพวกเขา, ติดต่อผ่าน Skype และ email)

ก่อนกลับก็ commit sourcecode ไปที่ SVN แล้ว กลับหอตั้งเกือบสามทุ่มแน่ะ .. วันสุดท้ายแล้วก็อยากอยู่ให้มันนานๆหน่อย ร่ำล่าพี่วรรณกับพี่เต้ แล้วก็กลับหออย่างสบายใจ

ฉันอยากจะบอกว่า ฉันไม่เสียใจเลยที่ได้ฝึกงานที่บลูบอล

:)

Daily Note 05.20.2009 [Last Day]

05.20.2009
    0915 – arrive @ office
    0933 – start notepad++
    0942 – publish yesterday’s blog post. => see what to do.
    0946 – Week View! => pending week
    1102 – start MySQL Query Browser
    1112 – start iTunes
         – what data to show in week pending??
    1221 – finish pending week without testing
    1347 – back from lunch. => day pending tasks??
    1351 – check weekday of received day. should be equal to zero.
    1412 – 1351 is fixed. => day pending tasks …
    1515 – finish day pending tasks. !!
    1519 – missed in my calendar
            -> show task or project as a period
            -> *:30 tasks
            -> before-and-after-month day blocks in month view
    1603 – reboot…
        Inspect elements
            Month View
                Normal Mode => data can go out of day block.
                Pending Mode => not show as period (show only at start date)
            Week View
                Normal Mode => not show as period
                Pending Mode => not show as period (show only at start datetime)
            Day View
                Normal Mode => like Week View
                Pending Mode => like Week View
    1737 – almost…
    1752 – preparing to commit to SVN.
    1927 – email sent.

email ประจำวัน #41

Dear all,
Here is my working status today:

  • make calendar’s week view shows finish tasks and pending tasks. 
  • make calendar’s day view shows finish tasks and pending tasks.
  • my latest source code is committed to SVN.

Best Regards,
Arm

Daily Note 05.19.2009

05.19.2009
    0910 – arrive @ office
    0919 – start notepad++
    0923 – Tien sending a file ..!
    0935 – see what to do. => compare files with server version
    1031 – upgrading my project.
    1056 – finish upgrading project. Going to test w/ latest Tequila.
    1108 – Tequila_Application can work with latest Tequila (Sunrise).
         – waiting for P Tae’s mail… back to do my calendar.
    1159 – problem is my project doesn’t respond. so, keep it out.
    1209 – back to SN capture again …
         – jang yod.
    1258 – added screens.
    1423 – just clear cache. :| => continue display data in month view
    1428 – month view can display data => pending tasks
    @TODO
        – complete my calendar view
            – show period of finish tasks
            – show *:30 tasks
            – show pending task
    1522 – we need some love ya’all. we need some real deal!
    1549 – should i make it ajax??   
    1557 – keep going!!!
    1603 – what am i doing? => make calendar shows pending task in month view.
           is it working already? => not yet. cannot change month.
           cause? => month and year missing for getting data.
           solution? => add month and year for getting data.
    1631 – ok. correct month
    1634 – month navi => ok. Next=> ‘finish task’ link
    1640 – can swap between finish and pending tasks mode
         – next => work with resource_id
    1656 – showMonth and showMonth_pending can check resource_id correctly
    1707 – SN capture again?? .. YES!!
    1727 – finish SN capture. => back to my calendar
        what > check JS file.
             > pending tasks should be display on start date ?
    1759 – make calendar (pending mode) show correct data
    1813 – ok. pending mode shows the day project starts

email ประจำวัน #40

Dear all,
Here is my working report status today:

  • make calendar view shows finish tasks and pending tasks.
  • update project (in local).

Best Regards,
Arm

Daily Note 05.18.2009

05.18.2009
    0910 – arrive @ office
    0925 – check email (13 new!) and start notepad++. see what to do on GG Calendar.
    @TODO
        – complete my calendar view
            – show period of finish tasks
            – show *:30 tasks
            – show pending task
        – contact Mr. Tien about version control solution.
    0931 – calendar bugs => month view going wrong.
    1007 – fixed 0931 by pass 1st of the month instead of current date. remaining things => show task as a period.
    1013 – start iTunes and sync with iPod.
    1046 – start ‘pending tasks’ view…
    1214 – no need to create functions out of DAO
         – new @TODO – try RAD sunrise tutorial
    1348 – back from lunch.
    1356 – test ‘Sunrise’ (Tequila’s Page Generator)
    1523 – finish testing RAD Sunrise. email has been sent to mritzco at gmail. Back to calendar view.
    1530 – make april time sheet.
    1552 – add new SN captures.
    1616 – wait for bug fixing … almost complete time sheets (exept time)
    1651 – task edge in again … :|
         – recheck RAD Sunrise
        Topics of Testing.
            1. add application tables to the DB. => OK.
            2. browse to addpage. => OK.
            3. check table relation. => OK.
            4. create recipes page => OK.
            5. create categories page => OK.
            5. review your hard work.
                -> check controllers
                    OK.
                -> browse to index.php?task=categories
                    OK.
                -> test category validation (cannot leave blank)
                    OK.
                -> Try adding "Soups" category using normal "Submit" button
                    OK.
                -> Try adding "Desserts" category using Ajax "Save and Continue"
                    OK.
                -> Exit and see the list of categories
                    OK.
                -> View and edit the information until you are satisfied
                    OK.
                -> Click on view recipes on the list mode
                    OK. (redirect to index.php?task=recipes)
                -> Click on Add a new recipe
                    OK. both using normal "Submit" button and Ajax "Save and Continue"
                -> Using RRTs
                    rrt=block .. ok
                    rrt=xml .. ok
                    rrt=json .. ok
                -> Regenerate pages
                    ok. it created a backup file when regenerate changed page.
            only 1 problem found is cannot "Submit" after "Save and Continue" in addNew mode.
            this is an isolated issue, right?
            if So, this tutorial is OK.
    1751 – finish test (again) for Sunrise.
    1756 – time sheet … tomorrow :|
    1803 – email sent.

email ประจำวัน #39

Dear all,
Here is my today’s working status.

  • make calendar view for showing pending tasks.
  • fix calendar’s month view bugs.

Best Regards,
Arm

Daily Note 05.15.2009

05.15.2009
    0910 – arrive @ office
    0952 – start notepad++, see what to do.
    0955 – > complete my calendar view.
    0956 – start iTunes
    0959 – 2 phases of Calendar View => Task have to do(task_ms) and task done(work_report)
         – I will start with ‘Task Done’
    1017 – start Dw CS4
    1025 – wrong calendar month view.
    1124 – data is in the right format. Next => correct the view.
    1140 – finish month view (without any style yet). Next => week view
    1341 – back from lunch. Continue week view. make data display in week view.
    1400 – zzz.
    1449 – still cannot display data in week view.
    1603 – condition at line 162 is incorrect.
    1758 – I have skipped some bugs :(
    1831 – email sent.

email ประจำวัน #38

สวัสดีครับ
รายงานประจำวันที่ 15/05/2009 – Working Report System (Tequila Framework)
สิ่งที่ทำวันนี้

  • ทำ calendar view ให้แสดงผลข้อมูลจาก table report detail ได้ ทั้ง month view, week view และ day view .. ซึ่งเป็นข้อมูลเดียวกับใน time sheet ครับ .. คุณ itzco อยากให้โชว์ได้ทั้ง task ที่ทำแล้ว และ task ที่ต้องทำครับ
  • issue นี้ คุณ itzco อยากให้ผมทำให้เสร็จ เพราะว่าผมทำไว้ตั้งแต่แรกแล้วยังไม่ได้ใช้ .. ผมจึงทำ issue นี้เอง ไม่ได้ assign ไปที่เวียตนามครับผม

ปัญหาที่พบ

  • week view กับ day view แสดงข้อมูลของ task ยังแยกกันอยู่ (ยังไม่เป็น period สำหรับ task เดียวกัน)

สิ่งที่ต้องทำ

  • calendar view ที่แสดงผลได้ทั้ง task ที่ทำแล้ว และ task ที่ต้องทำ

ขอบคุณครับ
อาม