My take on ‘Why Clojure?’

Both homoiconic nature and functional side make clojure very distinctive language. They are both inherent in making clojure what it is and i would not take one before the other.

As we have blog posts covering the reasons for FP here i’m going to take FP as a paradigm more or less granted in this post.

Why do i see clojure as a great language in the context of functional programming?

Learning and unlearning

First of all it’s hard to learn a programming paradigm in a language that does not embrace it. A wrong tool drives you to make wrong choices. It leaves you without actually learning the paradigm. It is by far the best thing to do to learn a paradigm using tools meant for it. Eric Normand wrote a good blog post about this problem.

To understand the benefits of FP, you have to use languages meant for it. Languages like Haskell (and by extension Elm and Purescript), Clojure, F#, Scala, Other lisps, Erlang, or OCaml.

I take it that you’re not interested in why not Haskell family, F# or OCaml, but i’ll anyhow go through that part. Most of these languages have very limited use in actual business right now. Currently Haskell and OCaml don’t have any place in programming for business. Which is a pity and no fault of the languages . Elm is currently used in front end and as such is still lacking in backend. Purescript seems to be the most versatile and available of these. It works well both in front and on node.js making it a viable language used in professional fullstack dev.

Scala then is a very solid language running on an widely accepted platform: the JVM. It is a very good all around language, there is no doubt about that. It also has a very good yet complex type system. System that can guide a good FP programmer to discover things about their domain. There are yet few things making it lacking in comparison to Clojure.

  1. Main problem in learning is unlearning. The familiar look of Scala drives people to not learn it. It’s easy to hack something with it but actually using Java with different syntax. Learning first Clojure leads to faster understanding of Scala itself. Adding to this rudimentaries of Haskell helps even more. Learn You a Haskell for Great Good! is a good resource for this.
  2. The unique way of thinking about problems and the language that describes them. This way of thinking is very valid and a good tool to learn for any programmer. Biggest reason for this is the homoiconic nature of the language. The great ability it brings in metaprogramming.
  3. Scala is currently only viable for backend use. Unlike scala Clojure has many supported platforms. It supports JVM, JS including node and browser, and CLR. All which acceptable platforms for business use. This makes it possible to share the same code in front end and backend. With it you can make a consistent whole. Creating front end components that are in sync with their microservice counterparts. In scala this is not possible as Scala.js is lacking in actual production grade stability.

So yes scala is an interesting language but not the best to learn FP. Especially so for Java developers.

Motivation as a driver for effectiveness

It’s actually quite hard to have valid measurements for coder efficiency. Yet one thing we do know. Study after study has found that developer motivation is elemental to productivity.

With unenthustiastic devs its best to inspire them. One of the main benefits comes from the fact that clojure is easy to use and makes coding actually fun again. This is a quote you do hear quite a lot from clojure devs.

As this is about inspiring people, you should go with what is good and nice and feels good and brings joy to you. As then you’ll be more inspiring.

Final words

It also goes down to the provable fact that Imperative Paradigm is more complex than simpler FP. Inside FP clojure is a very very very easy way to learn it. Much easier one to reap the rewards than most others.

If you have a bunch of coders struggling with imperative stuff. And you want to get the benefits of FP as fast as possible. Clojure is the fastest one to learn.

Winning the Competive Edge with Learning Organizations

A learning organization encourages individuals and teams to continuous learning and improvement. Strong values and clear vision head those organizations. And their direction is to work closer to the customer and responding to the change quicker. They tend to learn from others and question their own behaviour. Learning organizations also tolerate flaws and even learn from them. This should be the reality for any agile team and organisztion.

Learning is the lifeblood of organization

lifeblood-1
People face change all kinds of changes in their work life all the time. This means that learning continues in different forms through out the whole career. Also the life cycle of an organization include constant learning. They face new things, operating models, situations and so forth which needs adaptation. And that requires learning. Changes in information technology has increased the need to react faster to change. Real competitive edge comes from that the organization learns faster than its competitors. Thus importance of competence and know-how to success has increased.
Succeeding in fast changing and unpredictable environment demands constant change and recurrence, learning. Only innovative organization can produce better services and end up beating its rivals. Organization’s results must improve all the time. And so the performance of organization and its employee must get better. So effectiveness is dependent on learning. Learning faster than competitors wins you the Competitive edge!

Learning within the team and the organization

Learning is a process where individual gains new skills, competences, experiences and contacts. Learning is in fact creating knowledge by shaping experiences. The process starts from the will to learn from experiences. Then, one should have time to ponder different opinions and facts to gain knowledge. Finally one should understand and apply new knowledge to generate new experiences. And so the learning process starts again.
Let’s look all this from the organization point of view. By following this process, it has the ability to renew itself. This happens by transforming its values, processes and ways of working. In practice this happens by acquiring new competence and make use of it immediately. Organizational learning is also a process that integrates individual and team level learning. Individual learning is often intuitive and interacted to team level as shared knowledge. This can again solidify as practices within the organization.
Learning-Organization
The learning objectives must derive from the strategy. This ensures that organizational learning is more than the sum of individuals’ learning. The organization should encourage and support employees to experiment outside their job description. It should also increase supportive interaction. This can happen by removing focus on single department results and hastiness. Making small everyday insights and improvements beats big radical inventions!
Good contact networks between individuals and teams contributes to whole organization’s learning capabilities. Individuals facilitates continuous learning. Teams enable sharing knowledge. Shared vision and values of the organization guides learning towards something great.

Is the Learning Organization too much asked for?

Every organization learns. But successful organization learns, adapts and changes faster than its competitors. It also allows mistakes. Learning organization guides itself: reduce, crystallize, simplify, focus and see the whole. It balances efficiency, learning and wellbeing.
Learning organization has ten theses:
  1. Learning organization is a whole
  2. Learning organization needs values that support learning
  3. Goal-oriented action requires goal-oriented learning
  4. Learner crafts own motives to learn along the the organizations goals
  5. Knowing and mastering are important. Learning and learning to learn are more important
  6. Give people opportunity to engage – change will succeed better
  7. Management’s mission is to build frames and to support learning in organization
  8. Value the past, but help abandon it
  9. Training is important, but one requires other means too
  10. Don’t start changes if you can’t finish them
The learning organization has many definitions:
It is an undivided whole, led consciously. It’s key organization and individual level factors affiliates into common direction. It focuses on identifying impediments, applying and evaluating means.
A learning organization is one that seeks to create its own future. That assumes learning is an ongoing and creative process for its members. A process that develops, adapts, and transforms itself. It responses to the needs and aspirations of people, both inside and outside itself.
What should we learn within the learning organization? Learning to learn is in the essence. And that leads to reflection, using retrospectives to gain insight on improvement actions. Every task should appear as an opportunity to learn and improve. Learning from everyday tasks links new insights into concrete actions. Ten most valuable learning skills for organizational learning are:
  1. Systems thinking
  2. Models leading internal action
  3. Strategic learning
  4. Feedback systems on individual, team and organization level
  5. Self-management
  6. Team learning
  7. Dialog
  8. Shared vision
  9. Benefiting from information systems
  10. Sharing of knowledge

Mental-model

Want your organization to rock at learning?

Superstar learning organization needs new dimensions to leadership. You need builders and trendsetters. Questioners and facilitators. Provokers and assessors of whole. You need to enable cooperation and collaboration to create lean and progressive organization.
So as a leader introduce principles from Lean to your organization. Remind individuals and teams about relentless reflection (Hansei) – even daily. Show them secrets of continuous improvement (Kaizen) on small steps. Create pattern of retrospectives to support both of these. Consider applying Shu-Ha-Ri into your organization. We in Siili Solutions have done this for example with our Master & Apprentice programs.
Remember to learn daily and that learning should be fun.

Thoughts on Tampere Goes Agile 2017

Last weekend (27th-28th October) I had the honour to attend Tampere Goes Agile as a speaker and guest. This was my first speech in agile conference and I was of course a bit nervous about it. On Friday night we met with other speakers to discuss about next days conference. We got an unfortunate information that the closing keynote will be cancelled. During our dinner we planned the ending of the conference to be a panel discussion around the topics that we found controversial among us. That decided we chose panelists and yours truly was also included. Well, I was anyways going to be nervous the whole day so why not.

trega1.jpg

Saturday started with opening keynote from Mika Turunen on gaining speed for teams. After that I headed to hear what Artur Margonari had to say. His talk was about using and customising existing frameworks and models for agile transformation. Interesting talk how he had applied SAFe®, LeSS with bits and pieces from Spotify’s ways of working. He stated that using best fitting parts for the problem at hand. In his work that worked fine and added transparency between teams and management.

Another interesting speech was about fixed price projects by Teemu Toivonen. He underlined the fact that even within the fixed scope projects can be done in agile way. A lot of the effort goes to managing expectations. You can’t predict the future and the further you go the harder even guessing goes. Or can you tell what is going to happen in next 10 months? If you keep your time for development short your guesses have better odds to be right and responding to changes is possible.

My topic was how to turn negative emotions within the team to a positive goal. Starting from individual level. Starting with finding your problem from distant feeling that something is off. After that working our way towards a happy productive team that wants to develop and move forward. I talked about avoiding the problems that occur when going through this process. There are many of them and I cant say that I included them all to my speech. Well, it’s still a start.

 

trega2.jpg

In total Tampere Goes Agile was a pleasant experience. I met a lot of nice folks and was surprised that many of the themes that used to be ignored were actually a subject to a true discussion. Not just for shouting opinions pro and against.

What can we expect in future? In the closing panel I said: I hope something new and better comes and clears the table. This does not mean that everything old is bad and must go. But as we are constantly changing and improving, there should be new way just around the corner. And of course, we want to be a part of it. Hopefully we can help. At least I don’t want to be the one who holds back change.

 

Employee Engagement – Towards Great Success

Jobs and tasks are now more demanding and challenging than before. Also changes are more intense and rapid. Additionally to this people feel they are in constant hurry and increased uncertainty. No wonder coping at work has become even more important! And coping is not only lack of symptoms of burnout or work stress. It is also not reasonable to describe people’s wellbeing unilaterally from the problem-oriented point of view. Measuring the lack of “badness” doesn’t often lead into actions that increases “goodness”. Thus looking from the flip side of the issue – the employee engagement – is the way towards success.

Burnout in few words

burnout

To make the vocabulary clear, some words from the “dark side”. Burnout’s origins are in the interaction between work environment and individual. The needs and requirements and the person’s requirements are often imbalanced. It often means that the person’s expectations and available opportunities are also lopsided. Typical to burnout are excessive workload, low opportunities of influence, insufficient rewards, lacking the community and justice and conflicting values.

Ok, what about Employee Engagement?

Employee engagement is a state which is general, permanent, positive and affective-motivational. It’s typical qualities are energy, dedication and immersion. Employee engagement doesn’t focus on single point, event, person or act. One can say that employee engagement is enjoying, loving and being proud of the work! People engaged to their job wants to invest in it more, they are persistent and eager to push it even when facing obstacles. They feel their work meaningful and even inspire themselves in challenging situations. So instead of cynicism where temporary experiences of high one feels like being in a constant flow!
i-love-my-job
How can employee engagement be increased within an organisation? One way is to offer them more autonomy so that they seek for meaningful challenges that stretch themselves the right amount at the right time. As Ayala Pines has said:
“To be able to burn out, person must first be in fire.”
It is possible to feel stress and exhaustion without the lacking of autonomy. But I’d like to agree with professor Pines that burnout requires the phase of being engaged. Challenge is to keep the flame of engagement burning at a sustainable pace.
Also certainty in matching expectations and opportunities facilitates the feeling of employee engagement. Constant constructive feedback empowers one to improving oneself. This enables the positive and dedicated state which is the cornerstone of employee engagement. Combining work and personal life gives inspiration and energy.

This all is very interesting… but what next?

So, it is clear that we would like our colleagues and employees to feel engagement to their jobs. Studies states that it’ll lead to higher productivity and increased profitability.

productive-employee-engagement

Giving software artisans and craftspersons the means to reach mastery, purpose and autonomy is way to make us motivated. Daniel Pink elaborates this in his TED talk and RSA AnimationAgile teams with enough autonomy tends to seek the purpose (common goal) and develop mastery (ways of working) in their journey.
But solely bolstering teams in the expense of the individual needs does no quite cut it. Yes, the team is the main unit in agile development, but some attention should give to personal expectations, needs and motivations. Good coaches do this to enable the personal engagement.
So, don’t focus on only removing the things causing burnout. Strengthen things that makes people feel more engagement to their jobs.

Cigars and Serverless IoT

Say what? Cigars and Serverless? What on earth could those two have in common? Maybe not much but bare with me and I’ll let you know.

The background

Some time ago I happened to run into a new Finnish open-source sensor beacon platform. I really wanted to give it a try. What could I do with it? Enter cigars! I came up with a requirement and created a user story that I wanted to implement: “As a cigar owner I want to be able to monitor the temperature and humidity of my humidor regardless of my location so that I know when to add purified water into the humidifier“. My current solution required me to open the humidor and check the meter inside it.

Screen Shot 2017-10-17 at 10.04.16

The brainstorm

Two important non-functional requirements were wireless communication from the humidor so I wouldn’t have to do any physical modifications to the humidor and a long battery life so I wouldn’t have to replace it too often. Both were met by the chosen sensor.

So what else would I need to make it happen? A place where I could process and save the sensor data and visualize it for devices regardless of their (or my) location. Enter cloud! I also had a couple of Raspberry Pi boards lying around so when the sensors arrived I was good to go.

AWS has an IoT service that can listen to messages from things (as in Internet of Things) you have registered to it. You can then do whatever you wish with those messages: save them into DynamoDB, process them with Lambda, forward them to Kinesis etc. Just what I needed. Enter serverless! Have to say I was very exited. I had never done any IoT stuff before so this was going to be a learning experience for me as well.

The solution

First thing I wanted to do was to read the sensor from the RasPi. A little bit of web surfing revealed a small but enthusiastic community around the sensor and I found a python script doing exactly what I wanted. The communication technology would be BLE.

Next thing was to connect the RasPi to AWS IoT service. That was also a no-brainer thanks to AWS documentation. AWS creates certificates and keys for the thing to be authenticated with and an endpoint for the messages. AWS processes the incoming messages with Rules. A rule defines a query that parses the incoming message and action(s) to be performed. The thing publishes it’s messages into a named MQTT topic via the given endpoint and the rule is a subscriber to the same topic.

I chose to save the data into DynamoDB by my IoT rule and implement a serveless website using S3 and Lambda. S3 is an object storage that is perfect for hosting static html files and Lambda is a compute service to run code without having to worry about any infrastructure. My Lambda function fetches the data from DynamoDB table and is called by ajax from html through API gateway.

Finally I wanted the lightest and the simpliest javascript graph library to visualize the sensor data from my humidor. See the screenshot  above. A bit boring graph I know. But luckily it is not an EKG!

At the time of writing this the data is flowing once every 15 minutes from the sensor into DynamoDB and it is read from there by Lambda whenever the html page is loaded. Maybe I’ll implement some alarms next?

Screen Shot 2017-10-17 at 8.27.36

What did I learn?

First of all I learned once again that serverless services are extremely fast and easy to implement for example for prototyping. They enable individuals and businesses to do things that have been impossible or at least expensive in the past. They also make it easy to explore new ways of doing thing and doing business. My rough cost estimation for this solution is 1-2€ per month after the AWS free tier has been eaten. So it is fast, easy and cheap as well.

Secondly I learned a lot about how DynamoDB works. There was quite a few tricks on the way. For example is allows you to set a TTL attribute for a field containing epoch seconds as a string but it won’t do anything.

Resources:
AWS Services: IoT, Lambda, S3, DynamoDB
Sensor: Ruuvitag
Hardware: Raspberry Pi
Source and more details: Github

Why should I choose functional paradigm?

Choosing a functional paradigm language has been a hot topic for a while. Functional vs. Object Oriented Paradigm is a constant discussion topic within the developers.

Before thinking the benefits of FP, the working environment must be suitable for modern work

The key of success at the management point of view is not to micromanage. Let the team choose their working methods and tools. The project is always a compromise between time, features and given resources. It’s all about how the project management sees that triangle.

Every tool and way to work has their own place. Telling the developers HOW to do work instead of WHAT to do is always a problem. It kills creativeness and get the authority outside the dev team. Too often the author is someone who doesn’t know about the actual developer work.

Treat the professional developers with this Sledge Hammer principle: “Trust me, I know what I’m doing”. Developers should know exactly how the program works, because code is the most detailed specification of the solution. It’s all about communication between the people – and between the human and the computer.

When the environment is suitable for working, then we can discuss about the benefits of FP

So why should I choose FP instead of OOP/imperative? What benefits it would bring the table? Here’s some thinking I’ve done in the past years based on my experiences:

Functional programming makes especially list handling a way easier. There are effective functional languages like Clojure or Scala. Another option is to use functional libraries like Ramda or Lodash. I like flexible code, so I prefer using scalable languages, like ES6, Scala, Java8 or C#/LINQ. With OOP and FP combined I have more options available. It’s also a safe choice when there ain’t so much pure functional programmers in the team (yet). Scaling the Object Oriented code with functional flavour is understandable compromise with functional averages like me. Actually I’m on my way of using only functional languages.

Here’s some benefits I found on functional paradigm which could save some money

It’s stateless and then also immutable, so no side effects

Object Oriented Paradigm is all about sharing the lifecycle between the objects. OOP makes problem solving often too complex, and complexity costs. Mutable state makes side effects possible, so code is harder to test with a full coverage. Developing with FP forces to code small functions. Simplified syntax (especially with pure FP languages) gives more time to think the actual business logic. Focusing on one thing at the time is clever.

When the state is immutable, it’s way easier to scale up and still control the whole

When programming high capacity systems, it’s crucial to design the software architecture to be scalable for parallel processing. If the program isn’t handling any state inside the runtime, it’s way easier to scale by using micro services or FaaS container platforms like AWS or Azure. Then the runtime isn’t blocked to serve only one client for a long time – there’s more time to handle many short tasks instead of a one big blocker.
So no more if-else-if-else or switch-case spagetti, or recursive for loop hell. Only function chains like map, filter or reduce one-liners.
It might be hard to transform the brain in the right mode after coding years with OOP. Functional code readability might cause many WTFs in the beginning, but – trust me – It’s worth of it. Like Twelve-factor manifest says “Execute the app as one or more stateless processes“. Start by one and try to write more if it feels right and suitable for the context.
Learning functional programming makes you a better OOP developer. You don’t have to be an expert, but it’s beneficial to learn something new. It’s hard at the beginning, but with the supportive team it’s possible to achieve.
Functional languages are simple by design when you let it be so.

Here’s a recap of my points:

  • Let the developers to choose the right tools and processes for building the high quality solution
  • As a team member, encourage the colleagues at least try to code with FP
  • Functional code is simple and easy to maintain. when it works, it works (no side-effects like in OOP). Broken code is easier to recognise and refactoring is less risky operation
  • Data must persist outside the code (like in Redux architecture). It shortens or eliminates debugging marathons. Less risk for wasting the time hunting the bugs from the production environment

See also:

How not to suck as an agile team member?

Do you think of agile development as an act of freestyling and cappuccino drinking with no plans attached? Let’s just do something and deliver it to the customer, they will surely appreciate it?

I have news for you: that could not be further from the truth. My experience says that agile team and agile team member needs two thing above everything else. Those things are discipline and communication. The latter is quite self explaining (I’ll come to that later) but discipline? Is that like waterfall?

Agile is about reacting to changes and delivering small deliverables often. And to be able to do that a team must have a structured process and agreed ways of working.

Let’s take for example DoD which stands for Definition of Done. DoD tells the team what are the conditions a requirement has to fullfill in order to be called “done”. Like unit tests and code review. What happens if somebody is not disciplined and didn’t write unit tests for a task? The rest of the team thinks that they are done! And yes, I do know that there are ways to make sure that no untested code get’s into master branch in version control. Another example could be a scrum board. What if a team member doesn’t update his/her progress in real time? The rest of the team doesn’t have a clue how the team is progressing. Discipline.

One attribute of a successful agile team is continuous improvement. Of their processes. It is impossible to have a perfect process in place from day one. And if you don’t improve you rot. Teams start with some process and work actively to improve it. One way to make improvement happen is to agree on an intermediate goal and actively work to reach it. Everybody in the team has to do their part. Discipline.

So discipline makes sure that the team is moving into right direction and the whole team is in the same boat. And communication is the way to make sure discipline is in place.