Archive for September 2010

10 Successful e-Book Search Engines




Below are 10 successful (with large e-book databases, easy to use and minimal design) e-book search engines:

1. Mega PDF


5. PDF Geni 



7. PDF SE 




10. Flazx

Posted in | 7 Comments

OOP SOLID Rules : Interface Segregation Principle (ISP)




Introduction:
Object Oriented Programming (OOP) has 5 basic rules which shortly named as SOLID:
S : Single Responsibility Principle
O : Open Closed Principle
L : Liskov Substitution Principle
I : Interface Segregation Principle
D : Dependency Inversion Principle
Interface Segregation Principle is explained with examples (in Java language) in this article.

Explanation:
Some interfaces are created with huge amount of functionalities. But when those interfaces are implemented by client implementor classes, not required functionalities are forced to be implemented, and so the code will have many dummy or empty implementations.

This situation can be prevented by segregating (i.e seperating) big interfaces into smaller ones. Only strictly related method definitions must be in the same interface. Different types of functionalities must be placed in different interfaces.

Examples:
Below is a wrong design that's not using Interface Segregation Principle. Implementor classes have to implement unnecessary methods.

public interface Animal {
    void fly();
    void run();
    void bark();
}
public class Bird implements Animal {
    public void bark() { /* do nothing */ }
    public void run() {
        // write code about running of the bird
    }
    public void fly() {
        // write code about flying of the bird
    }
}
public class Cat implements Animal {
    public void fly() { throw new Exception("Undefined cat property"); }
    public void bark() { throw new Exception("Undefined cat property"); }
    public void run() {
        // write code about running of the cat
    }
}
public class Dog implements Animal {
    public void fly() { }
    public void bark() {  
        // write code about barking of the dog
    }
    public void run() {
        // write code about running of the dog
    }
}

And below is the implementation which uses ISP:

public interface Flyable {
    void fly();
}
public interface Runnable {
    void run();
}
public interface Barkable {
    void bark();
}
public class Bird implements Flyable, Runnable {
    public void run() {
        // write code about running of the bird
    }
    public void fly() {
        // write code about flying of the bird
    } 
}
public class Cat implements Runnable{
    public void run() {
        // write code about running of the cat
    }
}
public class Dog implements Runnable, Barkable {
    public void bark() {  
        // write code about barking of the dog
    }
    public void run() {
        // write code about running of the dog
    }
}

Interface Segregation Principle is one of the key points in OOP. By following this principle, growing interfaces will no longer be a problem.

Posted in | 6 Comments

Creating a Visual Studio Add-In in 1 Minute




This article introduces the basics of Visual Studio Add-In (aka "Plug-In" in Java terminology) creation.

Note: This information is valid for every version of Microsoft Visual Studio. Examples will be given over Visual Studio 2008 and .NET version 3.5.

First, choose File --> Create --> Project. After that choose "Extensibility Project" type and "Visual Studio Add-In".

Then, you can choose "Next" for every step of the Add-in wizard. And finally press "Finish" for the last step:

After that, the add-in project is created. Required DLLs and directory structures are ready. "Connect.cs" class is the most important part and starting point of the add-in. And ExampleAddIn.AddIn file is the add-in descriptor file, which has the basic information (eg. add-in DLL file location, about info...) of add-in.

"OnConnection" method is the starting point of add-in execution. _applicationObject and _addInInstance objects are taken at the start as default. These objects are used to have control over Visual Studio application actions. As an example, let's put an "hello world" dialog at the startup of add-in:


You can enable add-in (and also set the add-in to run on the startup and/or command line) using Tools --> Add-in Manager... menu and the following screen:


Once you press F5, you will see Visual Studio re-starting and the "hello world" dialog:

Specific add-in examples, details and configurations will be explained in future posts.

Posted in | 1 Comment

4 Rules of User Interface Design

1. Consistency
First of all, user interface design must be consistent. For example, all text alignment of labels must be the same for the whole application. If capital letters are used, all labels must be capitalised. Also, predefined company based user interface components (e.g. text fields with type conversion, table with add/remove buttons etc.) can be used for design consistency and functional equality.
The best way to provide consistency is using templates. If there are rules, whole software team will obey them. And those rules are preferred to be formed and used on the way, because if all user interfaces are completed there may not be enough time to change all screens.

Inconsistent and Consistent Labels of a Screen 
2. Usability
User interfaces are preferred to be used by a person who hasn't got any information about that screens. For achieving this, screen components must be placed correctly and information on the screens must be enough. Component sizes, selection types, obligations and placing priorities must serve the purpose.

3. Simplicity
Simple is always the best. Complex screens also violates the "usability" rule. User interfaces must contain as least element as they can. Unnecessary elements causes complexity. In addition, a function of user interface may be reached by only one way (menu item, button or keyboard shortcut) for decreasing complexity. But if the structure of  a complex application requires a function to be run by more than one ways (by menu item & shortcut keys & quick launch button on the screen) to guide user, this approach can be discarded.

4. Elegance
For the most end-users, managers and for customers, user interface equals the whole software. Those people are not related with sublevel implementation design, they only see the screens. So, elegant design is very important. 
This requires employers which have the viewpoint of art. Only by improving the screen designs, a software can seem to be renewed and upgraded.

A Windows 95 and Windows 7 File Dialog

Posted in | 2 Comments