Pages

Showing posts with label User Interface Design. Show all posts
Showing posts with label User Interface Design. Show all posts

Wednesday, February 6, 2013

10 Groups of Software Quality Factors That Should Always Be Remembered





Flexibility and Extensibility: 
Flexibility is the ability of software to add/modify/remove functionality without damaging current system. Extensibility is the ability of software to add functionality without damaging system, so it may be thought as a subset of flexibility. Those functionality changes may occur acoording to changing requirements, or an obligation if development process is one of the iterative methods. Change is inevitable in software development and so, this is one of the most important properties of quality software.

Maintainability and Readability:
Maintainability is a little similar with flexibility but it focuses on modifications about error corrections and minor function modifications, not major functional extensibilities. It can be supported with useful interface definitions, documentations and also self-documenting code and/or code documentation. The more correct and useful documentation exists, the more maintainability can be performed.

Performance and Efficiency:
Performance is mostly about response time of the software. This response time should be in acceptable intervals (e.g. max. a few seconds), and should not increase if transaction count increases. And also, resources are expensive. Efficiency must be supported with resource utilization. As an exaggerated example, ability of performing a simple function only by using a 32 processor machine or 1 TB disk space is not acceptable. Optimal source/performance ratio must be aimed. 

Scalability:
A scalable system responds user actions in an acceptable amount of time, even if load increases. Of course more hardware may be added for handling increasing user transaction, but the architecture should not change while doing this. This is called vertical scalability. Ability of running on multiple, increasing count of machines is multiple processing. If the software can perform that type of processing, this is called horizontal scalability. A preffered scalable system should suit both of these methods.

Availability, Robustness, Fault Tolerance and Reliability:
A robust software should not lose its availabilty even in most failure states. Even if some components are broken down, it may continue running. Besides, even if whole application crashes, it may recover itself using backup hardware and data with fault tolerance approaches. There should always be B and even C, D .. plans. Reliability also stands for the integrity and consistency of the software even under high load conditions. So it is relevant with availability and scalability. An unreliable system is also unscalable.

Usability and Accessability:
User interfaces are the only visible parts of software according to the viewpoint of user. So, simplicity, taking less time to complete a job, fast learnability etc. are very important in this case. The most well known principle for this property is KISS (Keep It Simple Stupid). Simple is always the best. A usable software should also support different accessibility types of control for people with disabilities.

Platform Compatibility and Portability:
A quality software should run on as much various platforms as it can. So, more people can make use of it. In different contexts we may mention different platforms, this may be OS platforms, browser types etc. And portability is about adapting software that can run on different platforms, for being more platform compatible. In this sense, portability is also related with flexibility.

Testability and Managability:
Quality software requires quality testing. Source code should be tested with the most coverage and with the most efficient testing methods. This can be performed by using encapsulation, interfaces, patterns, low coupling etc. techniques correctly. Besides testability, a qualified software should be manageable after deployment. It may be monitored for e.g. performance or data usage status, or may enable developer to configure system easily. Creating a successful logging system is another very important issue about managability.

Security:
Security is a very important issue on software development, especially for web or mobile based ones which may have millions of users with the ability of remote accessing to system. You should construct a security policy and apply it correctly by leaving no entry points. This may include authorization and authentication techniques, network attack protections, data encryption and so on. all possible types of security leaks should be considered, otherwise one day only one attack may crash your whole applicaion and whole company.

Functionality and Correctness:
Functionality (or correctness) is the conformity of the software with actual requirements and specifications. In fact this is the precendition attribute of an application, and maybe not a quality factor but we wanted to point that as the last quality factor, for taking attention: Quality factors are not meaningful when we are talking about unfunctional software. First, perform desired functionality and produce correct software, then apply quality factors on it. If you can perform both paralelly, it is the best.

Monday, June 25, 2012

20 Subjects Every Software Engineer Should Know





Here are the most important subjects for software engineering, with brief explanations:

1.Object oriented analysis & design: For better maintainability, reusability and faster development,  the most well accepted approach, shortly OOAD and its SOLID principals are very important for software engineering.

2.Software quality factors: Software engineering depends on some very important quality factors. Understanding and applying them is crucial.

3.Data structures & algorithms: Basic data structures like array, list, stack, tree, map, set etc. and useful algorithms are vital for software development. Their logical structure should be known.

4. Big-O notation: Big-O notation indicates the performance of an algorithm/code section. Understanding it is very important for comparing performances. 

5.UML notation: UML is the universal and complete language for software design & analysis. If there is lack of UML in a development process, it feels there is no engineering.

6.Software processes and metrics: Software enginnering is not a random process. It requires a high level of systematic and some numbers to monitor those techniques. So, processes and metrics are essential.

7.Design patterns: Design patterns are standard and most effective solutions for specific problems. If you don't want to reinvent the wheel, you should learn them.

8.Operating systems basics: Learning OS basics is very important because all applications runs on it. By learning it, we can have better vision, viewpoints and performance for our applications.

9.Computer organization basics: All applications including OS requires a hardware for physical interaction. So, learning computer organization basics is vital again for better vision, viewpoints and performance.

10.Network basics: Network is related with computer organization, OS and the whole information transfer process. In any case we will face it while software development. So, it is important to learn network basics.

11.Requirement analysis: Requirement analysis is the starting point and one of the most important parts of software engineering. Performing it correctly and practically needs experience but it is very essential.

12.Software testing: Testing is another important part of software engineering. Unit testing, its best practices and techniques like black box, white box, mocking, TDD, integration testing etc. are subjects which must be known.

13.Dependency management: Library (JAR, DLL etc.) management, and widely known tools (Maven, Ant,  Ivy etc.) are essential for large projects. Otherwise, antipatterns like Jar Hell are inevitable.

14.Continuous integration: Continuous integration brings easiness and automaticity for testing large modules, components and also performs auto-versioning. Its aim and tools (like Hudson etc.) should be known.

15.ORM (Object relational mapping): ORM and its widely known implementation Hibernate framework is an important technique for mapping objects into database tables. It reduces code length and maintenance time.

16.DI (Dependency Injection): DI or IoC (Inversion of Control) and its widely known implementation Spring framework makes life easy for object creation and lifetime management on big enterprise applications.

17.Version controlling systems: VCS tools (SVN, TFS, CVS etc.) are very important by saving so much time for collaborative works and versioning. Their logical viewpoint and standard cammands should be known. 

18.Internationalization (i18n): i18n by extracting strings into external files is the best way of supporting multiple languages in our applications. Its practices on different IDEs and technologies must be known.

19.Architectural patterns: Understanding architectural design patterns (like MVC, MVP, MVVM etc.) is essential for producing a maintainable, clean, extendable and testable source code.

20.Writing clean code: Working code is not enough, it must be readable and maintainable also. So, code formatting and readable code development techniques are needed to be known and applied.

Thursday, April 19, 2012

A Generic Text Comparison Tool Implementation with LCS Approach





Detecting and showing differences of two texts (especially having hundreds or thousands of lines) is a common problem. Using pure java.lang.String class methods may be a solution, but the most important issue for that kind of operations, "performance" will not be satisfactory. We want an efficient solution which may have a view as below: 

Text Difference Tool Example
The problem contains two parts: 
  • Detecting differences of two texts: For detecting differences, an efficient dynamic algorithm of LCS (Longest Common Subsequence) used in this solution. This solution has O(text1WordCount * text2WordCount) complexity and coded as "longestCommonSubsequence" method below.
  • Visualizing the differences: For visualizing, an HTML tag based approach is used, which marks new words of text2 with green color and old words of text1 with red color. This solution has O(changedWordsCount * (text1WordCount+text2WordCount)) complexity and coded as "markTextDifferences" method below.
Note1: For simplicity, "normalizeText" method is used for removing \n, \t and multiple space characters. 
Note2: This class was created as a Vaadin component. But "longestCommonSubsequence" is pure generic and "markTextDifferences" method is generic on HTML based visual components, so they can also be used with different frameworks.


  1. import java.util.ArrayList;
  2. import com.vaadin.ui.CustomComponent;
  3. import com.vaadin.ui.Label;
  4. import com.vaadin.ui.Layout;
  5. import com.vaadin.ui.VerticalLayout;
  6. /**
  7.  * Text comparison component which marks differences of two texts with colors.
  8.  *
  9.  * @author cb
  10.  */
  11. public class TextCompareComponent extends CustomComponent {
  12.     private Layout mainLayout = new VerticalLayout();
  13.     private ArrayList<String> longestCommonSubsequenceList;
  14.     private static final String INSERT_COLOR = "#99FFCC";
  15.     private static final String DELETE_COLOR = "#CB6D6D";
  16.     public TextCompareComponent(String text1, String text2) {
  17.        
  18.         text1 = normalizeText(text1);
  19.         text2 = normalizeText(text2);
  20.         this.longestCommonSubsequenceList = longestCommonSubsequence(text1, text2);
  21.         String result = markTextDifferences(text1, text2,
  22.             longestCommonSubsequenceList, INSERT_COLOR, DELETE_COLOR);
  23.        
  24.         Label label = new Label(result, Label.CONTENT_XHTML);
  25.         mainLayout.addComponent(label);
  26.         setCompositionRoot(mainLayout);
  27.     }
  28.     /**
  29.      * Finds a list of longest common subsequences (lcs) of given two texts.
  30.      *
  31.      * @param text1
  32.      * @param text2
  33.      * @return - longest common subsequence list
  34.      */
  35.     private ArrayList<String> longestCommonSubsequence(String text1, String text2) {
  36.         String[] text1Words = text1.split(" ");
  37.         String[] text2Words = text2.split(" ");
  38.         int text1WordCount = text1Words.length;
  39.         int text2WordCount = text2Words.length;
  40.        
  41.         int[][] solutionMatrix = new int[text1WordCount + 1][text2WordCount + 1];
  42.        
  43.         for (int i = text1WordCount - 1; i >= 0; i--) {
  44.             for (int j = text2WordCount - 1; j >= 0; j--) {
  45.                 if (text1Words[i].equals(text2Words[j])) {
  46.                     solutionMatrix[i][j] = solutionMatrix[i + 1][j + 1] + 1;
  47.                 }
  48.                 else {
  49.                     solutionMatrix[i][j] = Math.max(solutionMatrix[i + 1][j],
  50.                         solutionMatrix[i][j + 1]);
  51.                 }
  52.             }
  53.         }
  54.        
  55.         int i = 0, j = 0;
  56.         ArrayList<String> lcsResultList = new ArrayList<String>();
  57.         while (i < text1WordCount && j < text2WordCount) {
  58.             if (text1Words[i].equals(text2Words[j])) {
  59.                 lcsResultList.add(text2Words[j]);
  60.                 i++;
  61.                 j++;
  62.             }
  63.             else if (solutionMatrix[i + 1][j] >= solutionMatrix[i][j + 1]) {
  64.                 i++;
  65.             }
  66.             else {
  67.                 j++;
  68.             }
  69.         }
  70.         return lcsResultList;
  71.     }
  72.    
  73.     /**
  74.      * Normalizes given string by deleting \n, \t and extra spaces.
  75.      *
  76.      * @param text - initial string
  77.      * @return - normalized string
  78.      */
  79.     private String normalizeText(String text) {
  80.        
  81.         text = text.trim();
  82.         text = text.replace("\n", " ");
  83.         text = text.replace("\t", " ");
  84.        
  85.         while (text.contains("  ")) {
  86.             text = text.replace("  ", " ");
  87.         }
  88.         return text;
  89.     }
  90.     /**
  91.      * Returns colored inserted/deleted text representation of given two texts.
  92.      * Uses longestCommonSubsequenceList to determine colored sections.
  93.      *
  94.      * @param text1
  95.      * @param text2
  96.      * @param lcsList
  97.      * @param insertColor
  98.      * @param deleteColor
  99.      * @return - colored result text
  100.      */
  101.     private String markTextDifferences(String text1, String text2,
  102.         ArrayList<String> lcsList, String insertColor, String deleteColor) {
  103.         StringBuffer stringBuffer = new StringBuffer();
  104.         if (text1 != null && lcsList != null) {
  105.             String[] text1Words = text1.split(" ");
  106.             String[] text2Words = text2.split(" ");
  107.             int i = 0, j = 0, word1LastIndex = 0, word2LastIndex = 0;
  108.             for (int k = 0; k < lcsList.size(); k++) {
  109.                 for (i = word1LastIndex, j = word2LastIndex;
  110.                     i < text1Words.length && j < text2Words.length;) {
  111.                     if (text1Words[i].equals(lcsList.get(k)) &&
  112.                         text2Words[j].equals(lcsList.get(k))) {
  113.                         stringBuffer.append("<SPAN>" + lcsList.get(k) + " </SPAN>");
  114.                         word1LastIndex = i + 1;
  115.                         word2LastIndex = j + 1;
  116.                         i = text1Words.length;
  117.                         j = text2Words.length;
  118.                     }
  119.                     else if (!text1Words[i].equals(lcsList.get(k))) {
  120.                         for (; i < text1Words.length &&
  121.                             !text1Words[i].equals(lcsList.get(k)); i++) {
  122.                             stringBuffer.append("<SPAN style='BACKGROUND-COLOR:" +
  123.                                 deleteColor + "'>" + text1Words[i] + " </SPAN>");
  124.                         }
  125.                     } else if (!text2Words[j].equals(lcsList.get(k))) {
  126.                         for (; j < text2Words.length &&
  127.                             !text2Words[j].equals(lcsList.get(k)), j++) {
  128.                             stringBuffer.append("<SPAN style='BACKGROUND-COLOR:" +
  129.                                 insertColor + "'>" + text2Words[j] + " </SPAN>");
  130.                         }
  131.                     }
  132.                 }
  133.             }
  134.             for (; word1LastIndex < text1Words.length; word1LastIndex++) {
  135.                 stringBuffer.append("<SPAN style='BACKGROUND-COLOR:" +
  136.                     deleteColor + "'>" + text1Words[word1LastIndex] + " </SPAN>");
  137.             }
  138.             for (; word2LastIndex < text2Words.length; word2LastIndex++) {
  139.                 stringBuffer.append("<SPAN style='BACKGROUND-COLOR:" +
  140.                     insertColor + "'>" + text2Words[word2LastIndex] + " </SPAN>");
  141.             }
  142.         }
  143.         return stringBuffer.toString();
  144.     }
  145. }

Friday, June 24, 2011

Develop Rich Web Applications with Java by Vaadin Framework (Introduction)




Vaadin (http://vaadin.com/home) is an open source web application framework having a server-side architecture which constructs user interface of web applications as RIA (rich internet applications), using Java code only.

Vaadin Logo

For developing Vaadin applications, you only use Java code, like Java Swing. This Java code is then converted to GWT (Google Web Toolkit) components (which are HTML and Javascript based) for browser side, and AJAX code sections are generated for some actions to support RIA concept. Server side validation is also performed for all actions.

An example source code is shown below:

  
import com.vaadin.ui.*;

public class HelloWorld extends com.vaadin.Application {
    public void init() {
        Window main = new Window("Hello window");
        setMainWindow(main);
        main.addComponent(new Label("Hello World!"));
    }
}


And the result is: 

Vaadin Hello World Example

Vaadin supports so many UI components and these can be extended with new GWT components if required, and CSS themes can be applied to results. For using Vaadin, only a JAR file is enough. Some Eclipse and NetBeans plugins are also available for easier development if required.

Vaadin supports JPA (java persistence API) container package JAR for database operations. By using containers, you can associate components to database operations directly, e.g. if the item list of a container changes, related visual component’s list is changed too.

Here is an example view of a Vaadin application layout VaadinTunes (http://demo.vaadin.com/VaadinTunesLayout/):

Vaadin Tunes

Because of Vaadin UI components are generated automatically from Java code, they may generally have some complex structure and a bit slow compared to a pure HTML page. For increasing the performance, some optimization rules are suggested: http://vaadin.com/wiki/-/wiki/Main/Optimizing%20Sluggish%20UI 

But development time gain is very high and rich & interactive web components can be developed without any script language information. These parameters must be considered while choosing the technology.

Vaadin is very well documented. You can take a look at “Book of Vaadin”:




Monday, September 6, 2010

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