BDD is TDD done right

This article solves the following challenge: 

TDD or BDD ? What to use ?

Some authors refer to BDD as TDD done right.
BDD follows the same processes as TDD but with the focus on the user. The test written have to fulfill the user story. The idea of creating the tests is that the method behaviour will be clear just by reading the sentence.
BDD follows a language that fits perfect in a agile user story:
Story - Returns go to stock
In order to keep track of stock
As a store owner I want to add items back to stock when they are returned
BDD tests: Refunded items should be returned to stock
Given a customer previously bought a black sweater from me
And I currently have three black sweaters left in stock
When he returns the sweater for a refund
Then I should have four black sweaters in stock
BDD builds upon TDD. You have technical quality with a business approach.

Evaluate complexity of present statement:

Select ratingCancelGuessingPassing knowledgeKnowledgeableExpert

Your rating: 3 Average: 3 (1 vote)


Mobile game development with Unity

Try out Unity3D, it is a cross-platform gaming development framework with physics engine and 3D support.
There are also existing a lot of useful stuff on youtube like tutorials.
It has also a great asset store with a lot of 3D Models, Audio, Sample Projects, etc.
For more information see:



For Java there are already frameworks avaliable to help developers all over the world. In the newest version of java this is included and done by the introduction of the Locale variable. Additionally language files are defined, where for each language one textfile is created, by default they are called something like this:

First comes the files name, than the two letters shortcut for the language, and then the two letters for the region or country. Taking up the example, if we wish to add a specific declaration for Austria, we would simply create a new text file, named:

The inside of the textfiles contains of the message keys and the messages themselfs. While the keys are always the same, the message should be in the corresponding language. A default file can also be created, to cover up everything that hasn't yet been translated, even when other files already exists.

To get things running in the code, one must simple follow the short tutorial at oracle [1] or can read it down below.

1. Create the Properties Files

A properties file stores information about the characteristics of a program or environment. A properties file is in plain-text format. You can create the file with just about any text editor.

In the example the properties files store the translatable text of the messages to be displayed. Before the program was internationalized, the English version of this text was hardcoded in the System.out.println statements. The default properties file, which is called, contains the following lines:

greetings = Hello
farewell = Goodbye
inquiry = How are you?

Now that the messages are in a properties file, they can be translated into various languages. No changes to the source code are required. The French translator has created a properties file called, which contains these lines:

greetings = Bonjour.
farewell = Au revoir.
inquiry = Comment allez-vous?

Notice that the values to the right side of the equal sign have been translated but that the keys on the left side have not been changed. These keys must not change, because they will be referenced when your program fetches the translated text.

The name of the properties file is important. For example, the name of the file contains the fr language code and the FR country code. These codes are also used when creating a Locale object.
2. Define the Locale

The Locale object identifies a particular language and country. The following statement defines a Locale for which the language is English and the country is the United States:

aLocale = new Locale("en","US");

The next example creates Locale objects for the French language in Canada and in France:

caLocale = new Locale("fr","CA");
frLocale = new Locale("fr","FR");

The program is flexible. Instead of using hardcoded language and country codes, the program gets them from the command line at run time:

String language = new String(args[0]);
String country = new String(args[1]);
currentLocale = new Locale(language, country);

Locale objects are only identifiers. After defining a Locale, you pass it to other objects that perform useful tasks, such as formatting dates and numbers. These objects are locale-sensitive because their behavior varies according to Locale. A ResourceBundle is an example of a locale-sensitive object.
3. Create a ResourceBundle

ResourceBundle objects contain locale-specific objects. You use ResourceBundle objects to isolate locale-sensitive data, such as translatable text. In the sample program the ResourceBundle is backed by the properties files that contain the message text we want to display.

The ResourceBundle is created as follows:

messages = ResourceBundle.getBundle(
"MessagesBundle", currentLocale);

The arguments passed to the getBundle method identify which properties file will be accessed. The first argument, MessagesBundle, refers to this family of properties files:

The Locale, which is the second argument of getBundle, specifies which of the MessagesBundle files is chosen. When the Locale was created, the language code and the country code were passed to its constructor. Note that the language and country codes follow MessagesBundle in the names of the properties files.

Now all you have to do is get the translated messages from the ResourceBundle.
4. Fetch the Text from the ResourceBundle

The properties files contain key-value pairs. The values consist of the translated text that the program will display. You specify the keys when fetching the translated messages from the ResourceBundle with the getString method. For example, to retrieve the message identified by the greetings key, you invoke getString as follows:

String msg1 = messages.getString("greetings");

The sample program uses the key greetings because it reflects the content of the message, but it could have used another String, such as s1 or msg1. Just remember that the key is hardcoded in the program and it must be present in the properties files. If your translators accidentally modify the keys in the properties files, getString won't be able to find the messages.



Automatic upload using Aptana plugin for Eclipse

Aptana plug-in for Eclipse adds a lot of functionality for web developers inclusive of the FTP connection possibility. It also supports scripting ('Monkey Scripts'), which will be used in this solution:

  1. Start Eclipse
  2. Click on 'Help>Install New Software'
  3. Into 'Work with:' type
  4. Install the Aptana plug-in
  5. In the root folder of the active PHP project create folder 'scripts'
  6. In scripts folder create file 'upload.js' with this content:
    * Listener: commandService().addExecutionListener(this);
    * Menu: Synchronize > Upload Current File On Save
    * DOM: http://localhost/com.aptana.ide.syncing.doms
    * DOM:

    * Returns a reference to the workspace command service
    function main() {}
    function commandService()
    var commandServiceClass =;

    // same as doing ICommandService.class
    var commandService =;
    return commandService;

    * Called before any/every command is executed, so we must filter on command ID
    function preExecute(commandId, event) {}
    /* Add in all methods required by the interface, even if they are unused */
    function postExecuteSuccess(commandId, returnValue)
    // if we see a save command
    if (commandId == "")
    function notHandled(commandId, exception) {}
    function postExecuteFailure(commandId, exception) {}

  7. Restart Eclipse
  8. Set up the FTP connection
  9. Click on 'Scripts>Synchronize>Upload Current File on Save'

Now Eclipse will automatically upload every file after it's saved.


Automatic upload - Eclipse - FTP server

Eclipse is an IDE for implementation of applications in different programming languages. During the programing of an PHP web application it must be first deployed to the server in order to run it. It is possible to configure Eclipse to run a PHP program on local server, but sometimes it is necessary to implement the program locally and run it on a remote web server (because of the tweaking of the application or other reasons). We want to make the process of uploading of the PHP files to the appropriate folder on the remote FTP server automatic. The particular file should be uploaded after each save on the local disk.

Send an e-mail with C#

<p class="MsoNormal" style="MARGIN: 0in 0.9pt 0pt 17.6pt; LINE-HEIGHT: normal; tab-stops: .5in; mso-layout-grid-align: none"><span style="color: #000000;"><span style="FONT-SIZE: 11.5pt; FONT-FAMILY: 'Segoe UI','sans-serif'">We want to write a class that can be used to send an email to a selected email address. This class should have four properties namely: To, From, Subject, and Body, </span><span style="FONT-SIZE: 11.5pt; FONT-FAMILY: 'Segoe UI','sans-serif'; mso-ansi-language: DE" lang="DE">and a method to send the email (in the current version, attachements are not covered).<br /></span></span></p><p class="MsoNormal" style="MARGIN: 0in 0.9pt 0pt 17.6pt; LINE-HEIGHT: normal; tab-stops: .5in; mso-layout-grid-align: none">&nbsp;</p><p class="MsoNormal" style="MARGIN: 0in 0.9pt 0pt 17.6pt; LINE-HEIGHT: normal; tab-stops: .5in; mso-layout-grid-align: none">&nbsp;</p><p class="MsoNormal" style="MARGIN: 0in 0.9pt 0pt 17.6pt; LINE-HEIGHT: normal; tab-stops: .5in; mso-layout-grid-align: none">&nbsp;</p>

How to Send SMS in Java

<p class="MsoNormal" style="margin: 0in 0in 10pt;"><span style="font-size: small;"><span style="color: #000000;"><span style="font-family: Calibri;"><span style="mso-ascii-font-family: Calibri; mso-hansi-font-family: Calibri; mso-font-kerning: 18.0pt;">We want to write a java code and use it in order to be able to send SMS</span><span style="mso-bidi-language: AR-SY; mso-ascii-font-family: Calibri; mso-hansi-font-family: Calibri; mso-font-kerning: 18.0pt;">&acute;s to a mobile phone through http </span></span></span></span></p>

Speeding up project using Zend_Db

<p>An existing project realized with the Zend Framework should be optimized in terms of performance. The use of Zend_Db slows down the database access because of its automatic table-scanning and overhead. The SQL-queries as well as the table structures are already optimized and should not be changed. The configuration on the server environment:</p><ul><li>PHP 5.2.6</li><li>MySQL Server Version: 5.0.75</li><li>Zend Framework 1.5</li><li>Apache 2.6.28-16</li><li>Suhosin-Patch</li></ul><p>The update to a newer version of Zend Framework is right now not possible because of some migration problems. The changes in the code should be measurable and viewable with XDEBUG/kcachegrind.</p>

Securing web pages written in PHP

<p>An existing web page with no special focus on safety should be secured against different kinds of attacks. The page is located on a shared web server on which no special privileges are granted. The versions of the software used in the environment are the following:</p><ul><li>PHP 5.2.6</li><li>MySQL Server Version: 5.0.75</li><li>Zend Framework 1.5</li><li>Apache 2.6.28-16</li><li>Suhosin-Patch</li></ul><p>PHP-Configuration:</p><ul><li>safe_mode off</li><li>magic_quotes_runtime off</li><li>magic_quotes_gpc off</li></ul><p>Especially the parameters should be checked against malicious contents.</p><p>GET-Parameters:</p><ul><li>site, string</li><li>nodeid, integer</li><li>action, string</li></ul><p>The POST-Parameters are variable and should just allow alphanumerical values and punctuation marks.</p><p>XSS, SQL Injection and directory traversal should be avoided. The Solution should be easy to understand, configurable and flexible. Already finished libraries and tools which are tested will be accepted.</p>

Securing a service using WS-Security

<p>We have an existing Web-Service accessible to everyone who knows the address of the endpoint. The software used on the server:</p><ul><li>Java 6</li><li>Apache CXF 2.2.3</li><li>SOAP Webservice</li></ul><p>Because of massive abuse in the past the access should be limited to authorized people only. The login credentials are stored in a database and should be checked with every request made on the service. The login data should be transmitted in the SOAP-Envelope header and an interceptor should&nbsp; verify the data before the actual invocation of a webservice method. The solution should be based on an open standard which is well defined.</p>


Subscribe to development