JUnit and how to use it in NetBeans

JUnit is an unit testing framework for the Java programming language.

From tutorialspints:

JUnit promotes the idea of “first testing then coding”, which emphasizes on setting up the test data for a piece of code that can be tested first and then implemented

This approach is kind of test a little and code a little because you don’t test the whole project but instead part of the software such as individual method to ensure that is working properly. It also increase the productivity of the programmer and reduces the stress; this because you do not leave any problems or things like “fix it later” in the program.

In java, JUnit is  used as a library by importing the necessary classes an then creating a constructor of the test and implementing methods that call an instance of the class you want to test that are used to execute specific method of the tested class. The goal for each of those testing methods is to assert the expect behavior comparing the the expected value and the actual value. You can use any data type: from data primitive (such as int, char, float, etc.) to arrays of any type, any objects and nulls.

Many advantages of JUnit are that it doesn’t require human judgment to interpret where the failure happens, what you actually have to do is create a testing class from your class that you want to test, make some adjustments and execute it and wait until the output tells you where the error is. And if your are using an Integrated Development Environment (IDE) is more easier to do it, which is actually another advantage because JUnits is included in most of IDE such as Eclipse and NetBeans.

I will write a quick guide of how to use it

junitnetbans1
junittest2
junittest3
junittest4
Continue reading "JUnit and how to use it in NetBeans"

Design SoftWhat?

I want to describe software design with a little story:

Imagine a time when you were a kid and you wanted a Lego castle to play with your imagination and other toys. Then, your dad takes you to a store and you choose one of the popular Legos that was at the time. When you come back to your hose, out open the box and take out all the small bags that contains Lego pieces. There you have different choices: to open all the bags and mix the pieces, to separate the pieces by color or by shape, or to open the bags and wait for the instruction manual to tell you which pieces you will use next. Whatever the decision you made, you will proceed to build your new toy that also have two choices: to follow the steps of the instruction or to try to build without it and just using the image of the box for reference. Finally, you have your new toy, and maybe with the time, pieces will fall apart and you will have to fix it, or maybe you find a bug inside and you will have to clean it, or you will get bored and you will destroy it to build it again or build another thing.

flickr photo by Mark Bridge https://flickr.com/photos/markbridge/4243574647 shared under a Creative Commons (BY-NC-ND) license
flickr photo by Mark Bridge https://flickr.com/photos/markbridge/4243574647 shared under a Creative Commons (BY-NC-ND) license

Did you find out where the software design fit in?

I even described something similar to the software life cycle. If not, I will tell you:

In that story, when you opened the box, whatever what you did, you build the toy that was at the portrait of the box; you followed a design and stick to it to create a product and never created another thing.

In software design, is very

Continue reading "Design SoftWhat?"

Design Patterns

Imagine that you are a blacksmith from the middle ages and you are asked to craft many similar swords. I don’t know the process to create a sword but one thing for sure is that it will be tedious to build the “skeleton” of the sword many times. So one thing you do, is to create a mold which let you craft a standard sword easier and then you can work over it according to the customer specification.

Software design patterns is very similar to a mold, is like a template that provides a solution and that can be used many times in general problems.

In software engineering, a design pattern is a general repeatable solution to a commonly occurring problem in software design.

                                                From source making

Design patterns it is not a finished design that let you work directly to the code, is more like a quick start guide that helps you in how to solve general problems, also, it should be implementable in most program language and non in a specific one. That’s why I say that is like a quick start guide, because you solve the problem with your own tools and knowledge, and the design pattern only tells you how to attack the problem or how to start the first move. But if the design pattern is implemented in the wrong place, your software is not going to work and will create more problems, making it unable to come with a solution.

4346978966_7199ac50ac_z
flickr photo by BodHack https://flickr.com/photos/bodhack/4346978966 shared under a Creative Commons (BY-NC) license

Patterns were originated as an arquitectural concept by Christopher Alexander, and it was introduced in programming in the OOPSLA conference in 1987 by Kent Beck and Ward Cunningham. Then it gained popularity in computer science when the Gang of Four

Continue reading "Design Patterns"

Unified Modeling Language

Unified Modeling Language (UML) is not a program language that where you can write code and create something that a computer will understand; but is a way to represent, build or record the elements of an oriented object software.

Modeling is the designing of software applications before coding.                                                    Says UML.org

In UML you design diagrams that can contain different elements of the software, for example, the most common is the one where you write the name of the class, its attributes and its methods. But it all depends of the diagram you use. In UML there are many different diagrams with different uses and elements that you can write.

Is not necessary to become an expert of UML because is not actually a must for learning actual coding, but is important to know about it because it helps in the design part of software. Creating an UML diagram is like drawing a sketch, is not that important and is unnecessary to put much effort on it, just with understanding the idea is enough.

There are many UML diagrams (13 to be exactly) so in the next section there are only the three most important.

Activity Diagram:

Activity Diagrams are used to design complex methods. It describes phases or activities done by the computer or an user. They are also used to describe business processes in a single usage scenario. They look a lot like flowcharts, actually, activity diagram is an upgraded version of flowcharts. Take a look at this example:

flickr photo by jean-louis zimmermann https://flickr.com/photos/jeanlouis_zimmermann/3204423336 shared under a Creative Commons (BY) license
flickr photo by jean-louis zimmermann https://flickr.com/photos/jeanlouis_zimmermann/3204423336 shared under a Creative Commons (BY) license

This example describe a generic shop process. As you can see some task are only for a specific agent and reading it is really simple if

Class Diagram: Builder Pattern by beatak, on Flickr
Sequence diagram for synchronisation of by carol shergold, on Flickr
Continue reading "Unified Modeling Language"

Software requirements elicitation and specification

Yeah, more requirements, you may have thought that functional and non-functional requirements were the only thing you need to know; buy don’t need to worry because those are easier to understand.

9593217572_a2bc170950_z
flickr photo by ChrisL_AK https://flickr.com/photos/fncll/9593217572 shared under a Creative Commons (BY) license

To explain this better, you need to remember the first step of the software life-cycle (you can see my post here): gathering information. As I wrote on a previous post, in this step, you obtain the functional and non-functional requirements for your software, but that is not all, Software requirement elicitation and requirements specification are also part of the gathering phase.

Requirement elicitation, is actually the first thing you have to do in the software life-cycle and is the practice of finding out what the customer or user wants. In an informal concept, is more like a wish list of requirements. But there are many problems that are almost impossible to avoid because it depends more of the customer, for example: he doesn’t know exactly what he wants, he thinks that some specifications are obvious or his needs changed and want the software to do something else.

After knowing what the customer wants, you are ready to do the Software Requirement Specification or for short SRS, which is a process of recording the requirements in any form, and it can be in a document, a graphical representation, etc.

RS also contains the functional and non-functional requirements and other specification types, for example: performance, maintainability, reliability, resource, etc.

According to the this page:

A software requirements specification SRS is a document that captures complete description about how the system is expected to perform. It is usually signed off at the end of requirements engineering phase

For more information you can visit those pages:

Crystal method

flickr photo by Inskora https://flickr.com/photos/inskora/8364888549 shared under a Creative Commons (BY-NC) license
flickr photo by Inskora https://flickr.com/photos/inskora/8364888549 shared under a Creative Commons (BY-NC) license

That’s right, another development method. At first, I thought there was only a way for software development, then I was taught that there are different development methods such as the waterfall and the agile. And now, after some research, I found that there are not only two, but lots of methodologies.

As you can see, from all the methodologies, I chose the crystal method because I found interesting the name and because I really liked their way of thinking.

Crystal method is like a subdivision of agile process because it also focuses on frequent delivery of working software, high user involvement and adaptability. This method was developed by Alistair Cockburn, a computer scientist known as one of the initiators of the agile software development.

His focus is on the people, interaction, community, skills, talents, and communications with the belief that these are what have the first-order effect on performance. Process, he says, is important, but secondary.

from infolific

At first sight, it looks like it doesn’t care about the software, but if you think about, if you care about your team and make a friendly atmosphere at work, the final product will be well made.

flickr photo by lozikiki https://flickr.com/photos/laurenashleigh/3876741791 shared under a Creative Commons (BY-ND) license
flickr photo by lozikiki https://flickr.com/photos/laurenashleigh/3876741791 shared under a Creative Commons (BY-ND) license

The crystal philosophy is about recognizing that each team has its own talents and skill and therefore each team is assigned a specific process according to their abilities.

You may be wondering “why is it called crystal?”. That’s because it refers to a various facets of a gemstone on the same core.

The underlying core represents values and principles, while each facet represents a specific set of elements such as techniques, roles, tools, and standards.

Marios Alexandrou from

Continue reading "Crystal method"

The bridge that connects you with your apps

flickr photo by Frau Hölle https://flickr.com/photos/frauhoelle/8464661409 shared under a Creative Commons (BY-SA) license
flickr photo by Frau Hölle https://flickr.com/photos/frauhoelle/8464661409 shared under a Creative Commons (BY-SA) license

The bridge I’m going to write about is the Application Programing Interfaces also known as API; you may be wondering the same questions that a I had: what is an API?, how can I use it?, for what this is useful for?, why do you say that is a bridge that connect with my apps?

For starters, if you are a common user, is important to know about API, you don’t need to know everything about it, but at least how it works and why is very useful with apps and websites. And if you are  software engineer, you’d better dig deeply about APIs.

An API is an interface that allow applications to interact with others, and without knowing, everyone have been using it in their daily life; when you open your Facebook app en your smartphone, an API is connecting the app with Facebook.com, when you use Whatsapp, Instagram and many other apps have API; and all to make the interaction with the internet more easier, faster and comfortable.

Have you ever used or had a widget?, those small window or icons that appear on your screen with information about an app. Widgets are other examples of API, where your are not directly connected in Twitter, Facebook or other website, but you are interacting with information provided by them.

API is very useful tool for everyone, for companies because it allows them to be more competitive; and for common users because you can get all kind of information online.

The most important thing APIs are bringing to the table, is the empowerment of the average online individual. APIs are providing access to much of the data and content we are

Continue reading "The bridge that connects you with your apps"

Software requirements: Functional and Nonfunctional

flickr photo by Peter Morville https://flickr.com/photos/morville/3220969358 shared under a Creative Commons (BY) license
flickr photo by Peter Morville https://flickr.com/photos/morville/3220969358 shared under a Creative Commons (BY) license

To start the process of a software life cycle you need requirements, in other words, what the customer ask for. Before starting the development process, you have to know what the software is going to do, and how is going to do it. Functional and nonfunctional requirements answer those questions.

To be more precise, in software engineer, functional requirements define the functions of the system, is the description of the feature required. It also includes description of the required functions. Some examples of functional requirements are calculations, technical details, data manipulation and processing.

Functional requirements are supported by the nonfunctional requirements, which tells how you are going to make the functional requirements work. This does not mean that you will make something functional with whatever methods you have in mind; nonfunctional requirements also have detail constraints as well as what standard a function should be provided.

To summarize:

In the first step of the software life-cycle, like I wrote before on a previous post, you need to gather information about what the customer needs, those needs are the functional requirements, the description of the behavior of the system. Then, nonfunctional requirements are things that can be measured about the system.

It describes aspects of the system that don’t relate to its execution, but rather to its evolution over time (e.g. maintainability, documentation, etc).

From stack overflow

References:

http://www.sqa.org.uk/e-learning/SDM03CD/page_02.htm

http://www.dau.mil/publications/publicationsDocs/SEFGuide%2001-01.pdf

http://stackoverflow.com/questions/16475979/what-is-functional-and-non-functional-requirement


The first process model

On my previous posts, I wrote about the software life-cycle and software development process (if you want to check it out). Now I’ll write about one of the methodologies used for software development. You already read it in the title, the waterfall method.

This was the first process model to be introduced. This method, in contrast with the agile method (I wrote about this with my friend), is linear and sequential, which means that you can’t skip a step, or in other words, you have to complete one phase to continue with the next one; that’s why is called waterfall. In the image below you can see each step and notice that is the same of the software life-cycle.

flickr photo by ENT108 https://flickr.com/photos/ent108/2184549701 shared under a Creative Commons (BY-NC) license
flickr photo by ENT108 https://flickr.com/photos/ent108/2184549701 shared under a Creative Commons (BY-NC) license

The linear process makes it easy to manage and to measure the progress; I see it like a manual to construct software where you must follow each step, so if you missed something in step two and you are in step four, it will be difficult to backtrack and fix the problem, which make the design phase, in this method, very important.

I personally prefer the waterfall method because of his sequential process, I’m more like “you can’t do this before doing that other thing”, but I noticed that agile method is more flexible where you and your team helps each other to accomplish something. In the end, you decide which method use depending if the advantages of each method are more suitable for your project.

References:

http://www.tutorialspoint.com/sdlc/sdlc_waterfall_model.htm

Waterfall vs. Agile: Which is the Right Development Methodology for Your Project?


Software Development Process

flickr photo by hairchaser https://flickr.com/photos/41829005@N02/6188482632 shared under a Creative Commons (BY-SA) license
flickr photo by hairchaser https://flickr.com/photos/41829005@N02/6188482632 shared under a Creative Commons (BY-SA) license

Software development process is confused a lot with software life cycle, some authors write like if they were the same, but is much like a cycle inside another cycle, so the correct way to classify them is to say that the development process is a subset of the life-cycle.

I would say that is part of the coding phase of the software life cycle, but I would be wrong because they have steps in common like the design and maintenance phase.

Just like this page says:

This process includes not only the actual writing of code but also the preparation of requirements and objectives, the design of what is to be coded, and confirmation that what is developed has met objectives.

Examples of those process are: Agile software development and waterfall method.

 

References:

http://www.selectbs.com/analysis-and-design/what-is-a-software-development-process

http://whatis.techtarget.com/reference/Learn-IT-Software-development

http://www.itinfo.am/eng/software-development-methodologies/