มี ที่ นี่

พล ส้ม's Blog

Posts Tagged ‘framework’

เรื่อยๆไป

No Comments »

August 25th, 2009 Posted 10:19 am

ช่วงนี้ มีอะไรที่จะเขียนเยอะ แต่งานก็เยอะเช่นกัน ก็เลยเป็น blog นิ่ง lol

ตอนนี้ทำอะไรไม่กี่อย่าง เพราะอย่างหนึ่งเครียๆ งาน freelance ออกไปหลายงานแล้ว ก็รอเรียน ปีหน้าแล้วก็ต้องเก็บเงินก่อนก็เลยคิดจะทำระบบเล่นๆสักตัวอีกสัพักคงได้เห็นกัน

เขียนด้วย framework นะครับ

อีกอันที่ศึกษาๆ อยู่คือ mysql cluster อันนี้ต้องอ่านพอตัวอยู่ เพราะเรื่อง clustering นั้นนับว่ามีโปรๆ ในประเทศไทยไม่กี่คน แต่อย่างน้อยเราก็รู้จักคนนึงแหละเนอะ อิอิ

ok วันนี้คิดว่าเขียน diary เลยแล้วกัน แต่บ่ายๆ เบื่อๆ อาจจะมาเขียน เรื่อง symfony เพิ่มเข้าไปนะ

OR Mapping (แบบฉบับ wiki eng)

2 Comments »

August 18th, 2009 Posted 12:14 pm

ขอคัดลอกมา แปล แล้ว อธิบายย่อๆ นะครับ เพราะมันคือหลักการเฉยๆ เอาให้รู้ว่ามันคืออะไร จะได้ใช้ framework ได้ work จริงๆ ไม่อย่างนั้นคุณก็จะใช้ framework แบบ ไม่ work เลยซะทีเดียว

Object-relational mapping (ORM, ORM, and ORM) in computer software is a programming technique for converting data between incompatible type systems in relational databases and object-oriented programming languages. This creates, in effect, a “virtual object database” that can be used from within the programming language. There are both free and commercial packages available that perform object-relational mapping, although some programmers opt to create their own ORM tools.

ถ้าใครอ่าน Eng ก็ไม่ต้องอ่านข้างล่างนี้ ครับ

ความหมายของ OR Mapping หรือที่เรียกเต็มๆ ว่า Object-relational mapping โดยมันมีตัวย่อหลายแบบ เพราะคนที่ใช้มัน ขี้เกียจต่างๆ กันเลยเขียนได้หลายแบบ คือ ORM, O/RM หรือ ที่เราเขียนไปเป็นหัวข้อ OR Mapping

ตามที่ wiki บอกมันคือเทคนิคนะครับ(ไม่ใช้หลักการอะไรที่จะบังคับ) ในการ convert ข้อมูลระหว่าง ข้อมูลที่อยู่ใน relational database (ไอ้ที่เราเรียก Database จนติดปากในปัจจุบัน) กับ Object oriented programming language (ภาษาที่เราใชเงานเขียนโปรแกรม)

โดยเราจะคิดว่า object ที่เราใช้งานอยู่คือข้อมูลที่อยู่ใน database แล้วเรียกหรือใช้งานมันเลย โดยข้ามอะไร หรือ ข้อแม้อะไรต่างๆ ให้ object พวกนั้นทำงานไปหมดเลยไม่ต้องไปสนใจมัน ผ่าน OR Mapping Tools

แปลคร่าวๆ ไปแล้วมาดูจริงๆกัน เช่นเราทำ database 2 field คือ id และ name เราก็จะแนวคิดว่า object นั้นมี 2 attribute คือ id และ name

ข้อมูลหลายๆ record ก็คือ array ของ object

เป็นไงง่ายมะ หุหุ ฟังดูมันก็เหมือนกับจะง่ายแหละนะ ไม่ต้องคิดอะไรมาก เพราะเราเองไม่ได้เขียน OR Mapping Tools เอง ก็สบาย

ข้อมูลที่เขียน แปลมาจาก http://en.wikipedia.org/wiki/Object-relational_mapping ซึ่งถูกปัดฝุ่นแล้วชื่อได้ แต่คำพูดที่ผมแปล ยังไม่ได้ปัดฝุ่นนะ มันยังมัวอยู่อย่าเอาไปใช้ สุมสี่สุ่ม 5 เพราะรายละเอียดความจริงแล้วมันเยอะจนอ่านไปหลายวันได้เลยกว่าจะเข้าใจ แต่ OR Mapping ถูกใช้งานใน อุตสาหกรรม การผลิต software มาก ทำให้ถ้าเข้าใจแล้วจะทำอะไรต่อไปได้เยอะครับ

Tags: , ,
Posted in symfony

รู้จัก symfony framework เบื้องต้น

No Comments »

July 24th, 2009 Posted 2:27 pm

What is symfony?

บทนี้เราจะมารู้จักกับ symfony หรือ เรียกเต็มๆ ว่า symfony framework ซึ่งถ้าคนที่หาข้อมูลมาจะอยู่รู้แล้วว่าเป็น framework ที่ถูกเขียนขึ้นด้วย ภาษา PHP

ทีนี้เรามาดูความหมายจริงๆของ symfony กันเลย ทางทีมงานของ symfony ได้ให้ความหมายของ symfony ไว้ว่า

Symfony is a web application framework for PHP projects.

เป็นความมหายที่ตรงตัวสุดๆ คือ web application framework แต่หลายๆคนที่อ่านอยู่ไม่รู้แน่ๆว่ามันคืออะไร นิยามให้ง่ายๆ คือ library สำหรับสร้าง application นั้นเอง (คำพูดนี้คิดเอง อาจจะไม่ถูกซะทีเดียว หรือ ครอบคุมความมหายทั้งหมด ละไว้ในความเข้าใจของภาษาไทย)

สิ่งที่ symfony framework อยากจะทำออกมา คือทำให้เราเขียน application ได้ง่าย เร็ว ติดตั้งง่าย โดยได้ใจความพวกนี้มาจาก

The very small number of prerequisites make symfony easy to install on any configuration; you just need Unix or Windows with a web server and PHP installed. It is compatible with almost every database system. In addition, it has a very small overhead, so the benefits of the framework don’t come at the cost of an increase of hosting costs.

Using symfony is so natural and easy for people used to PHP and the design patterns of Internet applications that the learning curve is reduced to less than a day. The clean design and code readability will keep your delays short. Developers can apply agile development principles (such as DRY, KISS or the XP philosophy) and focus on applicative logic without losing time to write endless XML configuration files.

Symfony is aimed at building robust applications in an enterprise context. This means that you have full control over the configuration: from the directory structure to the foreign libraries, almost everything can be customized. To match your enterprise’s development guidelines, symfony is bundled with additional tools helping you to test, debug and document your project.

Last but not least, by choosing symfony you get the benefits of an active open-source community. It is entirely free and published under the MIT license.

จะเห็นว่าตัวหนาๆ คือสิ่งที่ symfony จะมีให้กับเราในการเขียน application หนึ่งตัวด้วย symfony framework

ในบทต่อๆไป เราจะรู้กันว่า ทำไมมันถึงง่าย ทำไมมันถึง easy to install ทำไมมันถึง small overhead และ clean design. การที่จะมีรูปแบบการเขียน code ที่ ดีและมีคุณภาพนั้น ส่วนใหญ่แล้วจะมาจากประสบการณ์ของ programmer ที่ดี มีความเป็นระเบียบเรียบร้อย ก็จะทำให้แก้ไข code ได้ง่าย. symfony จะช่วยเราได้อย่างไร?