Showing posts with label design. Show all posts
Showing posts with label design. Show all posts

Monday, December 29, 2008

GoF Design Patterns [5]

Adapter


Decorator


Visitor




(will be updated on demand)

Sunday, December 28, 2008

PureMVC framework notes

PureMVC is a lightweight framework for creating applications based upon the classic Model, View and Controller concept; based upon proven design patterns



This free, open source framework which was originally implemented in the ActionScript 3 language for use with Adobe Flex, Flash and AIR, has now been ported to nearly all major development platforms. It seems PureMVC is more popular in other languages (Java, C#, Ruby, ... ) than its competitor (Cairgorm) .





(to be updated)

Wednesday, December 24, 2008

GoF Design Patterns [4]

Abstract Factory

Proxy

Mediator





(will be updated on demand)

Saturday, December 20, 2008

GoF Design Patterns [3]

Tiếp tục với những design patterns dễ gặp:


Factory Method (creational)

Facade (structural)

Observer (behavioural)





(will be updated on demand)

Wednesday, December 17, 2008

GoF Design Patterns [2]

Hãy bắt đầu bằng những Design Pattern đơn giản và dễ gặp nhất :-) .




Singleton (creational)

Bridge (structural)

Command (behavioural)



(will be updated on demand)

Sunday, December 14, 2008

GoF Design Patterns

Có lẽ không cần giới thiệu nhiều về Design Patterns (Mẫu Thiết kế), cũng như quyển sách kinh điển của Gang of Four (Bộ Tứ - a.k.a Bè lũ 4 tên) vì bây giờ đã quá nổi tiếng rồi.

Việc nắm được các Design Patterns ngoài việc cải thiện tư duy hướng đối tượng, nó giúp dự án nhanh chóng có được thiết kế tốt, vì thế reduce cost & development interval, đồng thời improve productivity & customer satisfaction. Đối với bản thân developer thì ít ra cũng hấp dẫn ở chỗ là có thể làm thay đổi đáng kể mức lương :D .
Do đó bạn nào muốn tìm hiểu kỹ hơn thì nên nghiền ngẫm sách và code nhiều vào, chứ các bài blog như bài này chỉ nêu như cưỡi ngựa xem hoa thôi :D


Trong sách DP của GoF, 23 mẫu được phân thành 3 categories là: Creational (khởi tạo) - 5 mẫu , Structural (cấu trúc) - 7 mẫu, và Behavioural (hành vi) - 11 mẫu còn lại .

Tuy nhiên theo tớ thì không nên tiếp cận các DP the thứ tự tên ABC, hoặc theo từng category như trên, mà nên tiếp cận theo 1 trong 2 hướng: hoặc là dễ hiểu nhất, hoặc là dễ gặp nhất.
Ngoài ra không nên chạy theo các "xxx Design Patterns" khác (VD: Enterprise), vì đa số các pattern dạng này thuộc loại bùng nổ, hầu như cái gì cũng quơ vào làm pattern, hiệu quả thực tế chẳng bao nhiêu mà còn dễ dẫn đến "tẩu hỏa nhập ma" :D .


=== Creational DP ===


C. Singleton

Ensure a class only has one instance, and provide a global point of access to it.



C. Factory Method

Define an interface for creating an object, but let the subclasses decide which class to instantiate. Factory Method lets a class defer instantiation to subclasses.



C. Abstract Factory

Provide an interface for creating families of related or dependent objects without specifying their concrete classes.



C. Prototype

Specify the kinds of objects to create using a prototypical instance, and create new objects by copying this prototype.



C. Builder

Separate the construction of a complex object from its representation so that the same construction processes can create different representations.



=== Structural DP ===


S. Bridge

Decouple an abstraction from its implementation so that the two can vary independently.



S. Facade

Provide a unified interface to a set of interfaces in a system. Façade defines a higher-level interface that makes the subsystem easier to use.



S. Adapter

Convert the interface of a class into another interface clients expect. Adapter lets classes work together that couldn’t otherwise because of incompatibility interfaces.



S. Decorator:

Attach additional responsibilities to an object dynamically. Decorators provide a flexible alternative to subclassing for extending functionality.



S. Proxy

Provide a surrogate or placeholder for another object to control access to it.



S. Composite

Compose objects into tree structures to represent part-whole hierarchies. Composite lets clients treat individual objects and compositions of objects uniformly.



S. Flyweight

Use sharing to support large numbers of fine-grained objects efficiently. A flyweight is a shared object that can be used in multiple contexts simultaneously. The flyweight acts as an independent object in each context; it’s indistinguishable from an instance of the object that’s not shared.



=== Behavioural DP ===


B. Strategy:

Defines a family of algorithms, encapsulates each one, and make them interchangeable. Strategy lets the algorithm vary independently from clients who use it.



B. Chain of Responsibility

Avoid coupling the sender of a request to its receiver by giving more then one object a chance to handle the request. Chain the receiving objects and pass the request along the chain until an object handles it.



B. Template Method

Define a skeleton of an algorithm in an operation, deferring some steps to subclasses. Template Method lets subclasses redefine certain steps of an algorithm without changing the algorithms structure.



B. Iterator

Provide a way to access the elements of an aggregate object sequentially without exposing its underlying representation.



B. Command

Encapsulate a request as an object, thereby letting you parameterize clients with different requests, queue or log requests, and support undoable operations.



S. Observer

Define a one-to-many dependency between objects so that when one object changes state, all its dependents are notified and updated automatically.



B. Mediator

Define an object that encapsulates how a set of objects interact. Mediator promotes loose coupling by keeping objects from referring to each other explicitly, and lets you vary their interaction independently.



B. State

Allow an object to alter its behavior when its internal state changes. The object will appear to change its class.



B. Interpreter

Given a language, define a representation for its grammar along with an interpreter that uses the representation to interpret sentences in the language.



B. Memento

Without violating encapsulation, capture and externalize an object’s internal state so that the object can be restored to this state later.



B. Visitor

Represent an operation to be performed on the elements of an object structure. Visitor lets you define a new operation without changing the classes of the elements on which it operates.



( từ từ tớ sẽ giới thiệu cụ thể từng cái pattern sau... nếu có thời gian :D )

Sunday, November 23, 2008

Object-oriented programming principles

Sau khi đã biết được các nguyên lý cơ bản để phát triển phần mềm, một lập trình viên nên biết qua về các nguyên lý lập trình hướng đối tượng.

Một số bạn thì gọi cái này là các nguyên tắc thiết kế hướng đối tượng (OOD principles) . Theo tôi thì gọi như vậy là không chính xác. Các nguyên tắc OO này áp dụng cho lập trình (programming), từ thiết kế (design) đến viết mã (coding) đến kiểm thử (testing) , đều cần biết các nguyên tắc này và nên áp dụng ở từng giai đoạn luôn chứ không chỉ ở giai đoạn design.

Nói một cách ví von, so với cờ thì: các nguyên lý KISS, DRY, YAGNI,... là các thế tàn cuộc cơ bản, các nguyên lý OOP là các cách chơi trung cuộc, còn như Design Patterns thì là các kiểu khai cuộc . Mặc dù ngày nay Design Patterns được nhắc đến nhiều nhưng thực sự thì để nâng cao nội lực thì nên nắm vững OOP principles , còn DP thì ban đầu chỉ cần biết một ít đủ để áp dụng OOP là được.


Trong vài bài post sau này chúng ta sẽ thảo luận về Design Patterns , còn bây giờ tôi sẽ nêu 4 nguyên lý OOP cơ bản :

1/ Nguyên lý đóng mở - OCP : (open close principle)
Open for extension, but closed for modification.

Tạm dịch: Dễ mở rộng các hành vi, mà không cần phải sửa lại (class/interface/method)


2/ Nguyên lý thay thế Liskov - LSP : (Liskov substitute principle)
Derived classes must be substitutable for their base classes.

Tạm dịch: Các lớp dẫn xuất phải có khả năng thay thế hẳn lớp cơ sở


3/ Nguyên lý nghịch đảo phụ thuộc - DIP : (dependency inversion principle)
Depend on abstractions, not on concretions.

Tạm dịch: Nên phụ thuộc ở mức trừu tượng, tránh phụ thuộc cụ thể


4/ Nguyên lý phân tách giao diện - ISP : (interface segregation principle)
Make fine grained interfaces that are client specific.

Tạm dịch: Tạo các interfaces đã lọc kỹ và hướng tới người dùng


4 revisited/ Nguyên lý trách nhiệm đơn định - SRP: (single responsibility principle)
(Cái này là 1 góc nhìn khác của ISP, nếu bạn thích gọi là nguyên lý 5 thì cũng không sai mấy)
A class should have one, and only one, reason to change.

Tạm dịch: Khi thay đổi, mỗi lớp chỉ nên có 1 và chỉ 1 lý do



Ngoài ra còn các nguyên lý về phân gói (package), chia làm 2 nhóm:
+ tăng độ kết dính (increase cohesion) : REP, CCP, CRP
+ giảm độ ghép cặp (decrease coupling) : ADP, SDP, SAP

Tuy nhiên nên nắm vững 4 nguyên lý cơ bản ở trên trước khi tìm hiểu các nguyên lý về package & granuality .

Saturday, November 08, 2008

PHP performance tips

Đã kiểm tra trên PHP5, còn PHP4 thì chưa, nhưng chắc cũng vậy.

1/ foreach nhanh hơn for, for nhanh hơn while

2/ echo nhanh hơn print

3/ include nhanh hơn include_once

4/ single quote string (') nhanh hơn double quote (")

5/ phương thức static nhanh hơn non-static



Nguyên do :

Các kết quả trên khá hợp lý nếu bạn nghĩ kỹ 1 chút về cú pháp PHP và ý nghĩa của các phần trên trong đó :-)

Tuesday, November 04, 2008

Java Coding Convention

=== WHAT ===

Coding convention (quy ước viết mã) : set of conventions (recommendations) for naming, formatting, and documentation requirements.

Coding standard of XYZ (chuẩn viết mã của XYZ) : set of standards (rules) of XYZ for naming, formatting, and documentation requirements.

Coding style (phong cách viết mã): the way somebody writes code and layouts. To get more effective and productive when programming, we should have common coding style and good practices; therefore we should follow practical coding conventions or coding standards.




=== WHY ===

The first and most important reason is Readablity (and reusability, of course) : easier for developers to read and understand each other's code . As a result:


+ Quicker adapt to source code of new project, regardless of debugging/testing/coding


+ Quicker transfer knowledge across projects, very useful for newcomers


And also the conventions can reduce name confliction, make better proliferation (e.g. pointTotal, totalPoints), emphasize relationship among related items (e.g. Customer { customerName, customerAddress, ... } ) , and compensate for language's weakness‏es .




=== WHEN ===

+ Multiple developers are working on a project.

+ Your program is so large that you can't hold the whole thing in your brain at once and must think about it in pieces.

+ The program will be long-lived enough that you might put it aside for a few weeks or months before working on it again.

+ Plan to turn a program over to another programmer for modifications and maintenance (which is nearly always).

+ Your programs are reviewed by other programmers in your organization.




=== HOW ===

Here are some recommended coding conventions for Java, yet it can be applied for other popular programming languages (PHP, ActionScript, Ruby, ...) , with a slight modification.


+ File name: should be alphanumeric (to be exact: [A-Za-z][A-Za-z0-9] ) and underscore ( _ ) , hyphen ( - ) , dot ( . ) only . Fortunately the Java compiler requires ".java" as an extension , and it will produce ".class" byte code file, so we can prevent some sudden inspiration with file names :D .


+ File organization: In a file, we should use blank lines to separate sections, make it clean and clear. Usually 1 or 2 blank lines is sufficient, depends on how "big" that section is. In some extreme case we can use 3 blank lines to separate. Note that in modern languages such as Java we can alway separate a big program into at least several classes (and corresponding files) , so a file with more than 2000 lines is cumbersome and should be divided (to conquer) !


+ File sections: should be the following order: header comments, package declaration, import declaration, main class/interface, internal classes (if exists). Example:

/*
* @(#)MyClass.java 1.54, 2008 Jan 01
*
* Copyleft 2008 Mediocre-Ninja. Use is subject to license terms.
*/
package org.opensource;

import java.io.Serializable;

/**
* This is the dummy class for demonstration.
*
* @author Mediocre-Ninja
* @author unascribed
* @since 2008 Jan
*/
public class MyClass {
//...
}

class MyInternalClass {
//...
}



+ Class (or interface) declaration: should be the following order

- Class or interface statement

- Class or interface implementation comment, if necessary

- Class (static) fields: public, protected, private

- Instance fields: public, protected, private

- Constructors.

- Method: grouped by functionality rather than by scope


+ Indentation, line length and breaks: as following

- A tab width is considered "indentation unit", but replace the tab character by 2-4 spaces. [CONTROVERSIAL] The concrete number of spaces depends on the project. Usually 4 spaces for Java/JavaScript, 3 spaces for ActionScript/MXML/XML, 2 spaces for Python/Ruby/Perl/C...

- Try to avoid lines longer than 80 characters, since they’re not handled well by many terminals and tools.

- Principles when breaking lines: break AFTER A COMMA, break BEFORE AN OPERATOR, align the broken line as the same indentation (if it leads to confusing code then use 1 more "indentation unit", i.e. total 2 "units")

- Example:

longNameResult = longName2 * (longName3 + longName4 - longName5)
+ 4 * longname6;

var = someMethod1(longExpressionHere,
someMethod2(longExpressionAgain,
longExpressionYetAnother));

if ( (condition1 && condition2) || (condition3 && condition4)
|| !(condition5 && condition6) ) {
doSomethingAboutIt();
}

private static synchronized horkingLongMethodName(int anArg,
Object anotherArg, String yetAnotherArg,
Object andStillAnother) {
//...
}

alphaResult = (aLongBooleanExpressionForTernaryOne)
? betaValueHere
: gammaExpressionHere;



+ Comments: in Java can be classified as 2 kinds: Documentation (javadoc) comments, and implementation comments (both block comment (C-style) and line comment (C++ style) ).

- trailing comments should be seperate (i.e. at least 1 space) from the semi-colon or left-most character

- non-trailing comments should be preceded by a blank line

- summary points should be in uppercase. Example: // TO DO: , // FIX ME:


+ Naming convention:

- packages: use lowercase, group by function rather than scope

- classes: should be nouns, in mixed case with the first letter of each internal word capitalized. Also known as "PascalCase" or "UpperCamelCase"

- interfaces: like classes

- constants: should be all uppercase with words separated by underscores ("_").

- methods: should describe actions or states, in mixed case with the first letter lowercase, with the first letter of each internal word capitalized. Also known as "camelCase" or "lowerCamelCase" . [CONTROLVERSIAL] Use strict camelCase (either UpperCamel or lowerCamel) for abbreviations.

- variables: should be nouns, short yet meaningful, capitalized as "camelCase" . Should not start with '$' dollar-sign. [CONTROVERSIAL] To distinguish fields and other variables, use 1 underscore '_' as prefix for field names. [CONTROVERSIAL] To distinguish method parameters and other variables, use 1 underscore '_' as postfix for method parameters. [CONTROVERSIAL] Should not use "Hungarian" notation, use "postfix Object" instead. Example:

//import done
public class MyObject {

private String _objectName;

public String setObjectName(String objectName_) {
this._objectName = objectName_ ;
}

protected String downloadXmlThroughHttp(String xmlFileName_, URL httpUrl) {
//...
}

public static void main(String[] args_) {

public String objectName ; // don't use "strObjectName"
public String myMessage = args_[0]; // don't use "strMsg"

JTextArea commentTextArea; // don't use "txtComment"
protected JButton cancelButton; // don't use "btnCancel"
protected JButton saveButton; // don't use "btnSave"

private DataInputStream myDataIS; // don't use "dis"
private BufferedOutputStream myBufferedOS; // don't use "bufferedOutputStream"

//...
}
}



+ Miscellaneous recommendations:

- [CONTROVERSIAL] Open brace '{' appears at the end of the same line as the declaration statement. Also known as "one true brace" .

- Each line should contain one statement, at most.

- Use braces for single-statement block (if, else, do, while, for, try, catch,... )

- Always have 1 space (at least) to seperate operator, casting, parameters from others.

- No space between a method name and the parenthesis '(' which starts the parameter list

- Try to initialize local variables where they’re declared




=== Reference ===

+ Ontko's Java coding standard collections (including Sun's, Dough Lea's, ...)

+ Agile Java Development book, Appendix B

+ Java Power Tools book, part 6

Tuesday, October 28, 2008

Java Tiger and Mustang [2]

Trong bài trước tôi đã nêu những điểm mới trong JDK 5 (Tiger) , và bài này sẽ nêu những điểm mới của JDK 6 (tên mã Mustang) :


Các cải tiến chính của Mustang là nhắm vào GUI và lập trình Desktop.


java.lang.Console
Đọc và ghi dữ liệu ra màn hình console một cách thuận tiện.

System.console()
System.console().readLine()
System.console().readPasword()


java.util package
Phương thức copyOf của Array
Arrays.copyOf(int[] original,int iLength);
Arrays.copyOf(double[] original,int iLength);
…..

Calendar có thêm DisplayName
String getDisplayName(int field, int style, Locale locale)
Map getDisplayNames(int field, int style, Locale locale)

Empty String methods
boolean isEmpty()


java.awt package
Đối tượng Desktop : Lập trình viên có thể gọi trình chạy tương ứng để đọc hoặc chạy bất kỳ file nào.

Desktop d = Desktop.getDesktop();
boolean isSupported(int action);
void open(File file)


java.awt package
Đối tượng SystemTray và TrayIcon : Tạo icon cho chương trình chạy ngầm trên System Tray

SystemTray t = SystemTray.getSystemTray();
TrayIcon tc =
new TrayIcon(Image i, String strTittle, PopupMenu p);
tc. setImageAutoSize(boolean b)
t.add(tc);


javax.swing
Splash Screen : Tạo màn hình splash trong lúc đợi máy ảo Java nạp chương trình.

java -splash:mySplashScreen.jpg HelloSplash
SplashScreen s = SplashScreen.getSplashScreen();
g = (Graphics2D)splash.createGraphics();


javax.swing
SortedTable : Sắp xếp và lọc dữ liệu trên bảng

class RowSorter
class RowFilter

JTable
setRowSorter(RowSorter)
RowSorter
setRowFilter()


javax.swing
TextPrint : In dữ liệu từ text ra máy in, hỗ trợ paste.

JTextArea
paste()
print()

Tab Pane : Tab Component Pane
setTabComponentAt(int index, Component c)


java.io package
GifWriter : Hỗ trợ convert sang chuẩn ảnh gif
DiskSpace : Xem thông tin còn trống trên các ổ đĩa.


JDBC 4.0 : (12/2006)
Không cần chỉ rõ Driver lúc dịch.
Nâng cao có chế bắt lỗi :

SQLException implements Iterable.
Bắt nhiều lỗi trong một SQLException

Đối tượng RowId
RowId rowid = rs.getRowId(int index);

Cuối cùng là hỗ trợ thêm khả năng kéo thả của nhiều Component và JComponent



Have fun,

Thursday, October 23, 2008

Symfony quick note

Từ khi Ruby on Rails ra đời và thành công rực rỡ, cộng đồng PHP đã học hỏi Rails và bắt đầu tạo nên hàng loạt framework để phát triển web bằng PHP với nhiều điểm học lại từ Rails , trong đó các framework nổi tiếng nhất là Kohana (CodeIgniter), Symfony, Zend, CakePHP, Akelos, ...


(đang viết tiếp)

Saturday, October 11, 2008

Java Tiger and Mustang

Chà, đã mấy ngày rồi mà bài quiz Java về Object của Weiqi Gao mà mình đưa lên vẫn chưa có comment nào, chẳng lẽ bài tầm thường quá nên các Java gurus không thèm reply chăng T_T


Không sao , giờ thì mình revisit lại những điểm mới trong Java 5.0 (Tiger) và 6.0 (Mustang) cái đã. Hy vọng những cái này sẽ giúp cho các bạn mới làm quen với Java bằng sách tiếng Việt (vì các sách này chỉ dịch lúc còn Java 1.4, 1.3) .


Đầu tiên là Tiger. Không chỉ quyết định đổi tên phiên bản từ 1.5 thành 5.0 (thực chất chỉ là một nỗ lực marketing, như hồi đổi tên Solaris 2.7 thành 7.0) , Sun còn áp dụng 1 loạt thay đổi đáng kể đến ngôn ngữ Java và các lớp :


* Đổi tên :
J2SDK -> JDK (không còn tưởng niệm JavaSE 1.2)
J2SE -> Java SE , J2EE -> Java EE , J2ME -> Java ME
1.5 -> 5.0 (và open source gần hết mã nguồn Java)


* Annotations : (còn gọi là Metadata)
Đây không phải là điều gây nhiều hứng thú trước khi nó ra đời, nhưng cuối cùng nó lại là điểm sáng nhất trong số các cải tiến ở Java 5.
Cho phép người phát triển tạo những ký hiệu đánh dấu (annotation) riêng, gần giống như các annotation của javadoc . Sun cũng cung cấp sẵn một số annotation: @Override, @Deprecated, @SuppressWarning, ...
Về mặt cú pháp, các annotation này có vai trò như 1 loại modifier (bổ từ: public, static, final, ... ) đặc biệt ; do đó nằm ở vị trí tương ứng như modifier.

VD:

public @interface RequestForEnhancement {
int id();
String synopsis();
String engineer() default "[unassigned]";
String date(); default "[unimplemented]";
}


public class Foo {
@Test public static void m1() { }
public static void m2() { }
@Test
public static void m3() {
throw new RuntimeException("Boom");
}
public static void m4() { }
@Test
public static void m5() { }
public static void m6() { }
@Test public static void m7() {
throw new RuntimeException("Crash");
}
public static void m8() { }
}



* Generics :
Đây là tính năng được mong đợi nhất, như Template trong C++, Generics trong C#, nhưng đáng tiếc nó đã được implement không tốt lắm, dẫn đến sai lầm cố hữu là sự phức tạp không cần thiết, điều mà cộng đồng Java đã phê phán Sun từ thời EJB.
Cú pháp cho phép kiểu của các phần tử mảng và collection được chỉ ra.
Mục đích phát hiện những lỗi sai về kiểu dữ liệu ngay tại thời điểm dịch (complilation time) thay vì lúc chạy chương trình (runtime).

Cú pháp : Collection<T>

Ví dụ :

List<String> list = new ArrayList<String>();



* Lặp For mới (ForEach)
Nâng cao việc sử dụng vòng for với mảng và collection

Cú pháp:
for (kiểu_dữ_liệu biến : mảng)

Ví dụ :

for (String myString : arrayOfStrings) { /* ... */ }



* Formatter và printf :
Định dạng printf hầu như giống C hoàn toàn (mở rộng hơn)

VD:

System.out.printf("%s %5d\n", user,total);



* enum
Rất giống enum trong C++ , có điều tên các phần tử không cần đặt thêm prefix (hay suffix) , bởi có thể gọi được như kiểu Static field.

Ví dụ :

enum Seasons { fall, winter, spring, summer } ;



* Hỗ trợ Unicode (UCS-2, UTF-16)
java.lang.String và java.lang.Character có phân biệt điểm mã (Code Point) cho các ký tự. UTF-16 theo chuẩn unicode.org
(tương lai có thể Java hỗ trợ cả UTF-8, UTF-32)


* JFrame.getContentPane().add()
Gọi add component trực tiếp từ JFrame không cần qua contentPane.


* import static
Cho phép sử dụng hằng số và phương thức tĩnh mà không cần chỉ ra tên lớp.
Giúp thuận tiện trong lập trình

Ví dụ :

import static java.lang.Math.*;



* Variable arguments (varargs)
Số lượng tham số của method có thể thay đổi,
Sử dụng cú pháp ba chấm ' . . . '

Ví dụ :

void argtest(Object ... args) {}



* AutoBoxing-Unboxing
Có thể sử dụng kiểu dữ liệu nguyên thủy gán trực tiếp cho wrapper class

Ví dụ :

Integer I = 5;




Còn các điểm mới của Java 6 (Mustang) xin được tách ra thành một entry khác , bởi bài này đã khá dài :-)

Tuesday, October 07, 2008

Windows post-installation notes

For some reason I had to reinstall Windows, and I'd like to keep a minimal backup with good software. It would be interesting to find out what applications you consider essential when doing a complete re-format. So I meditated and tried to pick the best ones. Here were my 'TO DO' list:

1/ Resize the C: partition to 4 GB (to be exact, 4000.5 MB )
2/ Install Windows XP Pro :-)
3/ Install NIC driver, and setup Internet connection
4/ Install AVG (AntiVir and Avast are good, either)
5/ Start scanning, and install other drivers (not reboot yet)
6/ Setup domain/workgroup, map network drives/printers
7/ Prepare folders ('D:\usr' instead of %ProgramFiles%, 'D:\home\ninja' instead of %UserProfile%, ... )
8/ Customize the Taskbar, Start Menu, Power settings.

9/ Install Firefox 2 (FF3 sucks) and some plugins (DownThemAll, ...)
10/ Install 7-zip (alternative: IZarc)
11/ Install Unikey (tool for typing Vietnamese)
12/ Install Adobe flash player
13/ Install VLC (MPlayer is another option)
14/ Install K-lite codecs
15/ Install Foxit Reader
16/ Install StarDict
17/ Install XnView (is Picasa better? )
18/ Install Comical
19/ Install Notepad++
20/ Install FreeCommander
21/ Reboot and make a mini backup

22/ Install ImgBurn (or CDBurnerXP)
23/ Install Audacity
24/ Install CamStudio
25/ Install JRE
26/ Install OpenOffice.org (next time maybe Lotus Symphony or KingSoft)
27/ Install OpenProj
28/ Install Free Download Manager
29/ Install ThunderBird
30/ Install Skype
31/ Install Pidgin
32/ Install KVIrc
33/ Install uTorrent (Vuze is a good alternative one)
34/ Install eMule
35/ Customize Desktop, reboot and make a lite backup

36/ Install Cygwin
37/ Install VIM (Vi IMproved)
38/ Install JDK
39/ Install XAMPP
40/ Install Eclipse (perhaps EasyEclipse? )
41/ Install TortoiseSVN (not Git yet)
42/ Install WinSCP and Putty
43/ Install HeidiSQL
44/ Install DBDesigner
45/ Install ArgoUML
46/ Install Dev-Cpp
47/ Install FreeMind
48/ Install VMWare
49/ Install SQLite
50/ Install PosgreSQL
51/ Install Eclipse plugins (CheckStyle, Subversive, Aptana, PHPeclipse, ...) , Mozilla plugins (for FireFox, ThunderBird)
52/ Reboot and make teh backup !

Yeahhh, it's time for games installation !
And maybe more (GIMP, Python, Ruby, Rails, Symfony, Django, ... ) ^_^


What are your essentials after a Windows re-format?

Sunday, October 05, 2008

Software development principles

A good software, in the developer POV, should satisfy below criteria:

* FUNCTIONAL (as specified, with reasonable resource) : of course, trivial assumption.

* REUSABLE : currently the most notable criteria, which is the father of OOP and RAD.

* EXTENSIBLE : the brother of "reusable", in other words, it's the good side of "flexible" (the bad side is "modifiable/shrinkable" which requires more efforts).

* RELIABLE : even when the software is run in non-specified conditions, it should not lead to system crash/hanging/exploitation, and should produce the most accurate result, while giving the user some warning/caution.


Hence, the pragmatic software development, after LOTS of failed projects, has proven some paradigms to achieve the above criteria in a predictable way. That's why we have now programming philosophies, conventions, OOP, OOAD, principles, and also a bunch of design patterns.


And here are my notes about some useful development principles:

* KISS: Keep It Simple, Stupid (làm đơn giản thôi, lũ ngốc)
This is not only useful in software development, but also in a wide array of disciplines, such as animation, journalism, photography, engineering, and strategic planning. As Einstein's maxim: "everything should be made as simple as possible, but no simpler." .
Surprisingly, there are numerous so-called developers who forget this principle in serious development.


* DRW: Don't Reinvent Wheels (đừng có phát minh lại cái bánh xe)
This is also a general principle for gaining solutions in shorter time. It is emphasized in software development in which the human cost, which is highest part of software TCO, is proportional to development time and maintenance efforts. If there is a good solution we can get, just take it instead of creating a new solution from scratch, that's the economical way.


* DRY: Don't Repeat Yourself (đừng lặp lại cái đã làm rồi)
This principle is about re-use, not about re-invent. Yet it is similar in the economical sense. When re-use some components, we should avoid duplicated information as much as possible, because duplication increases the difficulty of change, may decrease clarity, and leads to opportunities for inconsistency.


* YAGNI: You Ain't Gonna Need It (còn lâu mới cần đến chức năng đó)
After some experience in programming, a developer usually impose himself on foreseeing unspecified usage and preparing for changing requests. Some even go further by adding functionality (without any request), which usually turns out to break the rate of process. Therefore a developer, though is encouraged to think out of the box, should only implement things when he actually need them, never when he just foresee that he need them.



Well, let's call it a day.
Design principles and design patterns will be mentioned in next entries .

(^o^)

Planning 5 months

KẾ HOẠCH 5 THÁNG LẦN THỨ NHẤT :

* Objective: the title says it all

* Start date: 2008-10-05

* Due date: 2009-03-07 (duration: 5 months)

* Venue: working desk

* Agenda:

1/ Blog Mediocre-Ninja :

+ Mỗi tuần ít nhất 3 bài viết về kỹ thuật, công nghệ (computer-related) .

+ Các bài đó chủ yếu (hơn 50%) sẽ viết bằng tiếng Anh , trực tiếp soạn HTML .

+ Dùng một số thủ thuật để tăng page view và PageRank .


2/ Communication with hackers :

+ Tham gia IRC thường xuyên, học hỏi các cao thủ người Việt ở mỗi channel .

+ Tạo nick mới ở các diễn đàn, thêm nick những bạn cũ đã lâu không gặp .


3/ Project for fun :

+ Thứ nhất : ngốn 4500 trang sách tiếng Anh .

+ Thứ hai : làm 2 ứng dụng desktop , rồi port 1 cái sang mobile .

+ Thứ ba : làm 1 ứng dụng web, hoặc tham gia dự án collaboration .


4/ Miscellaneous :

+ tiếng Pháp, thời khóa biểu, chặn website .

+ xây dựng mô hình, quy trình công việc sử dụng triệt để OSS .


* Deadline: 2009-03-31

* Note: Các chi tiết Lưu lại dạng XML project để dễ mở bằng OpenProj, OpenWorkbench .

Saturday, October 04, 2008

Blogspot CSS customization

Some important meta-tags and CSS selectors in Blogspot template:


.
.
.
include data='blog' name='all-head-content'
. . .
#header-wrapper {
text-align: $startSide;
. . .
#main-wrapper {
margin-$startSide: 1%;
width: 64%;
. . .
#sidebar-wrapper {
margin-$endSide: 1%;
width: 29%;
. . .
.date-header {
font-size: 100%
font-weight:
font-family:
. . .
.post {
margin: 0 0 1.5em;
. . .
.post-title {
font-size: 125%;
line-height: 1.1em;
. . .
.post-title a, .post-title a:visited, .post-title strong {
color: $textColor;
. . .
.post div {
font-size:
margin: 0 0 .75em;
. . .
#comments-block dd p {
background-color:
padding:
.
.
.


Well, good enough ? Looks like I have a neat Web 2.0 blog now !

Tạm thời nhiêu đó đã, còn một số cách để tăng views và PageRank sẽ trình bày sau ^o^ .
.
.