Issue 32 - February- Today Software Magazine

Page 1

No. 32 • February 2015 • www.todaysoftmag.ro • www.todaysoftmag.com

TSM

T O D A Y S O F T WA R E MAG A Z I NE

ine

Three years of Today Software Magaz

Cluj Innovation Days 2015 Non-invasive technological solutions applied to the medical field (Kinect)

 Hands-On With The Watchkit SDK JavaFX and RESTful Web Services communication (II) 4 Ideas To Apply For Better Software Design Critical Thinking in Business Analysis

Dynamics of Agile Coaching Does a developer test? Does a tester code? Internal Marketing(IM) – Growing up in Romania! Sentiment Analysis and the complexity of online opinions IoT Flavour: Sensoriada



6 Three years of Today Software Magazine Ovidiu Măţan

7 CLUJ INNOVATION DAYS 2015 Andrei Kelemen

8 The impact of Startup Weekend Events: globally and locally Cristina Juc and Cristina Tare

9 Science And Technology Meet Entrepreneurship Oana Călugăr

10 Registrul de Biciclete - a project for all cyclists in Romania Diana Silaghi

13 Hands-On With The Watchkit SDK Chertes Cristian and Korosi Csongor

16 JavaFX and RESTful Web Services communication (II) Silviu Dumitrescu și Diana Bălan

20 Non-invasive technological solutions applied to the medical field Mursa Bogdan

22 Dynamics of Agile Coaching Călin-Vlad Gîngă

25 As a Business Analyst, I want to help the SCRUM team Liviu Ştefăniţă Baiu

28 4 Ideas To Apply For Better Software Design Alexandru Bolboacă

31 Does a developer test? Does a tester code? Raluca Morariu

33 IoT Flavor: Sensoriada Andrei Crăciun

36 Sentiment Analysis and the complexity of online opinions Cosmin Gabriel Popa

39 Critical Thinking in Business Analysis Răzvan Costa

41 Java 8 Optional Peter Lawrey

42 Deep dive in clouds providers SLAs Radu Vunvulea

44 Internal Marketing(IM) – Growing up in Romania! Adrian Abrudan

46 Gogu at minced meat rolls Simona Bonghez, Ph.D.


editorial

T

Ovidiu Măţan

ovidiu.matan@todaysoftmag.com Editor-in-chief Today Software Magazine

his month we celebrated three years since the release of the first issue of Today Software Magazine. It has been three years of satisfaction, but also of hard work and dedication from the entire team. None of these would have been possible without the enthusiasm of the Cluj IT community and that of our collaborators around the country and abroad. Each issue has its own story. The selected articles attract many questions during each release event. But you can read more on the evolution of this project in the article we start this issue of the magazine with. A short review of the articles in the current issue can draw your attention to the diversity of the approached subjects. We invite you to read one of the first articles dedicated to Apple Watch programming: The WARCHKIT SDK experiment. The analysis of feelings and the complexity of online opinions present to us the way of discovering in a programmatic manner an analysis of the opinions expressed online, through a few examples of code written in Python. The projects based on Kinect are represented by a project born of Microsoft Imagine Cup and whose coordinator in Dan Suciu: Technical non-invasive solutions in the medical domain. The article entitled JavaFX Optional is not only for replacing a null value continues the series dedicated to the Java language. The end of this issue is marked by an article of the marketing area, The development of Internal Marketing in Romania! and by Gogu’s new adventure.

Ovidiu Măţan

Founder of Today Software Magazine

4

no. 32/2015, www.todaysoftmag.com


Editorial Staf

Authors list Adrian Abrudan

Korosi Csongor

Senior partner & research director @ Loopaa

iOS Developer @ Telenav

Alexandru Bolboacă

Liviu Ştefăniţă Baiu

Agile Coach and Trainer, with a focus on technical practices @Mozaic Works

Senior Business Consultant @ Endava

adrian.abrudan@loopaa.ro

Editor-in-chief: Ovidiu Mățan ovidiu.matan@todaysoftmag.com Editor (startups & interviews): TBD marius.mornea@todaysoftmag.com Graphic designer: Dan Hădărău dan.hadarau@todaysoftmag.com Copyright/Proofreader: Emilia Toma emilia.toma@todaysoftmag.com

alex.bolboaca@mozaicworks.com

korosi.csongor@telenav.com

liviu.baiu@endava.com

Andrei Crăciun

Mursa Bogdan

Mobile Developer @ Intel

Software Developer @ Yardi

Andrei Kelemen

Oana Călugăr

Executiv director @ IT Cluster

Ambassador în România @ Hello Tomorrow

Călin-Vlad Gîngă

Peter Lawrey

Software developer @ ISDC

CEO @ Higher Frequency Trading Ltd

Chertes Cristian

Cosmin Gabriel Popa

iOS Developer @ Telenav

SA R&D Osprov Team @ HP

Cristina Juc

Raluca Morariu

Organizatoare @ Startup Weekend Cluj

Senior QA Engineer @ Betfair

Cristina Tare

Răzvan Costa

Organizatoare @ Startup Weekend Cluj

Business Analyst @ Endava

Diana Bălan

Silviu Dumitrescu

Java developer @ Accesa

Java Line Manager @ Accesa

Diana Silaghi

Simona Bonghez, Ph.D.

PR Manager @ Registrul de Biciclete

Speaker, trainer and consultant in project management,

contact@andreicraciun.com

mursa.bogdan@yardi.com

Translator: Roxana Elena roxana.elena@todaysoftmag.com Reviewer: Tavi Bolog tavi.bolog@todaysoftmag.com

andrei.kelemen@clujit.ro

calugar.oana@gmail.com

Accountant : Delia Coman delia.coman@todaysoftmag.com calin.ginga@isdc.eu

Made by

Today Software Solutions SRL str. Plopilor, nr. 75/77 Cluj-Napoca, Cluj, Romania contact@todaysoftmag.com www.todaysoftmag.com www.facebook.com/todaysoftmag twitter.com/todaysoftmag ISSN 2285 – 3502 ISSN-L 2284 – 8207

chertes.cristian@telenav.com

cristinajuc@gmail.com

cristinatare@gmail.com

cosmin-gabriel.popa@hp.com

raluca.morariu@betfair.com

Razvan.Costa@endava.com

Copyright Today Software Magazine Any reproduction or total or partial reproduction of these trademarks or logos, alone or integrated with other elements without the express permission of the publisher is prohibited and engage the responsibility of the user as defined by Intellectual Property Code www.todaysoftmag.ro www.todaysoftmag.com

Diana.Balan@accesa.eu

diana@registruldebiciclete.ro

silviu.dumitrescu@accesa.eu

simona.bonghez@confucius.ro

Owner of Colors in Projects

www.todaysoftmag.ro | nr. 32/februarie, 2015

5


business

Three years of Today Software Magazine

O

n February 6th 2012, the first issue of Today Software Magazine was released. I remember how, on the launching of the magazine, together with my colleagues from Gemini Solutions, we tried to draw a list of all our acquaintances from the IT domain. We managed to bring together twenty people, thus setting up the first release event. Back then, we did not think about presenting articles, we simply had a chat and gave the magazine away to the participants. Since then, this project has been through several transformations and collaborations in order to reach today’s form. Today Software Magazine is a project that proved two important things: the necessity of some local information on the level of IT specialists and, on the other hand, their need to express themselves in a space where technology and amassed experience are the most important aspects. As a matter of fact, in the editorial published in the first issue, we expressed the three directions that were to be followed: • The creation of a bond between specialists by promoting technologies and local trends; • The promotion of Romanian companies and start-ups which develop their own products; • The achievement of a domain elite that will also be able to promote itself by publishing articles. Though we never considered ourselves a startup, the evolution of the magazine has all the ingredients specific to these: 1. The disruptive side, by publishing all the information for free, unlike the traditional publications in the industry, where the content is paid; 2. The first steps, when our friends and their connections helped enormously; 3. The subsequent evolution, which represented an adjustment to the local ecosystem.

Important ingredients

Drawing up the content for the first issue represented a challenge. Most of our friends took initiative and each of them contributed with an article. The main dilemma back then was whether to remain only online or have the magazine also in the printed form. Many people asserted themselves as supporters of the ecological principles, therefore of the online version, when we asked for their opinion. But, upon leaving, most of them always wanted to take some more magazines with them,

6

for their friends. So, we kept both versions. Another aspect I had to take into account was the financing. As it was a personal project, I was supposed to cover the costs from my own resources. This way, I think we would have had a few issues during the first year and a few more afterwards. But the desire of the local companies to get involved and support my effort of promoting the local trends in IT provided my project with continuity and legitimacy. ISDC was the first company to get involved beginning with the second issue. It was followed shortly afterwards by 3Pillar Global, Small Footprint, Endava and many others. The community is probably the most important aspect. After the initial release event, we remained mostly online. The lack of real communication was felt in the form of lack of feedback from the readers. The solution came again from ISDC, which offered to host a release event. After this event, the opportunity this publication gave to the community to reunite within such events was obvious. The success of any project is conditioned by consistency and rhythmicity. During the first year, the magazine appeared with a relatively unclear frequency: approximately once in a month and a half or once in two months. This actuality had its cause mostly in the lack of articles. After the first year, we decided on the monthly release of the magazine, and this thing lead to a bigger number of articles sent for publication, since everyone knew to relate in their planning to a certain month. The need of quality in the expression of the content arouse after the first issue. Though we do not require eloquence and stylistic figures of speech from the programmers, we have to show respect to our readers by a clear and accurate writing from a grammatical point of view. Therefore, expression and grammatical

no. 32/february, 2015 | www.todaysoftmag.com

reviewing and proofreading proved compulsory for any type of text published in the Romanian version as well as in the English one. Cluj IT Days event, www.itdays.ro, which last year was at its second edition, is a corollary of the activity of the magazine, staging the best specialists and collaborators of the magazine alongside international guests. Though strongly connected to the magazine, Cluj IT Days tends to become in time an independent brand.

Future plans

We have recently launched the TSM card in order to give the community a chance to get involved actively. Furthermore, we will try to bring more internationally renowned specialists in the pages of our magazine and keep up the good work!

Ovidiu Măţan

ovidiu.matan@todaysoftmag.com Editor-in-chief Today Software Magazine


event

TODAY SOFTWARE MAGAZINE

CLUJ INNOVATION DAYS 2015 From Knowledge to Market Values

P

reparations are underway for the third edition of Cluj Innovation Days, an event that has become a reference point among those focusing on promoting innovation across industries. It is our ambition to establish this conference over the years to come as “The Event” dedicated to the role of innovation in businesses.

This year’s edition of the conference is exploring the way in which technological processes occur, from having an idea to researching it or forging it through an innovation process until it comes to shape, and to actual transfer of the result into the economy. A host of speakers are expected, from various walks of life: officials from the European Commission, from the Romanian authorities (national and local), researchers and professionals with strong technical backgrounds to business people, cluster organizations and business associations from across Europe. They will deliver master classes with attractive, relevant and high quality content for every participant, be it either a developer, engineer, researcher or business person. In an effort to bring this event closer to your interest, we made a bold decision. We want this time that you become part of a unique event, which masterfully combines business and technology so that entrepreneurship becomes the next natural step. You will be immersed in two days of intensive experiences and we will give you the possibility to interact equally with peers and high profile individuals. Cluj Innovation Days 2015 will take place on Thursday and Friday, March 19th and 20th, at Grand Hotel Napoca.

The weekend before (March, 14th and 15th) we will also organize a hackathon for approximately 150 people to put their ideas into practice under guidance and feedback from established experts. So I take this chance to invite you to not miss this great event. Find out more about our conference at http://clujinnovationdays.com/ and register to get your tickets first with an early bird discount. See you there! Andrei Cluj IT Cluster

Andrei Kelemen

andrei.kelemen@clujit.ro Executiv director @ IT Cluster

www.todaysoftmag.com | no. 32/february, 2015

7


entrepreneurship

The impact of Startup Weekend Events: globally and locally

F

or those who are not yet familiar with this concept, Startup Weekend (SW) is an event that brings together entrepreneurs, graphic designers, developers, marketers and other bright people with smart business ideas. But for those who already know what it’s about, we invite you to our next edition, which will take place during the weekend 24th – 26th of April 2015.

Startup Weekend is a concept that was created in USA and exported all around the world. Its main goals are education and personal development. The organizers provide you the context, resources, mentors, and most important, the opportunity to meet new people that are also eager to create a startup. The main idea of the event is very simple: you have 54 hours and the opportunity to start your own business during this time. At the beginning, everyone has the chance to pitch an idea in front of the group, then the participants vote for the best and the most interesting ideas, and the teams are created. The next step is the most exciting: the development of the business idea. The teams must take into consideration everything that is essential for a business: the visual component, the technical one, the way it will work, and also the marketing strategies. At the end of these days, the projects are presented in front of a jury formed from entrepreneurs, IT developers and business people. At the end of the event the jury choose the best ideas. The first event of this kind took place in 2007, in Colorado, USA, when Andrew Hyde brought together 70 entrepreneurs to try to create different startups in just 54 hours. The model quickly expanded to cities around the world, and then, in

8

2010 the Startup Weekend organization was officially founded. From its beginning and up until today were more than 1000 SW events all around the world, involving more than 100.000 entrepreneurs, across more than 600 cities in over 120 countries, and over 8000 startups were created. Three years ago, Startup Weekend was also organized for the first time in Cluj. During the past editions a lot of teams were created, people had the opportunity to learn, to share their experience and to launch their ideas at different incubators such as LaunchHub or Hubraum, and other tech events like: HowToWeb, Tech Open Air, IT4Change Summit. Remembering the winners of the last editions of SW Cluj: • UseTogether - a community based on collaborative consumption - launched in 2012. • in 2013 OmniPaste created an intelligent clipboard, global, data aware • in 2014 Engagement Management team pitched an idea of changing the performance process management by using an e-mail app. The reason why “startups” have become such a preferred workplace/business model is pretty simple. The desire for developing something different, for helping the community, as well as the

no. 32/february, 2015 | www.todaysoftmag.com

abundance of creativity and energy, are all contributing to this new trend that is continuously expanding. We know there are a lot of people out there that want to share their knowledge and ideas and for that reason we encourage you to join the fourth edition of Startup Weekend Cluj. For more details please visit us on twitter or facebook.

Resources 1.

2.

3. 4.

http://startupweekend.org/wp-content/ blogs.dir/1/files/2013/04/Impact-ReportGuide-TEST-42C-4_11.pdf http://cluj.startupweekend.org/2013/03/05/ w inning-te ams-at-st ar tup-we ekendcluj-2013/ http://cluj.startupweekend.org/2014/03/10/ winning-teams-swcluj-2014/ http://cluj.startupweekend.org/2012/02/23/ w inning-te ams-at-st ar tup-we ekendcluj-2012/ Cristina Juc cristinajuc@gmail.com

Organizer @ Startup Weekend Cluj

Cristina Tare

cristinatare@gmail.com Organizer @ Startup Weekend Cluj


entrepreneurship

TODAY SOFTWARE MAGAZINE

I

Science And Technology Meet Entrepreneurship

believe that disruptive technologies can solve the world’s major issues, and we aim to accelerate the development of an ecosystem dedicated to useful technological innovations. Hello Tomorrow brings together ambitious change-makers of all ages and disciplines, from science and technology to business and policy-making, by organizing an Interdisciplinary Community, a Global Tech Start-up Challenge, and an International Conference. Hello Tomorrow is a global non-profit initiative where science and technology meet entrepreneurship to build our tomorrow. We are calling on ambitious changemakers worldwide, who solve today’s problems in 6 Tracks, to take their projects to the next level and compete for empowering mentorship and over 400.000 dollar in prizes. (Deadline for applications: 28th of February 2015) • Food & Agriculture • Transport & Mobility • Materials & Manufacturing • Healthcare • Energy & Environment • Information Technologies

will be mentored by a dedicated expert in their field • Broad visibility: Participation in our annual conference in Paris, which will host rock-star speakers, showcase the most innovative technologies of our day, and finish with the grand finale of the competition. Last year we hosted Massimo Banzi, inventor and founder of Arduino, and Demis Hassabis, artificial intelligence guru & co-founder of DeepMind (Google) B2B contract opportunities: if they wish so, semi-finalists will have the opportunity to sign early B2B contracts with the most successful actors in their industry. Our goal is to turn ambitious innoCash: 7 finalists will win 15k EUR, and vators around the world into successful the grand winner will receive 100k EUR. entrepreneurs, accelerating the development of their creations and bringing them Requirements for entrants quickly to the marketplace. 1. < 250k EUR in money raised 2. < 2 years old

Paris. Apply now at http://hello-tomorrow.org ! (Deadline for applications: 28th of February 2015) For any further information, write to me at cluj@hello-tomorrow.org, follow us on Twitter https://twitter.com/HT_Cluj and on Facebook https://www.facebook. com/HelloTomorrowRomania.

What’s in it for our 30 semi-finalists?

Credibility and networking: startups 2015 Key Challenge Milestones: will be put in contact with world class I strongly believe there are Romanian investors, potential partners and clients, startups worth to be on the stage on the and other strong startups. Grand Finale on June 25! Who will accept my challenge and be there? Mentoring: a 3-month mentoring proI’m looking forward to show you the gram: according to stated needs, each team entrepreneurial and technology side of

Oana Călugăr

calugar.oana@gmail.com Ambassador în România @ Hello Tomorrow

Young spirit Mature organization A shared vision Join our journey! www.fortech.ro

www.todaysoftmag.com | no. 32/february, 2015

9


others

Registrul de Biciclete - a project for all cyclists in Romania

T

wo bikes stolen from close friends in the same week, a link received at the right time with a similar project in UK and a casual talk with friends over a coffee, were the three important steps that led to the birth of Registrul de Biciclete - an ambitious project that aims to discourage bike thieves and recover stolen bikes in Romania.

How does it work?

If your bike gets stolen

The project encourages cyclists to link their bikes to their names based on the frame number of each bike. It is also recommended to mark the registration through a tag applied on the frame that warns thieves that the bike belongs to a system and is therefore easier to track. After signing up on the website, the cyclist can proceed with the registration as follows:

How does it work? The project encourages cyclists to link their bikes to their names based on the frame number of each bike. It is also recommended to mark the registration through a tag applied on the frame that warns thieves that the bike belongs to a system and is therefore easier to track. After signing up on the website, the cyclist can proceed with the registration as follows:

1.Read the frame number

3. Fill in the bike’s details

10

2. Add relevant pictures

4. Apply an identification tag

Current status • We have over 4200 registered cyclists; • A network of 88 Info Points across the country; • Local partnerships with The Police Departments in Cluj Napoca and Prahova; • Steps taken to sign a stable partnership with the Romanian Police Force; • Support and visibility at the main cycling contests and festivals in the country; • Promotional materials in the main gathering places for cyclists; • Support and visibility at some of the most important sport, music and film festivals in the country;

1. You go online and change the status of your bike to “Stolen” leaving your contact details. 2. The bikes shows up in the “Stolen bikes” section with a nationwide reach 3. If the thief tries to sell the bike, any potential customer can go online and check the bike in the system before buying. 4. If the bike proves to be stolen, the potential customer will not only be dis- “Bike 2 Work” plan couraged to buy it, but he will also be Last autumn, together with JCI Cluj likely to contact the rightful owner and we set up “Bike 2 Work” the police, assuming responsibility. an initiative that is meant to encourage people to use a bike as a means of transport to work. We want to promote/encourage a better and faster collaboration between employees, Transfer function companies and local authorities in this A bike can be given away or sold to sense, in order to increase the safety of someone else through the “Transfer” func- cyclists and bicycles in general. tion available on the website. We elaborated two surveys - one addressed to companies and the other aimed to employees, to find out their perspective over using the bike, as a means of transport to work. Also, we had a cycling event to raise awareness over this matter which concluded with a few prizes offered to participants and an informative speech given by the Local Police.

no. 32/february, 2015 | www.todaysoftmag.com


TODAY SOFTWARE MAGAZINE We received approximately 40 answers For existing cyclists within the company Future plans from companies and 1000 from employees • Bike identification tags • Raise the critical mass of registered and we managed to conclude the following. • Discount cards to be used in local cyclists. bike shops • Sign a stable partnership with the Our proposal to companies • T-shirts, gear and other accessories Romanian Police Force. Like we stated earlier, we want to encopersonalized with the company’s identity • A mobile app for quick registration urage cycling at all levels and therefore we • Alternative theft-prevention systems + other useful functionalities. want to approach companies to make this (GPS trackers) • New, smart ways to protect bikes happen. There are multiple studies showfrom theft. ing the benefits of having a bike, both from For those who don’t have a bike yet • Consolidate the collaboration with an environmental and health perspective. Together with the bike shops which similar projects in Europe. We want to mention here statistical data support our project, we put together a • Promote cycling throughout compathat show that people who cycle regularly purchasing scheme, similar to others in nies, universities and other institutions. take 15% less sick days and also the fact Europe, such as Cycle Scheme that functhat companies improve their image and tions in UK that is meant to provide performance on the whole if they encou- employees with bikes. Starting from these rage their employees to do sports. models, we tried to adapt everything to We have an elaborated plan in this the romanian legal framework and we sense, putting forward a number of faci- came up with a few options that enable? lities that could be offered to employees in the purchase of bikes through a company. order to encourage them to use a bike. This This can be approached either as a persocan be seen either as an alternative to going nalized “fleet” of bikes and bike racks or as to the gym or as a means of transport to individual bikes chosen by each employee work. (the details of this plan can be discussed together with each company according to preferences).

Diana Silaghi

diana@registruldebiciclete.ro PR Manager @ Registrul de Biciclete

Our core competencies include:

Product Strategy

Product Development

Product Support

3Pillar Global, a product development partner creating software that accelerates speed to market in a content rich world, increasingly connected world. Our offerings are business focused, they drive real, tangible value.

www.3pillarglobal.com

www.todaysoftmag.ro | nr. 32/februarie, 2015

11


communities

IT Communities

W

e find ourselves in a time of the year that is full of big and quality events. TSM will try to take part in all of these events, inviting you to do the same. The new editions of MOBOS, ...even mammoths can be Agile, Cluj Innovation Days 2015 will surely attract new participants, besides the public that already knows them from the previous editions. We signal the presence of Neal Ford in Timisoara, executive and architect of ThoughtWorks, who will deliver a presentation within Software Architecture Day Timisoara. Transylvania Java User Group Community dedicated to Java technology Website: www.transylvania-jug.org Since: 15.05.2008 / Members: 598 / Events: 47 TSM Community Community built around Today Software Magazine Websites: www.facebook.com/todaysoftmag www.meetup.com/todaysoftmag www.youtube.com/todaysoftmag Since: 06.02.2012 /Members: 2168/ Events: 29 Cluj Business Analysts Comunity dedicated to business analysts Website: www.meetup.com/Business-Analysts-Cluj Since: 10.07.2013 / Members: 91 / Events: 8 Cluj Mobile Developers Community dedicated to mobile developers Website: www.meetup.com/Cluj-Mobile-Developers Since: 05.08.2011 / Members: 264 / Events: 17 The Cluj Napoca Agile Software Meetup Group Community dedicated to Agile methodology Website: www.agileworks.ro Since: 04.10.2010 / Members: 437 / Events: 93 Cluj Semantic WEB Meetup Community dedicated to semantic technology. Website: www.meetup.com/Cluj-Semantic-WEB Since: 08.05.2010 / Members: 192/ Events: 29 Romanian Association for Better Software Community dedicated to experienced developers Website: www.rabs.ro Since: 10.02.2011 / Members: 251/ Events: 14 Tabăra de testare Testers community from IT industry with monthly meetings Website: www.tabaradetestare.ro Since: 15.01.2012/Members: 1243/ Events: 107

12

no. 32/february, 2015 | www.todaysoftmag.com

Calendar February 18 (Cluj) Launch of issue 31 of Today Software Magazine www.todaysoftmag.ro February 19-20 (Cluj) MOBOS - recommended by TSM http://romobos.com/ February 18 (Iași) Open Hack Night meetup.com/Hackerspace-Iasi/events/220554784/ February 18 (Timișoara) Introduction to kdb+ meetup.com/Kx-Timisoara/events/220274397/ February 24 (Timișoara) Software Architecture Day Timișoara timisoara.softwarearchitectureday.ro February 28 (Cluj) Selenium Saturday t e c h a c a d e m y . r o / s c h e d u l e / february-workshop-selenium-saturday/ March 6 (Cluj) ...even mammoths can be Agile - recommended by TSM colorsinprojects.ro/eveniment-cluj-6-7-martie-2015 March 19-20 (Cluj) Cluj Innovation Days - recommended by TSM http://clujinnovationdays.com/ March 31(București) Mobile Advertising Congress conference-arena.com/mobile-advertising-congress


programming

Hands-On With The Watchkit SDK Creating A Navigation App

W

ith the appearance of the WatchKit SDK (https://developer.apple.com/watchkit/) a lot of iOS developers started experimenting with it and writing articles about the challenges faced during development.

Chertes Cristian

chertes.cristian@telenav.com

Following this trend, in this article we describe our first impression after tackling the WatchKit SDK head-on and the technical challenges encountered while creating a navigation enabled watch app using our Scout SDK1 .

iOS Developer @ Telenav

changed in the watch app interface while on the phone there are a lot of other customization possibilities (this might change in the next version of the WatchKit SDK) The user interface of the watch app can be updated through the extension running on the phone. The extension can communicate with the iWatch app through the declared outlets linked with the iWatch UI objects – all the logic behind the scenes is on the extension. Let’s get started to create our watch app:

Configuring your Xcode project

Korosi Csongor

korosi.csongor@telenav.com iOS Developer @ Telenav

Architecture of a Watch app

As you can see from the diagram below, a watch app has two parts: an extension which is running on the phone and the watch app which is running on the iWatch2. The watch app contains just the user interface of the app – a simple storyboard file and static images which are displayed in the Watch app’s user interface. The interface objects displayed on the watch are not UIView inherited objects, they are proxy objects inherited from the NSObject class. This means that no custom rendering and animations can be done on the watch. Currently, the customization of these objects is very limited compared with the UI objects used on an iPhone app. For example, only the text and the colour of a label can be 1 http://developer.skobbler.com/support#download 2 https://www.apple.com/watch/

1. For getting started with WatchKit you should have installed the 6.2 Beta version of Xcode. 2. To add a watch app target to an existing project add a new Watch App target (File -> New target) 3. Two new targets will be created.

One for the WatchKit extension and one for the Watch app. As you can see from the next screenshot, the Watch App target will include just a storyboard file and static images which will be displayed on the Watch app UI. The logic of the watch app will be implemented on the extension.

www.todaysoftmag.com | no. 32/february, 2015

13


programming Hands-On With The Watchkit SDK

WatchKitDemo:

4. Select the Watch app target and run the code. Make sure com.skobbler.WatchKitDemo WatchKitDemo WatchKit Extension: that one of the external displays of the simulator is selected. com.skobbler.WatchKitDemo.watchkitextension WatchKitDemo Watch App: com.skobbler.WatchKitDemo.watchapp

7. Select the Capabilities tab of the iOS & Watch app targets. Navigate to the App Groups section and enable it. You should see the following:

5. Before going to the next chapter, one more thing should be done. The communication between the iOS app and the WatchKit extension is possible only by using a shared file. 6. First of all, open the Identifiers section of member center on https://developer.apple.com. Select your app’s ID and enable the App Group option. After configuring the ID of the app make sure to regenerate the provisioning profile which uses this ID. Note: please use your own app id with enabled app groups. Return to Xcode and configure the bundle identifiers for each target based using the app id configured on the developer portal.

The WatchKitDemo application

First, a look at what the end result looks like:

https://www.dropbox.com/s/afngxdskl8l1390/WathKitDemo. mov?dl=0 The WatchKitDemo app starts navigation between two locations on the map, using the Scout SDK. With the app running on the watch and the extension and iPhone app on the smartphone, users can see visual advices and the distance to them. When the screen of the watch is tapped, an image of the map with the route and current position is shown. This image is updated every few milliseconds. The iPhone app and the extension communicate via a shared file. For this, developers must enable AppGroups in iTunes Connect and configure the bundle identifiers for each target. Because there is no API for directly communicating between the iPhone app and the extension we initially wanted to use a timer (NSTimer) to update the information displayed on the Watch every few milliseconds. The challenge here was that we were not notified when the shared file was modified. The workaround was to use a MMWormhole object. It notified both the app and the extension when the shared file is changed, so the timer was no longer needed. The MMWormhole object must be initialized both in the iPhone app and in the extension: self.wormHole = [[MMWormhole alloc] initWithAppl icationGroupIdentifier:@”group.WatchKitDemoGroup” optionalDirectory:nil];

To send and receive data between the app and the extension use:

14

no. 32/february, 2015 | www.todaysoftmag.com


TODAY SOFTWARE MAGAZINE //send message from the app to the extension [self.wormHole passMessageObject:imageData identifier:@”image”]; //listen for messages in the extension [self.wormHole listenForMessageWithIdentifier:@”image” listener:^(id messageObject) {}];

This app we created is a proof of concept of what a developer is able to do with the Scout SDK and the WatchKit SDK. A few scenarios that would be also possible: • display the map (demoed in the app) • show annotations • calculate and present routes • navigation (in the demo app you have an example of turn by turn navigation with visual advices) • perform & show search results • download map packages which can be used offline • display routes based on GPX files • draw polygons, circles or polylines on the map

• there is no public API for sending data from the iPhone app to the extension. The only solution is using a shared property list file that contains key-value pairs which can be accessed/ modified at the same time by the two participants. • the WatchKit SDK is not sending information about the orientation of the Watch. Hopefully the next version of the SDK will solve these problems.

The full demo project can be downloaded and reviewed from: http://www1.skobbler.com/iphonebuilds/20150116/ WatchKitDemo.zip

Summary & observations

• the WatchKit SDK is quite easy to use and well documented, as expected from a native Apple framework. The development of the WatchKitDemo app took only a single day, without any prior knowledge of the SDK. • one of the biggest weakness of the WatchKit SDK is that the iPhone app should run (foreground or background) while the iWatch app is running, because all the data comes from the iPhone app. We wanted to be able to use the watch app even in the absence of an iPhone.

www.todaysoftmag.ro | nr. 32/februarie, 2015

15


programming

JavaFX and RESTful Web Services communication

F

ollowing the article in the previous issue, we bring to your attention the creation of REST web services which interact with persistent data. To start with, we offer you an introduction into JAXB.

Silviu Dumitrescu

silviu.dumitrescu@accesa.eu Java Line Manager @ Accesa

Diana Bălan

Diana.Balan@accesa.eu Java developer @ Accesa

Java Architecture for XML Binding is a Java standard which defines the way in which the Java objects are converted into and from XML. It uses a collection of standard mappings and defines an API for the reading and writing of Java objects in and from XML. The following important annotations are used for JAXB: • @lR o ot E lement ( namesp ace = „namespace”), defines the root element of the XML arborescence, • @XmlType(propOrder = { „field2”, „field1”,.. }), allows defining the order in which the fields are written in the XML file, • @XmlElement(name = „newName”), defines the name of the XML element, in case we use a different name from the one in JavaBean.

this.name = name; }

public String getAuthor() { return author; }

Other annotations will be described directly in the code, as they show up. The first example is that of a stand alone application. The model of the object, which will be written in and respectively read from the XML file is given by the next piece of code: @XmlRootElement(name = „message”) // Mandatory @XmlType(propOrder = { „author”, „description”}) // Optional public class Message { private String name; private String author; @XmlElement( name = „description”) // Optional public String getName() { return name; } public void setName(String name) {

16

no. 32/2015, www.todaysoftmag.com

public void setAuthor( String author) { this.author = author; } }

We shall complicate a little bit the previous model, by wrapping it into another model: @XmlRootElement( namespace = „topic”) public class Topic { @XmlElementWrapper(


diverse

TODAY SOFTWARE MAGAZINE

name = „topicList”) // the name of the wrapper element

topicList.add(message2); Topic topics = new Topic(); topics.setTopicDescription(„about topic”); topics.setTopicList(topicLst);

@XmlElement(name = „message”) // the name of the collection // element private ArrayList<Message> topicList; private String topicDescription;

// create JAXB context and instantiate marshaller JAXBContext context = JAXBContext. newInstance(Topic.class);

public voidsetTopicList (ArrayList<Message> topicList) {

Marshaller m = context.createMarshaller(); m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);

}

this.topicList = topicList;

// Write to System.out m.marshal(topic, System.out);

public ArrayList<Message> getTopicList() { return topicList; }

// Write to File m.marshal(topic, new File(TOPIC_XML));

public String getTopicDescription() { return topicDescription; } public void setTopicDescription (String topicDescription) { }

this.topicDescription = }

topicDescription;

In the test application, we will create the XML file corresponding to the previous model and then we will read it.

}

// get variables from our xml file, created before System.out.println(); System.out.println(„Output: „); Unmarshaller um = context.createUnmarshaller(); Topic topic2 = (Topic) um.unmarshal(new FileReader( TOPIC_XML)); ArrayList<Message> list = topic2.getTopicList(); for (Message message : list) { System.out.println(„Message: „ + message.getName() + „ from „ + message.getAuthor()); } }

JAX-RS supports the automatic creation of XML and JSON files through JAXB. For this, in a Dynamic Web Project we will do the following settings:

RESTful CRUD (Create, Read, Update, Delete) Services

This type of services allows us to operate a list of created models, through HTTP calls. For the beginning, in a Dynamic web project, we will create a model and a singleton, which serves as a provider of data for the model. In order to define the singleton, we used the implementation based on enumeration.

public class TopicMain { private static final String TOPIC_XML = „./topic.xml”; public static void main(String[] args) throws JAXBException, IOException { ArrayList<Message> topicList = new ArrayList<Message>(); Message message1 = new Message(); message1.setName(„message 1”); message1.setAuthor(„Ion Ionescu”); topicList.add(message1); Message message2 = new Message(); message2.setName(„message 2”); message2.setAuthor(„Vasile Vasilescu”);

@XmlRootElement public class Todo { private String id; private String summary; private String description; public Todo() { } public Todo(String id, String summary) { this.id = id; this.summary = summary; } public String getId() { return id; } public void setId(String id) { this.id = id; } public String getSummary() { www.todaysoftmag.ro | nr. 32/februarie, 2015

17


programming JavaFX and RESTful Web Services communication }

return summary;

public void setSummary(String summary) { this.summary = summary; } public String getDescription() { return description; } public void setDescription(String description) { this.description = description; } } public enum TodoDao { instance; private Map<String, Todo> contentProvider = new HashMap<String, Todo>();

}

private TodoDao() { Todo todo = new Todo(„1”, „Learn REST”); todo.setDescription(„web service”); contentProvider.put(„1”, todo); todo = new Todo(„2”, „Do something”); todo.setDescription(„something else”); contentProvider.put(„2”, todo);

public Map<String, Todo> getModel() { return contentProvider; } }

The following classes will be used as REST resources:

public class TodoResource { @Context UriInfo uriInfo; @Context Request request; String id; public TodoResource(UriInfo uriInfo, Request request, String id) { this.uriInfo = uriInfo; this.request = request; this.id = id; } @GET @Produces(MediaType.TEXT_XML) public Todo getTodoHTML() { Todo todo = TodoDao.instance.getModel().get(id); if (todo == null) throw new RuntimeException(„Get: Todo with „ + id + „ not found”); return todo; } @PUT @Consumes(MediaType.APPLICATION_XML) public Response putTodo(JAXBElement<Todo> todo) { Todo c = todo.getValue(); return putAndGetResponse(c); } @DELETE public void deleteTodo() { Todo c = TodoDao.instance.getModel().remove(id); if (c == null) throw new RuntimeException(„Delete: Todo with „ + id + „ not found”); } private Response putAndGetResponse(Todo todo) { Response res; if (TodoDao.instance.getModel().containsKey( todo.getId())) { res = Response.noContent().build(); } else { res = Response.created(uriInfo.getAbsolutePath()) .build(); } TodoDao.instance.getModel().put(todo.getId(), todo); return res; }

18

no. 32/february, 2015 | www.todaysoftmag.com

} @Path(„/todos”) public class TodosResource { @Context UriInfo uriInfo; @Context Request request; @GET @Produces(MediaType.TEXT_XML) public List<Todo> getTodosBrowser() { List<Todo> todos = new ArrayList<Todo>(); todos.addAll(TodoDao.instance.getModel().values()); return todos; } @GET @Path(„count”) @Produces(MediaType.TEXT_PLAIN) public String getCount() { int count = TodoDao.instance.getModel().size(); return String.valueOf(count); } @POST @Produces(MediaType.TEXT_HTML) @Consumes(MediaType.APPLICATION_FORM_URLENCODED) public void newTodo(@FormParam(„id”) String id, @FormParam(„summary”) String summary, @FormParam(„description”) String description, @Context HttpServletResponse servletResponse) throws IOException { Todo todo = new Todo(id, summary); if (description != null) { todo.setDescription(description); } TodoDao.instance.getModel().put(id, todo); servletResponse.sendRedirect(„../create_todo.html”); } @Path(„{todo}”) // Defines that the next path parameter after todos public TodoResource getTodo(@PathParam(„todo”) String id) { return new TodoResource(uriInfo, request, id); } }

In the TodosResource class, we have used the annotation @ PathParam to define the fact that the id is inserted as a parameter. Running the application can be done in several ways: • In the browser, on the address: http://localhost:8080/ CRUDRest/jaxrs/todos/ • By using a html form. We can introduce the data by running the create_toto.html file. <!DOCTYPE html PUBLIC „-//W3C//DTD HTML 4.01 Transitional//EN” „http://www.w3.org/TR/html4/loose.dtd”> <html> <head> <title>Form to create a new resource</title> </head> <body> <form action=”../CRUDRest/jaxrs/todos” method=”POST”> <label for=”id”>ID</label> <input name=”id” /> <br /> <label for=”summary”>Summary</label> <input name=”summary” /> <br /> Description: <TEXTAREA NAME=”description” COLS=40 ROWS=6> </TEXTAREA> <br /> <input type=”submit” value=”Submit” /> </form> </body> </html>

• On the address http://localhost:8080/CRUDRest/jaxrs/ todos/count, we will count the todo items. • On the address http://localhost:8080/CRUDRest/jaxrs/ todos/1, we will visualize the todo having 1 as an id. For an


TODAY SOFTWARE MAGAZINE non-existent id, we will have a HTTP error. We can create the following client application:

We end this article with the steps to be followed when generating a REST web service: • Checking the following conditions: • Jersey has been added to the project. • JAX-RS API has been added to the project. • A model of the application has been created and so have been the pertaining entity classes. • The connection pool and the JDBC data source have been created on the Glassfish server. • The persistency unit has been created and set up in the project. • The JAXB annotations have been added to the JPA entity classes. • The actual generation of the web services: • Creation of REST services in the entity classes. • Validation of the generated web service classes. • Validation of the set up in the web.xml file. The JAXB annotations will be added directly to the JAXB entity classes. The services are generated as an EJB session facade. When we are testing a web service, we need to take the following into consideration: • The URL address correctly represents the endpoint of the deployed service and the annotations of the method. • The GET, PUT, DELETE or POST requests call the proper methods of the service. • The methods return the expected data.

public class Main { public static void main(String[] args) { ClientConfig config = new DefaultClientConfig(); Client client = Client.create(config); WebResource service = client.resource(getBaseURI()); Todo todo = new Todo(„3”, „Blabla”); ClientResponse response = service.path(„jaxrs”) .path(„todos”).path(todo.getId()).accept(MediaType. APPLICATION_XML).put(ClientResponse.class, todo); System.out.println(response.getStatus()); // Return code should be 201 == created resource System.out.println(service.path(„jaxrs”) .path(„todos”).accept(MediaType.TEXT_XML) .get(String.class));

Steps to take in order to develop a client of the REST web service: • Making sure the project has all the necessary libraries added. • Identifying the GUI window and checking the place where the results of calling the web service will be displayed. • The following information is useful for the development of the client: the URL of the service, the name of the package and the class where the client code will be generated. • Calling the code in the GUI window. We hope you have enjoyed reading this article and we are looking forward to your questions!

// Create a Todo Form form = new Form(); form.add(„id”, „4”); form.add(„summary”, „Demonstration of the client lib for forms”); response = service.path(„rest”).path(„todos”) .type(MediaType.APPLICATION_FORM_URLENCODED) .post(ClientResponse.class, form); System.out.println(„Form response „ + response .getEntity(String.class)); System.out.println(service.path(„jaxrs”) .path(„todos”) .accept(MediaType.TEXT_XML).get(String.class)); } private static URI getBaseURI() { return UriBuilder.fromUri( „http://localhost:8080/CRUDRest”).build(); } }

www.todaysoftmag.ro | nr. 32/februarie, 2015

19


programming

Non-invasive technological solutions applied to the medical field (Kinect)

I

t’s really amazing how much the role of technology has increased in the past 10 years. Nowadays, technology promises to bring an answer to many of our questions. If you ask yourself why, the answer is pretty obvious: we live in an age where we have to deal with and work with a huge quantity of data and the results must be fast and very accurate.

The medical field is not an exception. Doctors and researchers start turning to technology for solutions in improving or replacing existing procedures. From blood analysis to brain surgery, everything is supervised and guided by software products or hardware devices specially created for this purpose. The material and intellectual investment required for the development of such solutions is tremendous and it’s not easily accessible to every programmer. But luckily, despite many techies not paying much attention to it, the gadget market has been developing a lot and it started offering many high potential, relatively cheap solutions for many problems. My statement regarding the low-key nature of this new market is not a random one: almost all the progress registered in this domain has been focused on developing games and gaming applications or on making these games as accessible and user-friendly as possible. Developers have created all sorts of playful sensors, one more interesting and more captivating than the last, but all having the same main purpose: to make the experience of the user as pleasant as possible, whether this experience takes places in a virtual environment or a real one. I will not go

20

through all the gadgets that are out there; instead, I will focus on Microsoft Kinect. Kinect is a device that comes together with the Xbox (360 or One) and it is actually a video camera, complete with a sensor that is able to detect body movement. Its purpose is obviously oriented towards the gaming industry. But how does it actually work? The sensor from the camera creates a depth map with the help of the infra-red rays; these rays help determine the distance from the camera to the object in front of it. The resulting depth map helps identify the 20 main points of the skeleton which will be used to reproduce the individual movements of the body. This sensor is able to detect motion starting from 0.7 meters and going as far as 6 meters, under the condition that the light in the room is a natural one (although this aspect is no longer a problem for Kinect One, as Microsoft has stated). Moreover, the sensor is able to recognize and map approximately 100 points at face level, which is extremely important because there are very few devices that are able to do this and that come at such a convenient price. If you are wondering how we managed to bring Microsoft Kinect and medicine together, the following story will shed light on the whole “affair”. My colleagues, Rares Urdea and Bogdan Pop, and I, coordinated by our teacher, Dan Mircea Suciu, managed to bridge this gap together. More than a year ago, we decided to go for the win in a contest called Imagine Cup. This is one of the most prestigious contests from the field of software development, organized solely for high-school and college students. The only problem was that, even after hours and hours of thinking and brainstorming, we still couldn’t find an

no. 32/february, 2015 | www.todaysoftmag.com

idea that would take us to the finals. Our teacher however, who had already won this competition in the past, came up with the idea of connecting Kinect and the medical field. This is how sMilestone was born. sMilestone is an application meant to aid patients suffering from different types of facial paralysis regain the control of their facial muscles. More precisely, the games from the app can replace the often uncomfortable exercises that the patients go through during their recovery therapy sessions. The games manage to capture the patients’ attention much more easily and in a more fun way. Moreover, the app makes it possible for physicians and therapists to measure a patient’s progress more easily and to obtain more accurate data and statistics. Another advantage of this solution is that the therapist can assist more patients at the same time and, most importantly, this is a non-invasive procedure. By using the sensor’s ability to detect the main facial points, we’ve created algorithms corresponding to the exercises performed by the patient during a therapy session. To provide some examples, the game Snake from the sMilestone application allows its user to control the snake through 2 simple lip moves: a smile to go right and


programare an open mouth to go left. This way, instead of asking the patient to simply perform these actions in front of a mirror, exercising becomes a lot more fun and captivating since timing and keeping a score are involved. The algorithm behind the detection of these moves is based on calculating the distance between two pairs of points: 60-64 (the corners of the mouth) for the smile, 62-66 (upper and lower lips) for opening the mouth. The moment the game begins, the algorithm determines the neutral position by calculating the initial position between the two sets of points. After that, depending on how much the pairs of points distance themselves from their initial position (this distance varies from patient to patient given that each patient is in a different stage of recovery), the algorithm “decides” whether the expression produced by the patient is a smile or an open mouth. Of course, this algorithm is also responsible for keeping track of the scores and records. For exercises of this type, the sensor and the SDK from Kinect offer us everything we need. But the biggest challenge my colleagues and I faced was creating an algorithm that would be able to detect the

TODAY SOFTWARE MAGAZINE movement of the tongue. This was almost unconceivable, especially since our solution didn’t involve sticking sensors on the patient’s skin. After several attempts, we managed to create an optimal and unexpectedly efficient algorithm. Setting a limit for the surface that must be processed, more precisely the area of the mouth and using the depth map we managed to isolate the tip of the tongue. This way, when the patient sticks out his tongue, the sensors isolate the tip of the tongue and we use it to detect its moves. Isolating the tip of the tongue is possible due to the depth map, which is created according to the distance of the objects relative to Kinect, calculated in millimeters. When the patient sticks out his tongue, its tip is the closest point to the sensor and this is how the algorithm can determine that we are dealing with the movement of the tongue (see image).

some changes so that sMilestone allows its user to control the app’s menu with the help of his tongue. This is the tweak that allowed us to get to the finals. As you’ve read so far, Kinect’s SDK comes with a full package of libraries for capturing the movements of the body or face. It also includes the support for voice recognition, which I must confess is pretty detailed and a more thorough discussion about it would require another article. I can also tell you that, for the time being, its biggest support is in English given that the main beneficiary is the gaming industry. But it is the perfect candidate for facilitating the therapy of the patients who are in a more advanced stage of the recovery process (to be more precise, it is for the patients who can already practice pronouncing sounds and words). To sum things up, I hope I’ve made you curious about this device and I wish that you would also try to “toy” with the functions of Kinect so that, in the future, you too could try and create something as impactful and as helpful. All I can tell you is that it is extremely satisfying to know that you can help people by doing what you love most.

Mursa Bogdan

mursa.bogdan@yardi.com

After this, the possibilities became almost unlimited. After creating Dots, a game that allows the patient to duck the balls chaotically directed at him by moving his ball using the tip of his tongue, we made

Software Developer @ Yardi

Objective C

jobs-cluj@yardi.com Yardi Romania

www.todaysoftmag.ro | nr. 32/februarie, 2015

21


management

management

Dynamics of Agile Coaching

A

few months ago, I participated in the Berlin Scrum Gathering organized by Scrum Alliance, where I discovered that there are many organizations which dedicate a lot of time to mentality change. They have adopted an agile mindset as an answer to a fast changing environment, with fast changing customer needs, in which a few lost moments can result in a lot of unnecessary work. Călin-Vlad GĂŽngă

calin.ginga@isdc.eu

Software developer @ ISDC

22

no. 32/2015, www.todaysoftmag.com

When we talk about Agile, we talk about a mindset, about being able to react in time to change, about a group of methodologies based on incremental, iterative development and about close cooperation between team members with cross functional expertise. Discussing with some of the people from the organizations I have mentioned before, I came to the conclusion that each of them came with a set of problems and challenges that they were dealing with or have dealt with during the change process. Some of the organizations were in an early stage and they needed an insight regarding the core principles of the agile mentality, others were already on a clear path and just needed counseling. The question that I asked myself was how can an agile coach find a way to channel relevant information depending on the level the client is at? The answer to my question was given by Ken Power, who talked during the conference about different entities and dynamics an agile coach can approach when presenting the aspects of an agile mentality in an organization. Depending on the needs of the client, an agile coach needs to adapt his/her way of sharing the information. These entities are determined by the customer orientation which can be focused on results or knowledge gaining. It

results in a number of nine entities which are: coach, counselor, facilitator, hands-on expert, modeler, partner, reflective observer, teacher and technical adviser.

Figure 1

Reflective Observer

The purpose of the reflective observer is to take part in day to day team activities, observe and comment based on what he/she sees. His/her main focus should be team events such as daily stand-ups, sprint planning, retrospectives, sprint review or the collaboration between team members. Without being intrusive, the observer can also view general interactions during lunch breaks and then comment on how team members communicate, talk or listen to each other. By doing all the things above, the reflective observer can detect any possible problem that can arise in any working environment and come up with solutions that can handle and fix them.


TODAY SOFTWARE MAGAZINE Technical Adviser

One of the most common entities when it comes to agile coaching is the technical adviser. In our jobs it is critical to give and receive advice in order to avoid spending time on problems that should be resolved quickly. What differentiates this role from some of the others is the fact that, in order to give advice, you need to have a starting point. In our particular case, when we are talking about agile mindset in an organization, the client knows what he wants but he just needs a second opinion. For this type of relationship to work, the client needs to be open minded and have a clear vision of the problem he is facing. Also, he should be willing to explain in detail what the solutions he came up with are. In the other corner, the technical adviser needs to be able to ask the right questions at the right time. By doing so, there is a chance that the client will become sure of a solution without having to actually hear the advice. Lately, this type of approach is used in many organizations or at gatherings, one example being the Coaches Clinic which is a big success at Scrum Gatherings. In these clinics a 15 minutes discussion is enough for any person to receive some advice regarding a problem. If we do not find at least one piece of advice in this time, then maybe the person helping us should not be a technical adviser but one of the other entities/roles described above.

Hands-on Expert

As the name suggests, the hands-on expert is the one who knows where the problem is and how it needs to be solved. After analyzing the situation, he will know what measures have to be taken for everything to run smoothly within the agile organization. There are many ways to do this. For example: act as a Scrum Master for one or more sprints, do pair programming with developers, choose the

tools that will be used by the team. Being the person who has expertise in this particular area, he will know about the urgency of certain things and will have the ability to create a plan and decide on the first steps and on the direction. This can also mean being involved in the hiring process if the situation allows it.

with the whole organization and for this to be done in the most effective way he needs to present all good practices that the client can apply without judging and without having diverse opinions or interpretations. There are many ways a teacher can share knowledge, some of them being seminars or workshops on a specific topic regarding agile, methodology training like Facilitator XP practices or SCRUM or even 1-on-1 A facilitator will be very useful when teaching for e.g. Scrum Masters. the company is at the beginning of their transition to an agile mindset. A facilitator Modeler is someone who helps a group of people A modeler is the person brought into understand their common objectives and an organization with the purpose of being assist them to plan how to achieve these a role model. If the hands-on expert was objectives . He needs to keep a neutral there to be a Scrum Master in a sprint in position in any situation. The presence of order to get things going, the modeler will a facilitator is needed during the explora- be the Scrum Master in the sprint and then tion of issues that can occur when a group somebody else will do the same thing as he is informed of any major decision. The did in the following sprints. The modeler facilitator will create the perfect context needs to customize his/her role depending and environment and he will assure that on the client’s needs and needs to focus the discussion does not lose focus. He will only on the solution. After finding the make sure that every involved party will perfect way to approach a problem he will get the chance to speak. go ahead and solve it, leaving the client to In order to maximize the benefits of acquire the knowledge over time. the relationship, the client needs to trust If the modeler is brought to resolve the facilitator. This can represent a pro- a problem within the team, he can take blem when trying to resolve a 1-on-1 or part with a given role of developer, tester, group conflict, or when trying to facilitate manager etc. He will act as an example in a problem-solving session. In respect to any given situation. SCRUM for example, a facilitator can be the person who moderates a retrospective Counselor as this is a critical ceremony in the life of an As the name suggests, a counselor is agile team. By making sure that everybody there to provide counsel, advice and to gets a chance to express their concerns and present all the possible options. The clibeliefs during the first retrospective mee- ent will have to take the decisions and be ting, the facilitator will help the team to accountable for the outcome. The counboost its confidence. selor cannot be blamed for any negative aspects of the resolution and he cannot Teacher take credit for a good solution. A counseTogether with the hands-on expert lor is there to actively listen to the problem and the modeler, the teacher has a vast and explain it and point out all the aspects knowledge of what needs to be expressed that need attention. when discussing about agility. The purpose of the teacher is to share all that he knows

www.todaysoftmag.ro | nr. 32/februarie, 2015

23


management Dynamics of Agile Coaching Coach

Probably the most common name for an agile expert is coach. An agile coach is seen as the person who can be brought into a company in order to teach, adjust, present or discuss about agility. In reality a coach does not need to teach anybody anything. The role of a coach is to suggest solutions after a preliminary analysis. A coach will get the client out of his/her comfort zone and, in order for this to work the client should also want to improve himself/herself. He/she will provide solutions, will offer support, but the client will choose what to do. After this, the coach will provide feedback. As for agility, we can expect from a coach to provide management and organization with different options to achieve it.

Partner

When an agile knowledgeable person is brought into a company as a partner, the two parties start with the mentality that “they are in this together”. One’s success is the other’s success and vice versa. Of course, this is the same for failure. During the partnership the two parties will learn from each other and will share ownership of goals, risks, vision and culture. In this particular approach, the partner will also be involved as a stakeholder in all decision making, meetings and gatherings, and they need to stay positive that their vision is compatible and that they will always consider win-win situations and approaches.

IDAM Advisory

In ISDC we have a group of specialists, called IDAM (ISDC Defined Agile Model), who are involved in the development of an agile methodology, based on Scrum, which

24

is modified, tailored and modeled in order to be the most efficient in our environment, culture and organization. One of our most successful projects is the IDAM Advisory program which combines some of the entities which were presented in the article. Most of the times, we assist at meetings and team related activities for a given period of time, observing and analyzing the behavior of team members and their reaction in respect to problems and solutions. Thinking of the nine entities, this would be consistent with a reflective observer. After this analysis, we have one on one or group discussions with all the members of the team and, together, we find solutions for every identified problem. The activities are representative for the technical adviser. After these moments have passed and solutions have been found and implemented, teams want and need to get better and more efficient. This is the moment where we take the role of an agile coach. The three entities or roles that we play within our organization are what we need and are suitable for us. This way we can make sure that we focus on resolving the real problems that we are faced with and we do not waste time. Based on what I have expressed before, I would like to come back to the main idea of this article which is how to share knowledge about agile methodologies and mindset within an organization. I consider that each company needs to make a thorough analysis of its current situation and identify its main needs. Once this stage is successfully completed, an agile knowledgeable person can come and present the agile concepts in a way the organization can benefit from.

no. 32/february, 2015 | www.todaysoftmag.com

If we are on the other side of the discussion and we are the ones sharing the knowledge, then we need to find the most appropriate way to do so. We need to be sure that our message will be clear and useful. Now we know that, depending on the situation, we need to teach, give advice, facilitate or model in order to reach an objective.


management

programare

As a Business Analyst, I want to help the SCRUM team, so that the project is delivered

B

A responsibilities in an Agile environment in software development are a popular subject. In this article we will discuss a part of it, trying to answer the question: ‘How can a BA contribute to the delivery of a software project, in a SCRUM team?’.

Liviu Ştefăniţă Baiu

liviu.baiu@endava.com Senior Business Consultant @ Endava

To narrow even more the subject of this article, we will discuss only about the way a BA can help the SCRUM team in an outsourcing software company. This niche allows us to ‘open the path’ for discussions, with the starting point described in this article.

BA in our team? What is it good for?

One of the most common first reactions is the one described above. What is a BA good for? The SCRUM Team has a PO – usually on customer’s side –, a Scrum Master, a PM, and a backlog. Thus, everything’s in place, we have the object of the work, we have the roles that coordinate the work, and we have a role to report to, responsible for the final product.

So, where will the BA fit in? Which needs are addressed by this position?

The BA is already there, although not in person, but in responsibilities and attributions. The BA responsibilities are fulfilled by different persons according to the situation – some by senior developer / QA engineer,

some by the PM / SM, some by the PO. This addresses the ‘fit in’ part. But taking some responsibilities from a TEAM member can be a hard task, for an extern. What can be done? For starters, the BA must earn the trust of the team. In order to earn it, he must know how the team works – not from the perspective of methodology, but from its internal relations and processes. Discussions with the senior members of the team, both developers and QA engineers, about the project, openness, self-study about the business domain, understanding the needs of an active company in that field, learning the customer’s particularities along with the ‘classic’ attributes of a BA (communication skills, methodology knowledge, attention to details, etc.) can be used to increase the level of trust in the BA-SCRUM team relationship. Secondly, the BA must identify and address the pain points of the project, below are some of the most frequent: • Processes within the project; • Documentation (outdated or not

www.todaysoftmag.com | no. 32/february, 2015

25


management As a Business Analyst, I want to help the SCRUM team present); • Relation with the stakeholders; • Backlog; • Repetitive issues – requirements unclear, incomplete specifications / design; • Awareness. Last but not least, attitude. A BA can be successful in the integration task if, and only if, she/he lets the team members know that she/he appreciates the effort they put into the product, the knowledge they have about it, and is willing to put the pieces together in order to make things better for the team. As a first conclusion, a BA can: • reduce the pressure within the team by narrowing the range of responsibilities for the senior members of the team, SM, PM and even PO; • Improve the work environment and the tools usage.

after that, must try to propose small changes (biggest impact on the team – first). This will address the team integration effort and increase the trust level of both the team and customer. The BA can use diagramming tools (such as Visio), Office suites (Microsoft, Open, Libre). BA can also improve customer organization’s processes in the later phases of his assignment, after she/he gained enough influence and trust from the PO and stakeholders.

Documentation

The BA, using the previous experiences, should be able to learn quickly the new tools, if needed, or propose the ones he knew. As mentioned above, the BA can improve various aspects of the project and work.

The documentation for a project has almost always aspects to be improved, such as structure, updates, integration with the processes and tools, accessibility. In order to improve documentation, the BA should analyze the current state, and then propose solutions. The solutions can be: central repository (subversion folder or wiki) with cross references to task tracking tools, task tracking tools issues description: Atlassian Confluence, SharePoint, Github, Atlassian JIRA, VersionOne. The documents themselves can be created with aforementioned Office suites. Of course the extremes can be no documentation and just-enough documentation, but there is always room for improvement.

Processes

Relation with the stakeholders

This might be an issue in any organization, because most of the times, the processes within the team are a mix between the internal and customer’s processes, and usually the mix is not a good solution. The BA must understand the reasoning behind the process approach, and

In order to improve this aspect of the project, several pre-requisites must be fulfilled. The BA must know who the stakeholders are, must identify the channels of communication with them, and must be empowered to do it. The foundation for this comprises in

Which are the BA instruments for integrating in the team?

26

no. 32/february, 2015 | www.todaysoftmag.com

stakeholders RACI / RASCI (ResponsibleAccount able-C onsu lte d-Infor me d/ Responsible-Accountable-SupportC onsu lte d - In for m e d ) m at r i x an d communication plan, created or assessed by BA.

Backlog The team and product backlog are sensitive areas because they include the inherited (thus hard to change) habits and procedures. They must be addressed with caution and any change should be backed up by solid arguments and reasoning. Alignment with the methodology, consistence, structure, clarity and content improvement for the Epics, User Stories, and Tasks as well as for their corresponding specifications are aspects that must be taken into consideration and used as arguments for any proposed change.

Repetitive issues –unclear requirements, incomplete specifications / design One of the positive challenges for the BA in a new project consists in the lack of clarity in the requirements, in absence of specifications and design. The BA can use one of the tools from a large palette of tools for creating mock-ups and rough UI designs, such as Balsamiq, moqups, Just in Mind (for creating prototypes and mock-ups), Photoshop, Paint. Net, Gimp (for UI designs). While using this, there are some factors that must be taken into consideration, such as: the current UI style guide for the application, the stakeholder for UI on customer’s side (PO, UI designer, UX designer). One of the most powerful tools in a BA portfolio is the ability to identify the User


TODAY SOFTWARE MAGAZINE Stories that require such details and refine added value for the project and for the custhem with the PO, and then present them tomer organization. to the team. The feedback on this article is appreciated and will be considered as input for the Awareness future articles about the benefits of having The team should be informed about a BA in an outsourcing SCRUM project. the important changes that occur in the client’s organization, about the plan for the future. This is a way to make everybody in the team aware of the importance they have for the product and take pride in their work, as well as a step to gain the trust of the team. Presentations, regular interactions, ad-hoc discussions are powerful tools for building the awareness of the team.

Conclusions

As seen above, the BA has a wide range of opportunities for integration in a SCRUM team, as she/he masters the aforementioned set of tools and skills. She/he can influence both the team and the customer, internal and external processes, SCRUM artefacts and historical documents The integration in the team is just the first step of the BA contribution to the team added value, as well as one of the early stages of her/his contribution to the

www.todaysoftmag.ro | nr. 32/februarie, 2015

27


programming

4 Ideas To Apply For Better Software Design

S

oftware design is all the rage now. It looks like every year a few more design ideas appear. First there were the GoF design patterns. Now, MVC is the way to do web applications, while ideas like: domain driven design, ports and adapters, microservices see increase interest and adoption.

Alexandru Bolboacă

alex.bolboaca@mozaicworks.com Agile Coach and Trainer, with a focus on technical practices @Mozaic Works

I learned software design by doing, with a mentor who kept giving me very useful (and sometimes annoying) feedback. This was before I knew about design patterns, SOLID principles or TDD. Therefore, my understanding of design starts from the core laws of software design. That’s why, when my colleagues or I work with developers, we teach them not only design patterns and SOLID principles, but also a way to think about design. Here are 4 ideas you should consider when you make a design decision (that is, every time you write a function, class or module) to get better software design:

1. Every Design Decision Has Advantages And Disadvantages

When doing architecture and design exercises, such as Architectural Kata, Code Retreats or one of the software design workshops, I ask participants to create a design, either by writing some code or drawing a diagram. We then discuss and give feedback to their solution. Often, a participant asks me to give the “best solution” for the problem. The unexpected answer is that there is no such thing. The reality is that any software design decision has advantages and disadvantages. After all, think about all the characteristics of a good design. Here’s a list I compiled from the top of my head: • Fast to implement • Easy to change • Easy to find issues • Secure • Fast • Scalable • Reduces the chance for mistakes

28

no. 32/2015, www.todaysoftmag.com

• [add yours here] It is impossible to write code that gets a 10/10 for all these criteria at once. That’s why we have the catchphrase “quick and dirty” instead of “quick and fast and scalable and without bugs and easy to change and …”. The important question becomes then: for what of the criteria is acceptable to get a 8/10, 6/10 or 4/10 in your particular context. This translates to a “most fit” solution for a certain context; it will probably not look like the “best solution” you were thinking of. Here’s a personal story to support this fact. When I was developing in C#, I discovered that I could use delegates as lambda expressions, thus reducing the number of lines of code I had to write. I resisted the temptation because my colleagues would find this code construct confusing, so it increased chance of making mistakes. I could also have tried to teach them this way of writing code, but I wasn’t that good at training people back then. All in all, it was a conscious decision for the best of the project. I have two ways of identifying advantages and disadvantages so that we get better software design. Whenever we evaluate potential solutions for a problem, we either: 1. List the alternatives, list the advantages and disadvantages of each of them and then make a conscious choice for one of the solutions. 2. Experiment: start implementing one of the solutions, being ready to throw it away or change course if it’s not good enough


programare This process doesn’t have to take a long time. Usually 30’ is more than enough for the first option, and a maximum of 2 hours for the second. After some practice, you will start doing it automatically for most decisions. If there’s one thing you take out of this law, this should be it: To make better software design, be mindful about the advantages and disadvantages of the solution you choose. Reflection question: what are the disadvantages of the class you’re working on? What could go wrong?

2. Developers Are The Users Of The Software Design

Whenever we talk about design in other domains than software, we discuss it from a user-centric point of view. Apple’s products are renowned because they focus on the experience of a user with their device: how it feels, how it looks, how fast it responds, the sounds it makes etc. Software design is the only type of design that seems to be userless. After all, the end-user has no idea how the software works and doesn’t care. All they do care about is to work fine. So why should we care about the internal structure of software? There are very good economical reasons to do so. If software is not easy to change, developers won’t add features fast, resulting in potential loss of customers. If the structure of the software is not organized properly, more bugs could appear, potentially annoying the customers and requiring many hours of digging through the code to fix them, thus increasing maintenance costs. These are not new problems. Initial designs for many things we now use everyday were poor, and they improved in time. How? The key is to listen to user feedback. In our team, Claudia works full-time while I work part-time on an eHealth product. Besides my development tasks, I serve as a mentor, coach and help her with more difficult decisions. One of my recurrent questions is: “So, what was difficult to change in the past two weeks?”. Based on this question, we heavily improved the changeability of the code in the areas that change the most. Software design is not userless. The user is the developer that will have to change the code after you do. If you have collective code ownership (like most Scrum teams these days), you’d better consider user-centric software design.

TODAY SOFTWARE MAGAZINE And here’s an idea for you: how about running usability tests on your software design to cut the development costs? Let me know if you want to experiment, I can help. To make better software design, look at it from the other developers’ point of view. Reflection question: What are some common complaints of your team mates related to the code? What is difficult to change? How could you make it easier?

what you’re reading and what the application is doing. This leads to reduced productivity, getting tired and, sometimes, swearing. There is no way we know at this time to eliminate this distance between the knowledge and the code. It can however be reduced much by iterating through the continuum of names. One word of advice: you will find it very difficult at first, but it gets easier with practice. To make better software design, name the classes, methods and variables as close 3. Names Matter Much More Than You to the business domain as possible. Think Reflection question: What does your Software is unique in that it doesn’t application do? What are some names parexist outside your brain, but you can ticular to its business? Are they present in interact with its results. OK, I might be code? stretching it a bit here, but consider this: software is executable knowledge. When 4. Conceptual Integrity Is The Lost Princiyou’re writing an accounting application ple Of Good Software Design for example, it encodes everything to know 40 years ago, Fred Brooks wrote a semiabout the rules and procedures of accoun- nal book for software development called ting. How did that knowledge end up in “The Mythical Man Month”. The book the application? By going from specialists contains many essential findings about through developer brains into code. software development and engineering (An aside remark is that the two cha- that most people working in the industry racteristics that differentiate developers don’t know and don’t apply because they from the rest of the world is that they haven’t read it. understand computers and can think with a very high level of precision. This is why I The most important design idea from don’t believe in visual programming done the book is the following: by specialists.) I will contend that conceptual integrity is How do humans learn and structure the most important consideration in system knowledge? By naming things. If you think design. It is better to have a system omit cerabout your school years, you remember tain anomalous features and improvements, learning about numbers, arithmetic ope- but to reflect one set of design ideas, than to rations, multiplication table etc. These are have one that contains many good but indeall names given to certain concepts, names pendent and uncoordinated ideas. that help us communicate with each other – Fred Brooks, The Mythical Man about complex ideas. Month I invite you now to take a short break and write some of the class, methods and variable names you find in the code you’re working on. Then write down what the application does. We’ll wait. Ready? OK, now count how many of the names match the application domain. Or, even better, ask someone who doesn’t know what you’re working on to guess what the application does based solely on the list of names. If they did guess, then please contact me because I want to learn from you how you do it. This test shows a typical disconnect between what the application does and how developers structure this knowledge in the code. Why is this bad? Because your brain will need to spend some valuable cycle times trying to translate between

Ward Cunningham’s wiki page on the topic gives the following examples of conceptual integrity: Can we identify specific, well-known examples of ConceptualIntegrity? I’m starting a list here… please feel free to make additions • Unix (based on the notion of a “file” (e.g. directories, devices, filesystems, named pipes and sockets are all sort-of files) • Smalltalk (“everything is an object”, and the small set of other accompanying principles) • SQL (“all data is in tables”, with keys and constraints) • Lisp (“everything is a list”) Why is conceptual integrity useful?

www.todaysoftmag.ro | nr. 32/februarie, 2015

29


programming 4 Ideas To Apply For Better Software Design Probably because how our brains work. The human working memory is limited to keeping four items in parallel, but there’s a catch: each item can actually be a set of related concepts (a so-called chunk). When you have to make difficult design decisions, it’s easy to imagine that you need to consider more than four things at the same time. It helps if they are similar, because the brain can chunk them, allowing you to make more informed design decisions. You can apply conceptual integrity at different levels, from variables, methods to classes. For example, let’s make the following test. Write down the names of a few classes and the names of all their public methods. Show the class interface to someone who doesn’t know what you’re working on and ask them what the class does. Ask them if there’s anything that seems out-of-place from that class. If they guess and everything fits, congratulations: you have achieved conceptual integrity at class level. Now do the same exercise at namespace and module level, showing only the public interface of the module. At system level, things become more complex. Ports and adapters and microservices are some of the patterns that make

30

easier to bring conceptual integrity at The not-to-be-missed event in Central system level. But the lunch isn’t free, each and Eastern Europe for software craftsof them has disadvantages (remember the manship - http://itakeunconf.com first tip ). A word of warning: conceptual integrity is very hard to meet, harder than good names. However, I can tell you from experience that when you do make it, it is not only very useful but also beautiful. In a world filled with bugs and ugly code, beauty can do wonders for your moral. To make better software design, strive for conceptual integrity at class, namespace, module and system level. Reflection question: What parts of your application have conceptual integrity? Pick a class you’re working on; how can you bring it closer to conceptual integrity? Want to learn more about software design and architecture? Interested in the latest practices in IT software industry like: DevOps, Microservices, Technical Leadership, Technical Strategy, etc.? This May, 28-29, attend I T.A.K.E. Unconference to be part of European community of software craftsmen and experienced practitioners.

no. 32/february, 2015 | www.todaysoftmag.com


testing

Does a developer test? Does a tester code?

A

fter being in the software industry for more than 9 years now I’ve pretty much done a little bit of everything. I was an intern that did testing in order to learn how to code, I was a software developer in a small firm and I did everything from the ground up, including database development, and now I am a QA engineer at Betfair. In my current role I am involved in functional testing with an emphasis on automation, continuous delivery and performance testing.

Raluca Morariu

raluca.morariu@betfair.com Senior QA Engineer @ Betfair

When I started thinking about studying software development I never imagined what my path would be. But all the things that I’ve done have helped me become good at what I do now. The questions from the title might seem familiar to most of you and some of you might even have strong opinions about what the answers to those questions are. There have been numerous occasions in recent years when there have been discussions about whose responsibility is to test and whose is to code and what a developer has to do and what a tester has to do. While doing research for this article I’ve seen every opinion out there, and, while I agree with some, this article represents my view on this very complex developer-tester relationship, from the perspective of having filled both shoes.

Does a developer test?

Long gone are the days when a developer blindly pushed code to the source control without caring what happens after. Or at least they should be. The code we write needs to compile, build, be deployed and somewhat function before being tested. And how can a developer be certain that his code does all of the above without testing it? No matter if we talk about functional testing on your machine, or writing unit tests, some testing

effort needs to be put in it by a developer. Understanding and seeing how the code behaves after you have written it, or how it integrates into the bigger picture makes for a better developer. Whenever you are in doubt if you should be testing, ask yourself this “Am I comfortable in deploying the software in production without it being tested by the QA and take full responsibility for any defects?” Developers are not supposed to be able to test in the same way testers do. However, this doesn’t mean they aren’t able to help in testing, and in some specific areas they will do it even better than testers. If you are asking yourself how much testing developers should do, well, the answer to this somewhat depends on the context. From my experience, the following list is what a developer should do in terms of testing before handing a piece of code off to the QA • Software still builds • Software still installs (preferably not on the developer’s machine) • Unit tests are written and pass • Smoke tests pass (preferably written by the testers and run automatically for each build) • The most positive and obvious test cases pass for the new functionality (happy flows)

www.todaysoftmag.com | no. 32/february, 2015

31


testing Does a developer test? Does a tester code? Also, as I am sure most of you know, In my experience, knowing how to the earlier a bug or issue is discovered, the code makes you a better tester. First of cheaper it is to fix and ultimately, the better all, it adds value to the overall product by the end product is. being able to run the same tests over and over again after the first automation effort Does a tester code? is done. Secondly, it gives you a better I think everyone in the software indus- understanding on how the implementry has heard about the word “automation” tation works and you can find new ways at least one time. And at least some of the to break it. Last but not least, it frees you people that are reading this article have or to do more exploratory testing instead of are doing automation. Also, there might be spending time redoing the same scenarios some of you who have not ever attempted over and over again to write automated tests or do not want to. Skilled testing and learning code do It’s perfectly fine not to want to code, but not exclude each other. By learning how you should at least learn how to code. to code, you gain a deeper knowledge of We are no different than developers architecture, limitations and strengths a when it comes to writing code. Or at least programming language has and implewe shouldn’t be. mentation choices developers make. All I like to think of automation testing these things can affect the testing effort. as developing, just with a different set of Obviously, given my experience, it requirements. If the developer’s requi- might be easier said than done but I am a rement is to write code to implement a firm believer that automation and testers certain functionality, a tester’s requirement who code are the future of this industry. is to write code to test the code that imple- And without going even further, here are ments a certain functionality. Sometimes, a few things that should be automated by the first part is harder, other times the last the testers one is. In an ideal world, for every develo• G eneration of input data (if per working on a project/code with a focus applicable) on functionality there is an opposite deve• Smoke tests loper (automation tester) that focuses on • Regression tests (at least for new piebreaking the code (thus making it better). ces of software)

32

no. 32/february, 2015 | www.todaysoftmag.com

This might not seem much, but once you get it started the rest will fall into place.

Conclusions

So, does it seem that the roles are merging? Yes and No. In my opinion, the role of a developer and the one of a tester are still separate roles and each have their own area of expertise. But with the expansion of cross functional teams and the need for faster iterations we all have to learn from each other in order to have the best product. We should always have the bigger picture in mind, the product, the customers and when all else fails, don’t forget to talk to each other.


programming

IoT Flavor: Sensoriada

T

Andrei Crăciun contact@andreicraciun.com Mobile Developer @ Intel

he world of software development has a lot of flavours and software developers prefer different flavours. In the world of Internet of Things (IoT) one the most important flavour is the one of SENSING. By adding a MOBILE flavour to any IoT product the solution becomes a very pleasant one. Even though sensing and mobile would be very enjoyable for the general users it is hard to find developers that would like both flavours. On one side we have volts, amperes, sensors, actuators and on the other side we have views, icons, lifecycles, uEx. Sensoriada creates a framework and defines a context that tries to fill the gap between these flavours with the only purpose of creating better applications and in the same time to allow developers to work with their favourite flavour. “Internet of Things” (IoT) is not something new, but it is rather a new concept for what used to be, in the last decade at least, smart home, home automation, smart monitoring and much more. In all these years one important characteristic has remained the most important and the one that defines all IoT applications: they are very present in our lives (we have a very strong direct interaction with them and they affect our life directly). In this quest we started from a simple problem defined as follows. Display on a mobile device the temperature inside and outside of the house in a live manner; as restrictions we were not allowed to drill holes and there was no specific place where the inside temperature should be monitored. Because of the restrictions the only solution was to have a wireless solution. The live part was less restrictive and that’s not because it was easy but because it could have been much harder. In our opinion there are at least three ways (in respect of frequency) to get data from a sensor: live, real time and hard real time. • Live means we get the data fast enough to fill our needs (to monitor the temperature on a visual way this should be enough). • Hard real time means we get all the data possible and there are no changes we miss; hard real time systems are used when there are “live or die” situations (for instance when adjusting the suspensions of a car in a turn); also the hard real time projects have a very short lifecycle (we’ll talk about lifecycle later on ). • Real time is a frequency between live and hard real time; still no data should not

be lost, but in the event that we lose some data or have some unexpected delay people should not die. In the previous paragraphs there were a few terms which will be detailed further on. First there was sensors and actuators. Sensors are the input of an IoT project they provide data that is stored, processed and analyzed by the system. Actuators are the tools of reacting. After all the data is analyzed and the decision is taken usually an action is triggered on an actuator to handle (e.g. an actuator can be an electronic switch that will turn on a light or a heater). Usually both sensors and actuators are connected to controllers (microcontrollers, chips, CPU-s); the best practices advices I received and which I want to share with you is that in the same project actuators and sensors should not be connected to the same controller, but it’s safer to have one controller for input (sensing) and one for output (action). Next the presentation was focused on the lifecycle of an IoT product. There are several approaches for this but the article will present only one of them, which I consider the most relevant for this project. In the image below, the 4 states of the lifecycle are represented: 1. Measuring during which the data is read from the sensors, 2. Storing (which could have been called Storing/Transporting) is the phase during which the data is persisted on the point where it will be analyzed (either locally in the environment for the hard real time systems, or possible in a cloud solution in the more distributed systems);

www.todaysoftmag.com | no. 32/february, 2015

33


programming IoT Flavor: Sensoriada 3. Analyzing is the phase during which all the data read is processed and actions based on that are decided (during this phase interaction with other systems and also the analysis can be a visual one as it will be in our case). 4. Reacting is the phase during which the actions decided in the Analyzing phase are executed usually by a layer of actuators.

bother making the gateway globally available for client initiated connections and on the other side we can implement an energy efficient policy on the gateway as we have to send data only when there are changes and not for every client request

From the mobile application point of view we have 3 main On our system we will have a mobile device involved, so we elements of design: should state that in general the role of a mobile device in an IoT • Sensor - responsible for what is measured (e.g.: tempeproduct is placed during Storing and Analyzing phases because rature, humidity, pressure) and for what and how the values mainly the device is used to visualize data and to select some actiare provided; also because things evolve Sensors should have ons that will be transmitted to the actuators for execution during a version Reacting phase. • Sensor Node should provide: • a clear way to identify (e.g.: the kitchen sensors, the outside sensors) • a way to determine the remaining energy in the power system (e.g.: the voltage of the battery) • a way to determine the accuracy of the data (e.g.: seconds since last update) • a list of sensors attached to the node • Data Provider - responsible for connecting to the cloud cache and get all the data related to the sensor nodes The cloud cache provides data as a JSON. There are several protocols and ways to get data from a sensor network, the most popular being MQTT; however we’ve chosen HTTP having the payload as JSON mainly because it is enough for our system and the electric imp cloud provides a very easy way to make a HTTP server connector. We’ve chosen JSON as a payload format mainly because of its popularity, popularity that makes processing of it very easy and handy. The structure of the JSON is based on the application model described above. There is an array of sensor nodes having as elements the identification (“id” which currently is an integer, but there is a big debate in making it a string), energy status (“voltage”), accuracy (“secondsAgo” since “date”) and the list of sensors. A sensor will have as elements: the type, the version and the values; as value the sensor could have also other elements and there is no restriction to only one value. The type and the version identify in a unique manner the type of the sensor and influence directly the mode the values provided are processed. Below is an example of some data provided by the live/ running system:

We structured the solution we’ve chosen as a sensor network. Maybe it’s time to detail what a sensor network is. Well, the main components are: • the sensor - which can be either analogic either digital depending on how data is provided; we’ve chosen a DS18B20 temperature sensor that uses the OneWire protocol to communicate, it is water proof and it has a pretty good measuring range (http://www.seeedstudio.com/depot/One-Wire-TemperatureSensor-p-1235.html) • the sensor node usually it is managed by a microcontroller, it is connected with the sensor via wire and in our case should run on battery and have a wireless transmitter; because of these two requirements we can implement a energy policy that would allow longer usage without changing the batteries; we’ve chosen a Devduino Sensor Node V2 which is Arduino based and has a nRF24L01+ module for data transmission. (http://www. seeedstudio.com/depot/DevDuino-Sensor-Node-V2-ATmega- { „sensorNodes”:[ 328-AAA-battery-holder-p-1850.html) { „id”:0, • the gateway is a device that is usually always on, it is con„voltage”:2848, nected on a wired or wireless manner to the sensor nodes; it „secondsAgo”:247192, „date”:”2015-01-24 07:10:21”, has the role of gathering all the data from the sensor nodes „sensors”:[ and to make that data available for processing; our choice { „type”:10, for a gateway was an electric imp on which we connected a „version”:1, nRF24L01+ enhanced module in order to be able to receive „value”:787 } the packages sent form the sensor nodes; the main reason for ] choosing electric imp is because it has a built in WiFi adapter }, { and also handles in a transparent manner for the developer the „id”:1, connection with the electric imp cloud, handling special cases „voltage”:2892, „secondsAgo”:32, like connection lost or reconnecting „date”:”2015-01-24 07:10:21”, • the cloud cache is a server side application that resides on „sensors”:[ { a high availability system and it has the main role to keep the „type”:10, data sent from the gateway; the clients will connect directly to „version”:1, „value”:2243 this application and by doing this, on one side we should not }

34

no. 32/february, 2015 | www.todaysoftmag.com


TODAY SOFTWARE MAGAZINE

}

]

}

]

Conclusions

In the beginning of the article we stated that our goal was From the Android point of view the model of the Sensor to create a bridge that will allow engineers working in the IoT Node is very simple and includes the above defined elements. business to be able to work together no matter the flavour the prefer. If we achieved this or not by the first version of the frapublic class SensorNode { public long id; mework we will be told by time, but we consider we made a few public int voltage; steps forward and with the evolvement of the IoT community we public long secondsAgo; public Date date; hope Sensoriada will help build a synergy between developers public List<Sensor> sensors = new that will not leave any room for conflict, but only for harmony LinkedList<Sensor>(); } and constructive debates . The Sensor model is an interface as we have a lot of diversity depending on the type and the version of the sensor. As for this MobOS (Mobile Operating Systems) version is a read-only system we only provide methods to get the Is the first mobile community in Cluj. We started the actidata in a view manner and that is the main reason for having only vity in 2012 and because we want to be bigger, more relevant the getHumanReadableValue() method to get the data. Regarding and more engaging as to serve better the mobile community in the variant of the sensor, there are several fixed values for the type Transylvania, the second edition of MobOS will be an improved (defined in the Sensor.Type enum); as for the version, the imple- version! mented classes should choose a maximum version and support The 2nd edition will consist of 2 days-conference, first day all the versions below the chosen one: dedicated to mobile technology presentations and open panel talks, while the second day will host 4 workshops, iOS and public interface Sensor { public enum Type { Android related, for both beginners and advanced developers. TEMPERATURE(10), Key elements of the conference: HUMIDITY(11), PRESSURE(12); • 12 presentations … • 4 workshops } • 10+ national and international speakers String getHumanReadableValue(); • 2 full-days in Cluj Napoca– to engage in the world of Type[] getSupportedTypes(); boolean isTypeSupported(Type type); Mobile technology development }

int getMaximumSupportedVersion();

The world of automotive has taught us that in this business things should be very simple, otherwise testing is very difficult and if IoT systems are not properly tested errors can have regrettable consequences because, as exposed in the beginning of the article the IoT systems are very present in our lives and interact with it directly. That being said we’ve wanted the users of the framework to have a very easy way to use it. Below is a code sample of usage in a classic Android application String nodesJson = getSomeHowTheJson(); // DataProvider in the next version List<SensorNode> sensorNodes = SensorNodeUtil. parseSensorNodes(nodesJson); int mySensorNodeIndex = someValue; // String identification in the next version

On the 15th of January, 2015 we had a launching Pre- Event of the conference, hosted by Fortech. During this event, 2 of our local speakers delivered a presentation on IoT (Internet of Things) and because of the high interest in this topic, Andrei Craciun, who is a senior software engineer at Intel Corporation, took the initiative to write an article in TSM.

int mySensorIndex = someValue; // byType identification in the next version someView.setText(sensorNodes.get(mySensorNodeIndex). sensors.get(mySensorIndex).getHumanReadableValue());

The magic happens in the SensorNodeUtil class which is in charge of processing the JSON input and to return a list of SensorNode-s each of them containing the proper implementations of Sensor-s based on type and version. To achieve this we’ve implemented a way to configure the system. The configuration will mainly handle a map between the sensor type and the name of the class that will handle the data for that type. This allows the framework to be extended by anyone and also to have a default configuration out of the box. www.todaysoftmag.ro | nr. 32/februarie, 2015

35


programming

programare

Sentiment Analysis and the complexity of online opinions

I

f you’d live in a world where your opinions matter, would you try to make a change? Without any doubt opinions are a constant presence in our day to day lives: suggestions, reviews, these are only a few of so many different ways to influence future decisions. In this era, when the multitude of options are choking you, opinions are the ones that can help you make a quick decision under the spotlight. But lets assume that we can evaluate everything by pros and cons, would our decisions be correct? Is it actually that simple? Cosmin Gabriel Popa cosmin-gabriel.popa@hp.com SA R&D Osprov Team @ HP

Sentiment Analysis or Opinion Mining is a branch of Natural Language Processing (NLP) that handles the study of opinions, sentiments, evaluations, attitudes, emotions and all their characteristics, focused on entities like products, organizations, individuals, events, etc. There wasn’t a special interest in this field before the year 2000, but, since the widespread of comercial applications (online and offline), the perspective on analyzing opinions has changed radically. It is for the first time in history when there is a consistent and specific database obtained by social media. The perspective shift is not that surprising taking into account its applications in so many different fields from politics, sociology to economics and culture and the popularity of social networks.

positive one or not? And how would that influence your decision? There are several analysis methods depending on the level of precision or interest required: Document Analysis - determining if an entire document expresses a positive or negative opinion, Sentence Analysis - determining if a sentence is positive, negative or neutral, Entity and Aspect or Feature Analysis - determining if that is an opinion, on what is about and its polarity.

Solution

There are two methods for classifying opinions: training neural networks (Supervised Learning) and the one that doesn’t imply that kind of procedure (Unsupervised Learning). By simplifying the analysis to Sentence Analysis and preThe problem suming that we have at our own disposal Lets get back to the initial question. positive and negative documents, we’ll try We’ll take movies for example and as series a solution by Supervised Learning with the of their reviews. We’ll split the opinions help of NLTK (Natural Language Toolkit) into different categories, as we established {python code} initially: positive (pros) and negatives from nltk.corpus import movie_re(cons). The following questions emerge: views positive_ids = movie_reviews. If there is a negative review on the lead fileids(‚pos’) = movie_reviews. actor and a positive one on the director, negative_ids fileids(‚neg’) would you watch that movie? Would you {/python code} need another opinion on that movie? How can you determine if the next opinion is a Noticeable is the fact that the

36

no. 32/2015, www.todaysoftmag.com


programare

TODAY SOFTWARE MAGAZINE

“movie_reviews” corpus contains movie reviews that are segregaAll that still remains is to add them together. With the extracted into two categories as we established initially. From this data ted information will train the neural network represented by the we’ll extract words as future references for training data. NaiveBayesClassifier. Keeping it simple, we’ll use the algorithm already implemented in the NLTK platform. {python code} positive_data = [movie_reviews.words(fileids=[f]) for f in positive_ids] negative_data = [movie_reviews.words(fileids=[f]) for f in negative_ids] {/python code}

{python code} (word_fd, cond_word_fd) = buildFreqDistribution(positive_data, negative_data) total_word_count = cond_word_fd[‚positive’].N() +

cond_word_fd[‚negative’].N() We are on the verge of deciding how these references will “look” like when we will train our neural network. Keeping this word_scores = buildWordsScores(word_fd, cond_word_fd, total_word_count) simple, we’ll choose as a feature the most frequent words in that movie review corpus. Now we’ll implement a function that best_words = findBestWords(word_scores, 1000) = getFeatures(‚positive’, determines the frequency of every work in the two categories - positive_features positive_data, best_words) separately and as a whole. {python code} import itertools from nltk import FreqDist, ConditionalFreqDist def buildFreqDistribution(positiveWords, negativeWords): word_fd = FreqDist() cond_word_fd = ConditionalFreqDist() for word in list(itertools.chain(*positiveWords)): word_fd[word.lower()] += 1 cond_word_fd[‚positive’][word.lower()] += 1 for word in list(itertools.chain(*negativeWords)): word_fd[word.lower()] += 1 cond_word_fd[‚negative’][word.lower()] += 1 return (word_fd, cond_word_fd) {/python code}

negative_features = getFeatures(‚negative’, negative_data, best_words) classifier = NaiveBayesClassifier.train( positive_features + negative_features)

classifier.show_most_informative_features(10) {/python code}

Looks about now that we have a mechanism that can determine with a certain precision if a movie review is positive or negative. Let’s take as example the following movie review on a Kevin Costner film : „Once again Mr. Costner has dragged out a movie for far longer than necessary. Aside from the terrific sea Based on the frequencies calculated we will construct a rescue sequences, of which there are very few I just did not care dictionary that will keep the score of every word. The function about any of the characters [...]” - at first it seems that this one is „BigramAssocMeasures”, shortly, calculates the relevence of negative. a word in the context in which that word is found, returning a {python code} representative value. features = selectBestWords(words_in_review, {python code} from nltk import BigramAssocMeasures def buildWordsScores(word_fd, cond_word_fd, total_word_count): word_scores = {} for word, freq in word_fd.items(): positive_score = BigramAssocMeasures. chi_sq(cond_word_fd[‚positive’][word], (freq, cond_word_fd[‚positive’].N()), total_word_count) negative_score = BigramAssocMeasures. chi_sq(cond_word_fd[‚negative’][word], (freq, cond_word_fd[‚negative’].N()), total_word_count) word_scores[word] = positive_score + negative_score return word_scores {/python code}

best_words)

print(classifier.classify(features)) {/python code}

It seems to be positive with a score difference of about 1.4. If we add the rest of the review: „[...] Most of us have ghosts in the closet, and Costner’s character are realized early on, and then forgotten until much later, by which time I did not care. The character we should really care about is a very cocky, overconfident Ashton Kutcher. The problem is he comes off as a kid who thinks he’s better than anyone else around him and shows no signs of a cluttered closet.” - now the result changes and it seems that the review is a negative one with a score difference of about 0.9.

Case study

Functions that will filter the relevant information for training Using the SVM (Support Vector Machines) algorithm in the neural network are needed. parallel with the NaiveBayesClassifier that we previously used and testing these two on a database of about 6 million words, we’ll get {python code} def getFeatures(label, data, best_words): the following results. With the growth of the number of entities features = [] extracted from the text and used in training the neural networks, for feat in data: words = [selectBestWords(feat, best_words), label] we can observe the differences of accuracy and classification. features.append(words) We can observe how the algorithm’s accuracy remains conreturn features stant and on a growth path until a horizon point where the value def selectBestWords(words, best_words): return dict([(word, True) for word in words if word becomes steady around : 81%. Even if the number of features in best_words]) grows the accuracy will oscillate around that value. Though, the instability of the NaiveBayesClassifier algorithm is clear in the last def findBestWords(scores, number): best_vals = sorted(scores.items(), key=lambda w_s: chart. The SVM seems to be more reliable. w_s[1], reverse=True)[:number]

best_words = set([w for w, s in best_vals]) return best_words {/python code} www.todaysoftmag.ro | nr. 32/februarie, 2015

37


programming

testare Sentiment Analysis and the complexity of online opinions You are overwhelmed with opinions everyday on any device, app, webpage or on any street. Finally, does your own opinion matter? I say: Yes!

Conclusions

It seems that it is not THAT simple. We were fooled by our own algorithm. But actually there is no standardized way of determining the “feeling” of an opinion. Even with a blunt simplification of the problem the accuracy never reached 95%. There are, as already mentioned, different methods and different algorithms that can be used in Supervised and Unsupervised Learning,

but the suggestion is to use combinations of these two categories. Of course there is an important value in how the training data is used, the implemented methods, the test corpus - these have to comply with the user’s initial intention. Cumulated opinions can determine the value of a product, of an individual, of an idea or an event. Sometimes they are more powerful than the price tag.

38

no. 32/february, 2015 | www.todaysoftmag.com


TODAY SOFTWARE MAGAZINE

others

Critical Thinking in Business Analysis

F

ive percent of the people think; Ten percent of the people think they think; and the other eighty-five percent would rather die than think.

– Thomas A. Edison

In November 2014, a local IT company was the host of an event dedicated to Testers: Rapid Software Testing. At the end of this event, for a day, the speaker tackled a rare subject for the IT industry, but important for testers and analysts: Critical Thinking. The trainer of the event was Michael Bolton (not the singer!), a well-known figure in the Testing Industry. Although the event was directed towards Testers, some of the information regarding Critical Thinking applies to Business Analysts as well. Most of the Business Analyst’s work is thinking. Thinking is a force of habit that defines the quality of our work and of our decisions at work. However, there are lots of situations when we realize that the result of our thinking did not produce the expected results. This is because more than too often we do not choose consciously the way of thinking according to the situation and this has its shortcomings. Daniel Kahneman wrote in his book

(Thinking, Fast and slow) that people have two systems of thinking in their minds, System 1 and System 2: • “System 1 (automatic system) operates automatically and quickly, with little or no effort and no sense of voluntary control. “ • “System 2 (effortful system) allocates attention to the effortful mental activities that demand it, including complex computation.” If that short description did not say enough, think this: System 1 is the one which helps you react to external signals, recognize objects or faces, orient attention, associate ideas (e.g. Which is the capital of France?) and many more. System 2 is engaged and takes control when difficult tasks are requiring a solution: complex calculations, intense attention on something, check the validity of a logical argument and many more.

See Daniel Kahneman – Thinking, fast and slow

What has all of the above-mentioned to do with critical thinking?

In simple terms, critical thinking can be defined as “Critical thinking is the intellectually disciplined process of actively and skillfully conceptualizing, applying, analyzing, synthesizing, and/or evaluating information gathered from, or generated by, observation, experience, reflection, reasoning, or communication, as a guide to belief and action. In its exemplary form, it is based on universal intellectual values that transcend subject matter divisions: clarity, accuracy, precision, consistency, relevance, sound evidence, good reasons, depth, breadth, and fairness.” - Definition1 by the National Council for Excellence in Critical Thinking, 1987 Considering the core skills of a Business Analyst that have been defined over and over again by numerous trainers and blogs, when referring to a qualitative thinking, analytical thinking might not be enough. While analytical thinking refers to the abstract separation of a whole into its constituent parts in order to study the parts and their relations, critical thinking is the disciplined thinking that is clear, rational, open-minded, and informed by evidence. In other terms critical thinking is an attribute of System 2. In order to be sure that an individual (in our situation a business analyst) takes the decisions that best fit the client’s needs and require the optimum amount of effort and cost, one must engage “System 2”. By thinking with “System 2” you will increase the quality of 1 h t t p : / / w w w. c r i t i c a l t h i n k i n g . o r g / p a g e s / defining-critical-thinking/766

www.todaysoftmag.com | no. 32/february, 2015

39


others Critical Thinking in Business Analysis your analysis.

How and why can someone engage “System 2”?

According to Daniel Kahneman, when an individual is required an answer or a solution “System 1” will offer one based on previous experiences. In some cases the quick connections can fit to the current situation, but most of the times they require further analysis. As a business analyst, one must always be prepared to think critical in any situation. Take for instance the job interview. From all the questions that can test a lot of different skills, a business analyst should not be surprised if he is asked a question like: “How many cars pass daily through a certain crowded crossroads?” Maybe the first reaction is to get up and leave the interview or to question yourself if you are at the right interview. In fact, the question is as plausible as any other. Using this question, the interviewer is actually testing more than one ability. Most of us are tempted to google it, since Google is a big part of our lives nowadays, but what would you do if you can’t access the internet? The answer is far from any mathematical formula. Let’s see: “How many cars pass daily through a certain crowded crossroads?” First of all, you must identify the city/region. Then approximate the number of people that live in that region. From that number, you must assume that only a part of them have cars which they use regularly. From all the people that have cars in that region and use them regularly, only a part of them use that particular crossroads to get to work, shopping or any other point of interest. Of course you can add or reduce the result by an error percentage that is most common in statistical calculations. In the end, it is almost obvious that you won’t get the exact number. In fact, the right number is not even important. What is important is the algorithm of thinking, by which you proved the interviewer you can think statistical, you can analyze the problem on several dimensions and can follow a logical argument. The problems may vary and can extend to more complex algorithms (for details look for Fermi problem). Further on, a lot of the daily tasks of a business analyst are related to collection of requirements. The process of elicitation requires the business analyst great focus in order to collect and understand the needs of the client. Applying a critical thinking demands not taking all the statements of

40

the stakeholders for granted. Moreover, prejudice in yourself and others. collecting requirements can also mean a • Be open to new ideas. challenge in finding arguments in things • Be prepared to consider all we hear and not taking for granted the possibilities/viewpoints. statements we hear just because we respect • Be willing to reassess your own the person who issues them. A stakeholder views. may put forward a requirement that’s not • Aim for balance. necessarily tied to any business value but • Evaluate: rather to their own increased convenience. • Purpose/motivation Being critical allows the business analyst to • Bias/vested interest distinguish between requirements that add • Facts value to the business and those that should • Opinions be given a lower priority. For example: “I • Assumptions need a report on the number of products • Incorrect/irrelevant information I sell every month”. Being critical implies • Missing information questions like: • Inconsistency • Why is this report needed? • Arguments • Who will be the recipient of the • Support statements report? • Counter arguments • What kind of information do we • False statements have to interrogate? • Is this report similar to any existing Conclusion one? So, why is critical thinking so impor• What is the anticipated frequency of tant to a business analyst? It’s a quality use? assurance check. Although critical thinking does not guarantee accurate And so on. By the end, you might find requirements and the elimination of biaout that the report is already implemented ses, it comes very close in doing that. The and that the frequency of use is low so the more accurate and real the requirements requirement can be assigned with a lower are, the greater the chances that the results priority. of the project meet the true needs of the stakeholders. The key takeaway is to be How can you train critical thinking? investigative in your approach; you never As any other skill, critical thinking can know what you may find. be trained. It is not easy, because you must be aware at all times of what you think and how you handle a challenge, but it pays off to have this as a skill. A lot of the universities around the world invite their students to discover and train the critical thinking skills. Anglia Ruskin University, a large university from England, defined a guideline which helps its students to develop critical thinking. This can easily be used by anyone, especially by a business analyst: • Ask a lot of questions: we heard a lot that as a business analyst you must ask a lot of questions, but that doesn’t mean that all the questions are good ones. The 5w’s (who, where, when, what, why) and how are the basic and required questions to identify requirement is indeed needed. • Think logically • Develop a reasoning line of argument. Răzvan Costa • Use valid and reliable evidence. Razvan.Costa@endava.com • Avoid appealing to emotions. • Be objective. Business Analyst @ Endava • Be open minded • Be aware of personal bias/

no. 32/february, 2015 | www.todaysoftmag.com


programming

TODAY SOFTWARE MAGAZINE

Java 8 Optional is not just for replacing a null value

I

n Java 8, you can return an Optional instead of return null; as you might do in Java 7. This may or may not make a big difference depending on whether you tend to forget to check for null or whether you use static code analysis to check to nullalbe references. However, there is a more compelling case which is to treat Optional like a Stream with 0 or 1 values.

Simple Optional Use Case

// could be another type .map(x -> x instanceof Contained2 ?

String text = something(); if (text != null) {

}

In the old days of Java 7 you would write something like

(Contained2) x : null) .map(x -> x.list) // could be null .filter(x -> !x.isEmpty()) // could be empty .map(x -> x.get(0)) // could be null .map(x -> x.third); // could be null.

Note: Oracle Java 7 will be „End of Public Updates” in April 2015. What we get is a series of mappings and filters which only proWith Optional you can instead write gress if the value is non-null and present. If any value is null, or a filter is not true, the whole result is „not present”. Optional text = something(); if (text.isPresent()) { String text2 = text.get();

However, if you are being paranoid you might write. Optional text = something(); if (text != null && text.isPresent()) { String text2 = text.get();

Conclusion

Using Optional can be a powerful way to navigate a complex data structure in a safe way. The purpose of lambdas is to reduce boiler plate code, and in the case it avoids all the checks or errors you have.

If you have NullPointerException errors often in your project Additional Optional might help, but otherwise it’s not looking like it helps For your interest, here are the classes I used in the example much. above.

A more complex example

static class Nested { Contained first; }

static String getFirstSecondThird(Nested nested) { try { return ((Contained2) nested.first.second).get(0).third; } catch (NullPointerException | ClassCastException | IndexOutOfBoundsException ignored) { return null; } }

static class Contained { IContained2 second; }

Let’s instead consider this example

interface IContained2 { } static class Contained2 implements IContained2 { List list; }

This is really ugly. Instead of catching exceptions, you can build class Data { a long list of condition check but it becomes really hard to see what static String third; you are trying to do. } Optional allows you to handle all the possible error conditions without an Exception or nested if/else logic. Peter Lawrey static Optional getFirstSecondThird(Optional nested) { return nested // could be non-present .map(x -> x.first) // could be null .map(x -> x.second) // could be null

peter.lawrey@higherfrequencytrading.com CEO @ Higher Frequency Trading Ltd

www.todaysoftmag.com | no. 32/february, 2015

41


programming

Deep dive in clouds providers SLAs

I

n the era of cloud we are bombarded with different cloud services. New features of cloud providers are lunched every day and prices are dropping every month. In this moment the most known cloud providers are Amazon, Google and Microsoft.

Looking over their services we will see SLAs (Service Level Agreement) that reach 99.9% availability, 99.95% availability or even 99.99% availability. This article will jump into cloud providers SLAs, trying to explain why the SLAs are so important, what are the benefits of them and last but not least how much money we could get back if a service goes down.

What does a SLA mean?

“A service level agreement (SLA) is a contract between a service provider (either internal or external) and the end user that defines the level of service expected from the service provider. SLAs are output-based in that their purpose is specifically to define what the customer will receive. SLAs do not define how the service itself is provided or delivered.”1 A SLA is a contract between a service provider and the consumer that specify the ‘quality’ of a service that will be provided to the consumer. For example if we think about a service that gives you the exact time, the SLA will define how much time the service will be up and running in a year (99.99%). Beside that, the SLA defines the warranties that are provided if the SLA is not reached. For example if the exact time service is down more than 0.01% per month, the service provider will reduce the total cost the bill with 50%.

1 https://www.paloaltonetworks.com

42

What areas are covered?

Based on what type of service or business we are talking about, the things that can be covered are different. It is very common for a SLA to cover the following attributes of a service: • Volume • Speed • Responsiveness • Efficiency • Quality of work Looking again over our example with the exact time service, we could have an SLA that says: “The exact time service is up 99.99% per year, the response time from the moment when a request hit the service is 0.0001 seconds and the time precision is 0.00000001 second.”

Cloud SLAs

In general if we are talking about cloud providers and services that are offered by them, the areas that are covered by all of them is the uptime. Beside uptime, there are other areas that are covered, but they vary based on service type. Microsoft, Google and Amazon have a clear SLA that specify the uptime for each service that is provided by them. Even if they are different companies, the SLAs are very similar to each other. For example if we are looking at cloud storage service that is not replicated to different datacenters or nodes we will discover that Google is offering a 99.9% uptime SLA, Microsoft is offering a 99.9% uptime SLA, Amazon is offering a 99.95%

no. 32/february, 2015 | www.todaysoftmag.com

uptime SLA (with the remark that if we have for use Read Access-Geo Redundant Storage from Microsoft we can reach even 99.99%). As we could see in the above example, the SLAs are very similar +/-0.05%.

How is the service measured?

This question is very important, because each cloud provider SLA specifies very clearly how, who, when, based on what SLA service is measured. In all the cases the service uptime is measured internally, by their own system. This doesn’t mean that the measure is not real. No, it is very real, but if the cause of the downtime is an external factor like network issues on client side, than it is not their problem – and it is normal. The SLA is not applicable for cases when the service is used outside specific boundaries. For example the SLA is applicable only when the number of requests per second is under 10 million requests or when there are at least two instances of that deployment.

Warranty

Very often people assume that if they have a service in cloud that generate 1000$ per hour, in a case of a downtime, the provider will give them the amount of money that service would generate. Another wrong assumption is that a cloud provider will cover all the lost that are generated by a downtime. Both assumptions are wrong. In this moment I don’t know a cloud provider or


legal a service provider that would cover the loss of a downtime. It might sound strange, but it is normal. First of all, it is hard to measure and calculate the loss and secondly the SLA is referring to the service that you are using, not the system and services that you are providing over it. Google, Microsoft and Amazon are offering very similar warranties. Based on the downtime period at the end of the month, a specific amount of service credit is offered to the customer. For example if the uptime of a service was under 99.9%, the customer will receive 25% of that service cost of that specific month as credit. This credit will be used to reduce the bill cost in the next month. Also the SLAs specify that if a specific incident or event causes a downtime to more than one cloud service, then the client can submit a claim only for one service that was affected by this event. For example if a datacenter goes down because of the same software update, where storage, computation and messaging systems are affected, than the customer can claim the credit for only one of the services.

Amazon, Google and Microsoft Warranty

Let’s take a look at the warranties that are offered by these cloud providers in a case of a downtime of their storage service.

Amazon

TODAY SOFTWARE MAGAZINE Microsoft

Cloud service uptime is not our product uptime

An important thing that we need to take into consideration is that when we are constructing a product over cloud the uptime of our system is not the same with the uptime of the cloud services. For example, if we have a product that is constructed using 20 services from cloud, than the uptime of our system will need to be calculated taking in consideration the uptime of all cloud services. If each of the cloud services has an uptime of 99.9% than the uptime of our system could reach around 98% uptime.

The offer is not 100% the same, but it is pretty similar. Even if Google offers 50% storage credit in the case of a downtime, I don’t want to be in the case when the uptime is only 90% for example. The credit that is offered when the uptime is between 99.xx% and 99% is the same. Every ‘9’ that is offered on top of 99% is very expensive and hard to obtain. Those nines are representing the real battle and can make a difference between a service and a great Conclusion service. As we have seen above, the SLAs that are offered by different cloud providers are When and how do I receive the credit? pretty similar. The most important thing is All cloud providers have different to know exactly what does the SLA cover mechanisms to notify customers when a and how to handle downtime periods. service is not working as expected (over a web site, using an API or via email). In all References these cases, even if a service is down more • Amazon EC2 SLA: http://aws.amazon.com/ than it is specified in SLA, the customer ec2/sla/ will not receive the credit that we talked • Google SLA: https://cloud.google.com/ about above (by default). storage/sla The moment when customers are • Microsoft SLA: http://azure.microsoft.com/ affected by an incident, they need to notify en-us/support/legal/sla/ the cloud provider and open a ticket at customer support level. They need to specify what service was affected and when. Based on this information, the cloud provider will check the internal audit system and the level of error rate at that specific time interval.

Trust Google

This is the key word around cloud providers and their customers. The most important thing is the trust that exists between them. We, the customers, trust our cloud providers that will respect their SLAs. The same thing is happening with any external provider. In general all the SLAs that are offered by cloud providers are respected. The cases when incidents exist are very rare and isolated.

Radu Vunvulea

Radu.Vunvulea@iquestgroup.com Senior Software Engineer @iQuest

www.todaysoftmag.ro | nr. 32/februarie, 2015

43


marketing

Internal Marketing(IM) – Growing up in Romania!

W

hile for some of us the concept of internal marketing is something familiar the role of this marketing strategy is still highly underestimated in today’s market. We propose a picture view in 5 phases on how the concept evolved and we also state that IM will constantly change as long as the world of business changes.

Adrian Abrudan

adrian.abrudan@loopaa.ro Senior partner & research director @ Loopaa

1st phase: IM is… NOT NECESSARY

There are still markets and businesses where, the power does not belong to the customer. Therefore, there is no pressure to care about marketing in general, and moreover about IM since there will be no direct effects on the business. Another characteristic of these businesses is that workforce is not a problem. We can understand better if we think about people working for the government as an extreme example. Money and benefits are good, positions usually come with low responsibility and for some employees it’s the ideal job. At the same time, management can be: politically named, uneducated, uninterested in their employees’ opinion or motivation, less concerned about the beneficiaries of the organization services – let’s say the customers – because usually there is no competition.

2nd phase: IM is about… CUSTOMER SATISFACTION

Many analyses about origin of IM concluded that IM with its strategies, tactics and theories were destined to create a better customer satisfaction. It is still a consequence of IM practices even if the IM does focus on better defined objectives

44

no. 32/2015, www.todaysoftmag.com

nowadays. The main elements of the IM concept did focus on customer orientation and customer satisfaction. Probably the most relevant description of this phase is that presented in Marketing for Hospitality and Tourism 3e, Kotler P, Bowen J and Makens J (2003) which emphasize 5 essential traits of internal marketing; • Employees must have a customer service attitude • Employees must understand your product • Employees must be enthused about your product and your company • There must be good communication between employees and management • Employees must be able to identify and solve customers’ problems The IM responsibility is still in the hands of management and sales management, while HR follow their requests sales oriented.

3rd phase: IM is about… INTERNAL BRANDING

What is new here is that the activities focus more and more on selling the company brand to employees. IM concept aims on “... attracting, developing, motivating


legal and retaining qualified employee” Berry &Pasuraman (1991). In this phase specific actions are: • The concept of internal marketing is a tool that companies use within their workforce to communicate with their employees. • Education…. employees need to be educated on its aims and goals. Everyone in the company must know what the goals of the plan are and how they are going to be achieved. • an internal culture created by the managers of an organization. This culture allows employees to express their creativity and innovative selves to an extent where they still show responsibility and accountability. • Change management made also IM important to communicate changes, new brand positioning to employees, etc • Just as innovative is the extension of the idea of one set of people within an organization becoming customers to another group within the same organization. Even this concept existed in a different form in the profit-centred concept, internal customer satisfaction is activated as an IM concept. Branding also involved employees, their image and voice are part of the company’s brand, this also assuring performance recognition and higher retention rate.

4th phase: IM is about… MOTIVATION

TODAY SOFTWARE MAGAZINE investors announcing development or new offices……. The IM focus changes. Most successful applications of IM typically talk about improved motivation, leadership, team- building and working relationships which are nothing but pure and simple HRM principles. However, employee recruiting, motivation, satisfaction, retention and referral programs are now priority ZERO, otherwise opportunities might be lost and also, competition could still your employees. HR departments looks like guerilla sales departments and head hunting become common used in recruiting. Benefits and incentives demand creativity and they get an important share of personal costs. Breaking down negative perceptions of one or more aspects of the company is also an IM objective in this phase. Ab ove a cer tain le vel, HRM n e e d h e l p o n C R E AT I V I T Y a n d COMMUNICATION CONCEPTS . Here we are talking about a mariage between Marketing and HRM. Fundamentally, both marketing and HRM deal with people. At this core level, there are definitely a number of concepts such as attitudes, motives and satisfaction which can be easy understood when fixing the IM objectives. It is not the same thing anymore, you need a higher rate of success when presenting the company to potential employees, communicate internally, organizing internal events, etc. Being here, next phase after motivation becomes even more challenging.

department efficiency starts depending on the engagement of the employees in their mission on assuring motivation and necessary workforce to the management. Several IM programs start aiming TEAM effect on: • Inter-functional co-ordination and integration of employees with all operational departments; • Implementation of specific corporate or functional strategies • Making employees feel more valued and included in the company by increasing engagement levels within the organization • Referral policy in recruiting is taken to another level • Adopting new channels for communication is a MUST to encourage engagement In conclusion: The best business leaders understand that IM communication is a core business process. They invest in it. They nurture it. They make it a competitive advantage. Trends are important. Are your IM communications mobile friendly? Are you using videos internally? Are your internal print ads creative enough? Are your employees ambassadors of your company’s strategy?

Here is the phase where competition makes the difference. When you have a sector with hundreds of open jobs, profes- 5th phase: IM is about… ENGAGEMENT sional reconversions, private universities In this phase HR is considering the to form the necessary employees, new TEAM effect in getting their job done. HR

www.todaysoftmag.ro | nr. 32/februarie, 2015

45


management

Gogu at minced meat rolls “Waiter, these minced meat rolls have eaten my mustard!” Gogu tried a subtle irony, but it was in vain. “Would you like more mustard?” “No, you didn’t get this”, answered Misu, spitefully. “It’s not the mustard, but the meat rolls. Take them back and put them a little bit more on the grill, as they are raw.” “Coming back to our stuff, Gogu,” said Misu, turning back towards his friend while the waiter was taking the meat rolls away, appologising, “tell me what to do. Should I speak or not? Is it better for me to be honest or to protect myself? ‘Cause, after all, that’s what this whole situation is about.” Gogu took a moment to think before he answered. It was easy to give advice to outward seeming, but the reason why his colleagues turned to him for advice was the fact that he never encouraged anyone to do something he wouldn’t have done himself. Only that in Misu’s case, things seemed to be even more complicated. But still… “Listen, Misu, when my son tells you that everything is ok and things are very good in school, what do you do?” “Ha, ha, I try to find out what really happened. Hm… do you think this is how that that dour Bernard is going to react, too? I have never seen a more grumbler client than this one.” “The truth is that the client is a human being, too… Hi,hi”, Gogu laughed; he ignored the mistrustful grin on Misu’s face and went on: “he has been through projects, too; he knows life isn’t all pink and that there is no perfect project where everything lines up and turns out exactly the way you expect it. If you tell him <no problem, everything is perfect> - let’s admit it, it sounds dreadful – that’s when he starts to get worried and ask questions. Strangely enough, the client begins to trust you when he sees you have the guts to tell him about the less brilliant parts of the project, too. Obviously, you must know how to wrap them nicely.” Misu’s face suggested not just confusion, but rather an inner battle accompanied by physical pain. My head is going to burst: if I tell him the truth, what is there left to wrap?! It’s either you tell him or not… Uff, I wanted to be a project manager… Gogu read Misu’s face and guessed what was going on inside the mind of the Transylvanian giant. He decided to help him with the wrapping: “But you are doing well on the development part; you only

46

no. 32/february, 2015 | www.todaysoftmag.com

have problems with the migration, right?” “Yeah, but they will pull us back really bad.” “It doesn’t matter. What’s important is to give him the chance to compare advantages and disadvantages. Ahead of time on the development part, in delay with the preparations for the migration part. He will appreciate the advantage much more. Do you know the experiment with the boots? asked Gogu, but he quickly went on, without waiting for an answer. Pay attention to this: the experiment is done in two shops where the aim is to sell the same type of boots. In the first store, the boot is exposed and next to it, visibly, there is a list of its advantages: natural leather on the inside and outside, thick leather sole, waterproof, resistant to long walks in the snow and so on, and, in the end, the price: x euro, or whatever currency there was. In the other store, the same boot and next to it, visibly, the same advantages: natural leather on the inside and outside, thick leather sole, waterproof and so on and so forth, but… “ here Gogu made a theatrical pause, “in the end they added a disadvantage: the boot was only available in two colors – black and brown. After which, the price: x euro, the same as that in the first store. Which of them do you think was sold better?” he gloriously rounded it up, his eyes on Misu, waiting for the obvious answer. “Well?” “The ones with the disadvantage?” tried Misu doubtfully to put forth a feeler. “Exactly”, Gogu jumped enthusiastically. “The disadvantage did nothing but to emphasize and highlight the advantages. A minor disadvantage increased the value of the qualities, making the boot more appetizing. Pretty cool, isn’t it? And you will see, this thing will also go well in the communication with the client…” “Your minced meat rolls are back!” The waiter finally made his appearance. “I overdid them a little bit, but at least they are well done now!” “Hm…”, Misu looked at the meat rolls, then at Gogu, “more appetizing, you say?!” Simona Bonghez, Ph.D.

simona.bonghez@confucius.ro Speaker, trainer and consultant in project management, Owner of Colors in Projects



sponsors

powered by


Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.