New to programming? 5 things you should pay more attention to

Reading Time: 5 minutes

You decided to start learning programming. You have started to learn programming concepts, you have decided which language you want to learn, and everything looks great.

Except it isn’t.

It’s frustrating; it’s boring; it’s painful. I am not here to make your life easy, but I hope that I will make it a little easier. Here are the 5 things that I believe will help you to become a better programmer.

Find the right source to learn from

I had a professor who said:

“It’s better to spend more time researching where to learn from, than actually learning from one source.”

And this is gold.

Let’s say that you have found a great book or a great video course that everyone is loving. You think that you will love it too, every word that you read/hear in the book/course you will understand, and after you finish it, you will become a master of the things you will learn (at least, I thought like that).

And maybe you will, but probably you won’t. Most (or let’s say, some) of the things you won’t understand, and it’s natural. You will try to read/watch again and again, but it’s not getting any clearer.

My advice is, try to find a great book/course, and start learning from, but use it more as a reference than learning source.

I am not suggesting to only go through the content. Try to understand the concept, but also research it (on Google). Look for more resources, more explanation, more examples. When you will understand the concept, save the source that helped you the most (bookmark the page), and search for examples that you can solve.

This way, it is easier to learn, because you are combining the explanations of different sources, and you are sticking with the most simple explanation that is working for you. Also, research is more interesting than reading\listening the same thing all over again.

Understand the base (minimum) necessary logic rather than implementation

This is important for a few reasons:

  • First, if you understand the logic, it will be easier to learn the implementation
  • Second, the implementation may change, but the base necessary logic won’t

At the very beginning, it will be difficult to differentiate between logic and implementation, and maybe you should try to learn and remember everything, but later try to understand and study just the minimum necessary required things.

I still google some basic things. But because I know what I have to do, I exactly know what to search for (only the implementation/syntax).

With this approach, you will spend your time wisely, and you will be able to learn more important things.

To learn your first programming language is very hard, but that’s because you have to learn programming concepts (the logic). After you learn that, you can learn any language (the implementation) you want, in a matter of weeks.

Code, code, code…

Learning programming is like learning how to drive, except it’s safer (at least, physically). You can read, you can learn, but when you sit down and start to drive, you’ll realize that you haven’t learned anything.

That’s why you should focus on coding. When you study something, try to learn the minimum, so you can start to code, and then code as you learn. There is a great answer on Quora, that mentions 3 rules that you should follow when coding.

  • Write at least one line of code per day
  • First, write code, then refactor
  • No distractions when coding

Here, you can check the answer, that has reasoning for these rules. Maybe you can forget the second rule, but the other 2 are very important.

Attitude

I had to mention attitude. It is a hard path, especially at the beginning, so the right attitude is required. Hard work, believing in yourself, learning to say YES to everything is needed. More precisely, you say NO only when you are 100% sure that it isn’t possible to do. In any other case, you say YES, and you investigate, you try different approaches, you ask for help if it is necessary, you do everything you can. A time will come when you will need to learn to say NO, but first, you have to learn to say YES.

Rest

Of course, don’t forget to rest. You have to rest from the hard work you have done. Most of the stupid things I have done were when I was too tired. When you are tired, you don’t think rationally. You just want to finish your task, no matter. That’s when the biggest mistakes come. You won’t learn anything, you won’t do anything well, you are just wasting your time and nerves.

WeAreDevelopers 2019 Berlin – The Good and the Bad parts

Reading Time: 7 minutes

You can find my expectations here. And here are my actual impressions:

Arrival

The conference took place on the 6th and 7th of June at the CityCube in Berlin. The CityCube is an exhibition site which is located roughly 10km from Berlin centre. My hotel was in Berlin-Charlottenburg, which is a nice area located just 2 stations from the exhibition site.

I arrived late on the 5th of June. Having not really planned my attendance I wanted to check the usual suspects (eg the web page) for more information. But wait. There is an app for that right? And there was. After downloading the app from the Appstore, I quickly set up an account and was ready to take a look. Overall the app was solid (with some bugs or undesired features; later more on that). I found the activity stream pretty useful. The activity stream is like a chatroom where attendees can exchange thoughts. After reading a little bit, I was able to gather most of the important info and got a little bit hyped by the people in the room. There was also an agenda section in the app which I could browse either by date and time or speakers. Each talk or workshop had a brief description. Each talk could also be added to a favourites section which was nice. In that way, I gathered rather quick my favourites and after going through them again by time and eliminating the less interesting ones I was ready for the first day.

Pro-Tip 1: A calendar or timeline section in the app where one could view one’s favourites would be nice. In that way, intersecting talks could be easily spotted.

Day 1

I arrived a little bit early at the venue because in the chatroom there were also some concerns about long queues. The weather was really nice, so I was not really worried to wait a little bit. But the fear of waiting for hours was not justified. There was enough stuff to take care of the attendees. I waited maybe 10 minutes. So all good.

Once I arrived at the main stage I also realized that there was more than enough space to accommodate everyone. With my schedule it went from here like this (Some of the talks I attended):

Welcome by WeAreDevelopers

The usual greetings and organizational stuff. It didn’t take so long so it was okayish. But already here I realized that the sound was really bad. Sitting somewhat in the middle you would get an echo. And that was without any other talks being held in parallel.

Pro-Tip 2: Please test the venues sound properties beforehand and adjust accordingly.

Where Machine Intelligence Ends and Human Creativity Begins – Garry Kasparov

As a starter, this talk was really good. Garry Kasparov is really a charismatic person. The main claim of Garry Kasparov is that eventually a huge amount of (non-creative) work will be replaced by AI. And there is nothing that we can do about it. His conclusion was that it doesn’t have to be a bad thing. We will have more time to do more important stuff.

Business vs Agile – Crimes against development teams continuously committed by management – Gerta Sheganaku

This one I chose based on the title. I was hoping for some entertaining session, actually against management (Sorry I’m a dev). The thing which I’ve got from the talk is that agile works best with top devs in an organization. For this group productivity and “happiness” increases. With diminishing skill set of the devs involved the gains of agile decreases and are even counterproductive in case of devs with decreasing skill set (I do not know how the skill set of devs was measured here and the productivity output either; it’s a company offering, so they have probably some empirical data on this). The fun story was that one consulted company consulted by this company fired almost all stuff based to rehire again for agile.

Lunch

Lunch was an epic disaster. Honestly, I thought lunch was included in the ticket price. It was not. There were around 5 food trucks with different types of food. So this was ok. The problem was that the capacity was way too low. You had to wait like 1 hour in full shining sun to get your food. After waiting for about 15 mins. I decided to go somewhere else to get some food. Doing so I discovered that the part of the CityCube the conference was held in was about 15 min away from the nearest restaurants. Ok, that’s another minus. (PS There was a massive rant about this in the app. Even some invited companies jumped in to deliver some food and free water. Shame, shame, shame…)

Pro-Tip 3: You know how many people will attend. Throughput of the trucks should also be known. Calculate with the worst case.

The Quake Postmortem: The End of the Original Id – John Romero

Yes, this John Romero. The talk was about people, growth, success and the price paid. Romero pictured a small company which was overwhelmed by its “astonishing” success. In the beginning, there is a passion but with success there comes the appetite for larger games and one have to scale. In the end, it’s not about fun anymore. Delivering is what counts. This reflects on the team.

Flutter – Google’s latest innovation for mobile, web, and desktop apps

It was nice. But we have SwiftUI now. Thank you.

Pro-Tip 4: When designing the app, please think about people on a mobile data plan. Scale down pictures posted in the chat (I had like 400MB data usage by the end of the day). 

Day 2

Once in my hotel room I quickly set up my schedule for the last day (Here some of it):

Thoughts on the Future of Programmable Money – Andreas M. Antonopoulos

This talk was epic. Andreas drew a coherent picture of what is wrong with the mindset of closed ecosystems. Starting with castle walls and getting to modern times firewalls was a nice analogy to draw. Eventually we “outgrew” castle walls/castles. Will we be able to break out of closed systems? Andreas has no doubt about it.

25 Years of PHP – Rasmus Lerdorf

I’m not a PHP dev but I wanted to hear the inventor of PHP talk about this un-opinionated language. So Mr Lerdorf is a nice, near to the ground guy. He explained very well that PHP was developed out of necessity. The desire to have a “simple layer” over CGI/C to write programs faster and more readable.

2nd day the lunch situation didn’t really change. There were water and free beer though.

Conclusion

I’m pretty undecided if I would visit this conference again. The speakers were really great but the organisation was seriously lacking.

My opinion on talks from JPoint Moscow 2019

Reading Time: 4 minutes

If you have read my previous parts, this is the last one in which I will give my highlights on the talks that I have visited.

First stop was the opening talk from Anton Keks on topic The world needs full-stack craftsmen. Interesting presentation about current problems in software development like splitting development roles and what is the real result of that. Another topic was about agile methodology and is it really helping the development teams to build a better product. Also, some words about startup companies and usual problems. In general, excellent presentation.

Simon Ritter, in my opinion, he had the best talks about JPoint. First day with the topic JDK 12: Pitfalls for the unwary. In this session, he covered the impact of application migration from previous versions of Java to the last one, from aspects like Java language syntax, class libraries and JVM options. Another interesting thing was how to choose which versions of Java to use in production. Well balanced presentation with real problems and solutions.

Next stop Kohsuke Kawaguchi, creator of Jenkins, with the topic Pushing a big project forward: the Jenkins story. It was like a story from a management perspective, about new projects that are coming up and what the demands of the business are. To be honest, it was a little bit boring for me, because I was expecting superpowers coming to Jenkins, but he changed the topic to this management story.

Sebastian Daschner from IBM, his topic was Bulletproof Java Enterprise applications. This session covered which non-functional requirements we need to be aware of to build stable and resilient applications. Interesting examples of different resiliency approaches, such as circuit breakers, bulkheads, or backpressure, in action. In the end, adding telemetry to our application and enhancing our microservice with monitoring, tracing, or logging in a minimalistic way.

Again, Simon Ritter, this time, with the topic Local variable type inference. His talk was about using var and let the compiler define the type of the variable. There were a lot of examples, when it makes sense to use it, but also when you should not. In my opinion, a very useful presentation.

Rafael Winterhalter talked about Java agents, to be more specific he covered the Byte Buddy library, and how to program Java agents with no knowledge of Java bytecode. Another thing was showing how Java classes can be used as templates for implementing highly performant code changes, that avoid solutions like AspectJ or Javassist and still performing better than agents implemented in low-level libraries.

To summarize, the conference was excellent, any Java developer would be happy to be here, so put JPoint on your roadmap for sure. Stay tuned for my next conference, thanks for reading, THE END 🙂

Impressions from UIKonf Berlin 2019

Reading Time: 5 minutes

With little doubts in the beginning, big uncertainty and the questions in my head “Is this the right conference?”, “Should I’ve chosen another conference?”… But it happened and I’m satisfied at the end of the day with my choice. Some of my colleagues were surprised of my choice (Berlin), but yes, I can definetly say “It was not a mistake”.

So how was it?

Day 1: Social events

I’ve chosen to be with the walking tour group. There were possibilities to be in different groups like Bicycle group, Boat trip group… But this was my choice. We were split into two groups by 12 people and a local tour guide. We visited different spots, like the Memorial to the Murdered Jews of Europe, the popular Checkpoint Charlie, the Berlin French Cathedral, the Brandenburg Gate, etc…

The day finished in a big restaurant where we received our conference badges and promo materials of the conference. It was a very relaxed atmosphere and new chance to meet and introduce yourself to new developers. Some of the participants were professionally oriented and immediately started to talk about iOS topics. Some were on their way to the bar ordering german beers and the popular “wursts”. There also was a small group that played some kind of table tennis game. I’ve attended in all of these social activities.

Day 2: Opening day of the UIKonf 2019

After the opening words and the short introduction, the conference officially started. The first day consisted of 9 presentations. The strongest impression of the day was the presentation of Ellie Shin about Mock Generator for Swift and how they at Uber solved the problem of mocking. They optimized the app to build the mocks in around 10 seconds instead of the previous time needed; it was more than 1 hour.

One of the best presentations of the day was from the lovely Julietta Yaunches. She talked about consistency principles in programming, how to keep the coding style consistent and not make big changes every day, how to decide when to introduce something new in your code, etc.

It were good presentations from Kristina Fox about Internationalization of the iOS applications, and the opening presentation from Kaya Tomas about Accessibility and Inclusion in the apps. A topic I wasn’t aware before this conference.

I also have to mention the presentation of Glenna Buford about how to organize the network stack of your iOS application.

The day finished with a social event named Ambassador’s dinner. The local participants of the conference had the task to show the other participants (foreigners, including me) the typical restaurants and bars in Berlin. I was in a group that visited Hofbrau Munich Restaurant in Berlin. We had some good discussions with colleagues from all over the World. Throughout the evening we enojyed some tasty good german beer and pork meat.

Day 3: 2nd day of UIKonf 2019

The second day had 9 new presentations and 9 new speakers.

The best of the day in my opinion was the presentation of Kate Castellano. She talked about applications with backend driven UI.

Among the better presentations was of Neha Kulkarni about Advanced Colors in Swift.

I will also mention Erica Sadun. She talked about Swift Strings. In her presentation she showed best practices about using strings in Swift, interpolation of strings, etc.

Also there was a choice to visit 2 workshops on MyTaxi boat stage near the conference hall. I visited this stage and it was about the management process, recruiting and organizing the teams in MyTaxi company. The 2nd presentation was about Tips and Tricks they are using for testing their apps.

The day finished with a big party in a local restaurant near the river Spree. It was another good party. A lot of talks with colleagues, a lot of drinks, good atmosphere. All finished at 1:00 am.

Recap

I can freely say it was a good conference, perfectly organized… I didn’t regret in any moment that I’ve chosen this one in a bunch of other conferences. First of all, I’ve learned a lot of new things, I’ve heard about topics I wasn’t aware before, I saw how it would be to talk infront of 500 people.

Maybe in these events the most important thing is the social component. New faces, positive people, talks, sharing experiences, enlarge your professional contact list.

All 18 speakers

I’m not sure what was the intention of the organizers to have only women speakers. 18 speakers – 18 women. It was not explained, but we cannot complain because the speakers dealt with the challenge perfectly.

Worth the money, worth spending my time at UIKonf in Berlin. I have a feeling I will visit it for sure again in the future.

N47 at the Career Days 2019

Reading Time: 4 minutes

Success is no accident. It is hard work, perseverance, learning, studying, sacrifice and most of all, love of what you are doing or learning to do.

Edson Arantes do Nascimento (Pele)

Deeply honoured by the pleasant and heartfelt invitation of our esteemed colleagues from the South East European University in Tetovo, we are pleased to take part in their Career Day in 2019.

But the biggest honour is the point and the moment when you are representing your company at the auditorium and the audience, especially more weight adds in this when you are doing that in front of the students, the future and potential candidates for employment and key factor of making the progress in this segment of our working process.

At the entrance to the University pleasant surprise. Although the day was looked like autumn time, clouds, rain, much less like it was in autumn in late October, but it’s April.

Watch Out Running GIF - Find & Share on GIPHY

But again it was not a problem for the huge number of visitors to the event. The huge parking space in front of the central university building, packed to gather all the guests and participants of the event, it was completely full to the max.

The hall where the event was held, crowded, visitors, presenters, students and guests, photographers, cameras and even tv crews.

Wonderful atmosphere, pleasant and positive experiences, wonderful discussions, presentations to the guests and interested students.

The greatest pleasure is, of course, the moment and honour when you represent your company in front of the outside world and you are familiar with the scope of activities you are dealing with, work and spend your time, but also the idea, the plan and the strategy how it is developed and where it is targeted to act the company in the coming period and in the following years.

Even greater satisfaction is the interest of young students who want and seek practice, their knowledge and the first steps in the software development, programming and digitization segments.

“The purpose of organization of this Fair is to show that the University is very interested to hear the voice and demands of companies. We are very pleased that our academic product is very important for companies and this is evidenced by the massive participation of companies in this Fair. The Career Centre data show that in terms of unemployment of 22% in the state level, over 60% our newly graduated students are employed” – said the Rector of the University in his speech at the opening of the Day.

The Fair was attended by over 80 well-known companies from the country and generally belong to the private sector, but the public sector was present as well, where many educational institutions and non-governmental organizations participated.

Lots of positive talks, good conversations with students, a lot of them wants to be part of our team, internship or later to be employed and regular part of the crew.

The rain outside, but warm sun inside, pleasant, good atmosphere, warm talks and positive attitude.

It’s really nice to be part of this Day, we all hope that the number of this kind of visits till the end of this year and next year will x10 and also the number of students we meet x100.

Our goal and representation of our company here is done and we are fully satisfied!

N47 Playground: Be up-to-date with the latest technologies and don’t waste resources

Reading Time: 4 minutes

Our company is established from techies 👨🏼‍💻 for techies 👩🏼‍💻 and therefore we love ♥️ technology. This passion brings us always forward 🏃🏿‍♂️to learn the latesst technologies and keeps us hungry for solving also our own issues with some cool 😎 and fun-making technologies 🤩.

To be an attractive technology focussed employer

A simple agency lifestyle with working on preselected technologies from clients for a long period can (and will) be boring 😕 for every technology enthusiast. 🧝‍♂️ To keep everybody on a high level of motivation 💪🏻, we think a company has to develop his own spirit and in our case, these are solutions with the latest frameworks, technologies, languages, gadgets,…

How not to waste time and money?

But in agency life is hard to reserve some resources 💰 just for a playground 🎮 or disposable products. Therefore you will need a setup, where you transform the need for discovering 🔍 new areas and costs 💰 into an intelligent investigation 🤑. By this frame, we decided, that every outcome of our playground should result as a standalone solution either for our company or as a resealable product. By doing this, our new unit LABS 🧪 and researchers 👩🏼‍🔬👨🏻‍🔬 are born.

How our unit LABS are working?

First steps into new area!

In LABS 🧪 we get in the first touch with latest technologies and for sure we will face with all the issues ☄️, problems 👮🏻‍♂️, bugs 🐞, challenges 👨🏼‍🎤 and we learn a lot about the bad sides of new technologies. If we overcome all this problems and troubles 🧗🏿‍♂️, we move this new technology from our #playground to #weStandFor, which means that we are that good in that new technology and faced and solved all issues, that can occur. Now we are ready and stand for the latests technologies! 🏆🥇
Thus, the outcome of an e.g. 3 months focus in LABS is a great knowledge about a brand new technology and a gorgeous new product or solution. I think we can be proud of both! 👏🏻👏🏻

The movement of technology from #playground to #weStandFor. Every stack has his own topic leader, so don’t miss changes and updates.

To manage this pipeline from playground 🎮 to the output ✅ we set up a backlog with great projects. Everybody in our company is free to add some projects to our backlog and come up with ideas 💡. In this accelerator program, we decide the sustainability and the potential of this suggested project 📊 and evaluate the sexiness of the technologies 🙀. If we all agree with this internal pitch we plan and start having work and fun! 🥳

What does this mean for our partners and clients?

With our LABS unit, we can offer you an overview and solutions by using the latest technologies 👩🏼‍💻, which can give you more security 🔐, to be an early adaptor 🥇 on your specific market or even save money 💵!

What does this mean for our techies and applicants?

At N47 you have great development possibilities 📈 and learn always new technologies. You are not stuck into a technology for years 🤷🏼‍♂️, that you miss new things. In our LABS unit and also with our Hackdayz you have the opportunity to develop awesome products and contribute a great environment for yourself and your teammates. Join us today in Zurich 🇨🇭, Konstanz 🇩🇪 or Skopje 🇲🇰.

Spring I/O, The Conference in Barcelona – 2019

Reading Time: 2 minutes

Spring I/O is the conference, which is leading the European Conference for the Spring Framework ecosystem. This year it will be the 8th edition and take place in Barcelona, Spain between 16 to 17 May and I’m going to attend it for the first time. This conference is also my first conference for this year, so I’m very excited 😊 about it.

Preparation

Initial preparation is done as mentioned below:

  • Ticket booking, The Conference ✔️
  • Flight booking, Zürich to Barcelona ✔️
  • Hotel booking ✔️

The Conference will take place in Palau de Congressos de Catalunya, Barcelona.

Location Palau de Congressos de Catalunya on Google Maps
The entrance

Topics

Detailed agenda and topics will be available here. But I’m interested in below-mentioned topics:

  • The State of Java Relational Persistence
  • Configuration Management with Kubernetes, a Spring Boot use-case
  • Moving beyond REST: GraphQL and Java & Spring
  • Spring Framework 5.2: Core Container Revisited
  • JUnit 5: what’s new and what’s coming
  • Migrating a modern spring web application to serverless
  • Relational Persistence with Spring Data JDBC [Workshop]
  • Clean Architecture with Spring
  • How to secure your Spring apps with Keycloak
  • Boot Loot – up your game and Spring like the pros
  • Spring Boot with Kotlin, Kofu and Coroutines
  • Multi-Service Reactive Streams Using Spring, Reactor, and RSocket
  • Zero Downtime Migrations with Spring Boot

Apart from the conference, I am planning to visit Font Màgica de Montjuïc, which is near to the conference venue.

I’m open to further suggestions regarding my visit to Barcelona. What else should I visit? Is there any special food that I should try?

Spring Cloud Stream (event driven microservice) with Apache Kafka… in 15 Minutes!

Reading Time: 5 minutes

Introduction

In March 2019 Shady and me visited Voxxed Days Romania in Bucharest. If you haven’t seen our post about that, check it out now! There were some really cool talks and so i decided to pick one and write about it.

At my previous employer we switched from a monolithic service to a microservice architecture. After implementing about 20 different microservices in 2 years, the communication between them got more complex. In addition to that, all microservices where communicating synchronously! Did we build another monolith? I just recently read a blogpost about that on an other site: https://thenewstack.io/synchronous-rest-turns-microservices-back-monoliths/

I tried to recreate the complexity of synchronous communication in microservices in this picture 😅

So back to the topic… This is why I always was interested in asynchronous communication (streams, message bus, pubsub, whatever). I heard a lot from Uber using Google Clouds PubSub, how it’s highly scalable, asynchronous and most important: just cool to use! I was inspired by Mark Hecklers talk “Drinking from the Stream: How to Use Messaging Platforms for Scalability&Performance” and tried it out myself. Of course I’m sharing my experiences and example with you…

Technologies

Spring Cloud Stream

Spring Cloud Stream is a framework for building highly scalable event-driven microservices connected with shared messaging systems.

https://spring.io/projects/spring-cloud-stream#overview

Spring Cloud Stream supports a variety of binder implementations:

We will use Spring Cloud Stream to create 3 different projects (microservices), with the Apache Kafka Binder using the Spring Initializr.

Documentation

https://cloud.spring.io/spring-cloud-static/spring-cloud-stream/2.1.2.RELEASE/single/spring-cloud-stream.html

Kafka

Apache Kafka is a distributed streaming platform. Communication between endpoints is driven by messaging-middleware parties like Apache Kafka or RabbitMQ.

Documentation

https://kafka.apache.org/documentation/

Lets get started!

Prerequisites

So this is all you need to get yourself started:

  • Maven 3.2+
  • Java 7+ (Java 8 highly recommended!)
  • Docker

The idea: Money money money 💰

Let’s build a money printing machine 🤑! So the idea is…

  • Producer
    • Prints money (coins and notes) in different currencies, values and qualities.
  • Processor
    • Fetch money and polish coins/notes to”perfect” quality. This is the quality assurance 😉.
  • Consumer
    • Fetch (spend) money and show type, currency, value and quality.
Three microservices communicating through kafka

Bootstrap your application with Spring Initializr

Create a new project just with a few clicks 🖱

  • Project: Maven Project
  • Language: Java
  • Spring Boot: 2.1.4
  • Project Metadata
    • Group: com.47northlabs
    • Artifact: moneyprinter-producer
  • Dependencies
    • Web
    • Cloud Stream
    • Kafka
    • Lombok
Screenshot from my setup in the Spring Initializr

Implementation of the producer

Create or edit /src/main/resources/application.properties

server.port=0

spring.cloud.stream.bindings.output.destination=processor
spring.cloud.stream.bindings.output.group=processor

spring.cloud.stream.kafka.binder.auto-add-partitions=true
spring.cloud.stream.kafka.binder.min-partition-count=4

The destination defines to which pipeline (or topic) the message is published to.

Create or edit /src/main/java/com/northlabs/lab/moneyprinterproducer/MoneyprinterProducerApplication.java

package com.northlabs.lab.moneyprinterproducer;

import lombok.AllArgsConstructor;
import lombok.Data;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.stream.annotation.EnableBinding;
import org.springframework.cloud.stream.messaging.Source;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import org.springframework.messaging.support.MessageBuilder;

import java.util.Random;
import java.util.UUID;

@SpringBootApplication
public class MoneyprinterProducerApplication {

	public static void main(String[] args) {
		SpringApplication.run(MoneyprinterProducerApplication.class, args);
	}

}

@EnableBinding(Source.class)
@EnableScheduling
@AllArgsConstructor
class Spammer {
	private final Source source;
	private final SubscriberGenerator generator;

	@Scheduled(fixedRate = 1000)
	private void spam() {
		Money money = generator.printMoney();
		System.out.println(money);
		source.output().send(MessageBuilder.withPayload(money).build());
	}
}

@Component
class SubscriberGenerator {
	private final String[] type = "Coin, Note".split(", ");
	private final String[] currency = "CHF, EUR, USD, JPY, GBP".split(", ");
	private final String[] value = "1, 2, 5, 10, 20, 50, 100, 200, 500, 1000".split(", ");
	private final String[] quality = "poor, fair, good, premium, flawless, perfect".split(", ");
	private final Random rnd = new Random();
	private int i = 0, j = 0, k=0, l=0;

	Money printMoney() {
		i = rnd.nextInt(2);
		j = rnd.nextInt(5);
		k = rnd.nextInt(10);
		l = rnd.nextInt(6);

		return new Money(UUID.randomUUID().toString(), type[i], currency[j], value[k], quality[l]);
	}
}

@Data
@AllArgsConstructor
class Money {
	private final String id, type, currency, value, quality;
}

Here we simply create the whole microservice in one class. The most important code is highlighted here. SUPER SIMPLE! Now you already have a microservice, wich prints money and publishes it to the destination topic/pipeline “processor” 👏.

Implementation Processor

https://gitlab.com/47northlabs/public/spring-cloud-stream-money/blob/master/moneyprinter-processor/src/main/resources/application.properties

https://gitlab.com/47northlabs/public/spring-cloud-stream-money/blob/master/moneyprinter-processor/src/main/java/com/northlabs/lab/moneyprinterprocessor/MoneyprinterProcessorApplication.java

Implementation Consumer

https://gitlab.com/47northlabs/public/spring-cloud-stream-money/blob/master/moneyprinter-consumer/src/main/resources/application.properties

https://gitlab.com/47northlabs/public/spring-cloud-stream-money/blob/master/moneyprinter-consumer/src/main/java/com/northlabs/lab/moneyprinterconsumer/MoneyprinterConsumerApplication.java

Docker for Kafka and Zookeeper

Run these commands to create a network and run Kafka and Zookeeper in docker containers.

docker network create kafka

docker run -d --net=kafka --name=zookeeper -e ZOOKEEPER_CLIENT_PORT=2181 confluentinc/cp-zookeeper:5.0.0
docker run -d --net=kafka --name=kafka -p 9092:9092 -e KAFKA_ZOOKEEPER_CONNECT=zookeeper:2181 -e KAFKA_ADVERTISED_LISTENERS=PLAINTEXT://kafka:9092 -e KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR=1 confluentinc/cp-kafka:5.0.0

If you can’t connect, add this line to /etc/hosts to ensure proper routing to container network “kafka”

127.0.0.1 kafka

Start messaging platforms with docker start command

docker start zookeeper
docker start kafka

It’s a wrap!

Congratulations! You made it. Now just run your producer, processor and consumer and it should look something like this

My example

Getting started

  1. Run docker/runKafka.sh
  2. Run docker/startMessagingPlatforms.sh
  3. Start producer, processor and consumer microservice (e.g. inside IntelliJ)
  4. Enjoy the log output 👨‍💻📋

Download the source code

The whole project is freely available on our Gitlab repository. Feel free to fix any mistakes and to comment here if you have any questions or feedback.

https://gitlab.com/47northlabs/public/spring-cloud-stream-money

Live from JPoint, Moscow 2019

Reading Time: 3 minutes

The conference took place at the World Trade Center in Moscow and started at 9 am. It looked like it will be huge from the beginning, well organized and big conference halls. The first step was an attendee registration.

After completing the registration and picking up some welcome packages, we had some starting coffee break and drinks. Also, we had visited most of the big company representative stands, that were in front of the conference halls. You can find interesting free materials there, like stickers, manuals and packages from the company you are visiting.

The next step was the conference. There were four conference halls, each one with different speakers. The opening talk was made by Anton Keks from Codeborne on the topic The world needs full-stack craftsmen.

After the opening ceremony talk, the conference started with different speakers on every track. Some of them were Russian speakers, so we focused on the English ones. Every talk was one to one and a half hour long and after that was a coffee break in the lounge room. There were also two lunch breaks included. In the end, the party at 20:00. You can check the full schedule here.

Day two was completely the same setup, some different speakers or the same one with a different topic. In general, the whole organization of the conference was amazing, like it should be for a world-class event. I highly recommend visiting if you have a chance.

Stay tuned for my next part where I will describe my opinion of the talks that I have visited…

DEVOXX UKRAINE, Here I come

Reading Time: 2 minutes

As a developer, when you need to extend your programming knowledge theoretical, practical, or either or, you need to go to a conference. Also, conferences are a good change to peer others in your field. Unfortunately, most software engineering conferences focus on introducing new technologies more than defining how a software engineer becomes an architect. That makes developer conferences a place to broaden the technical horizons, but not the vertical horizons. Exactly this makes DEVOXX so special. I have already had the pleasure to visit a DEVOXX conference in Europe and other conferences. Check out the articleabout that here!

What we expect from this conference 👤💬?

Normally, I focus on the new technical topics like what is new in Java. What do the new versions of Java offer? However, at this time, I would like to focus on both, the technical topics and software architecture, as it is a massive and fast-moving discipline. I would like to expect some training and insights to help you stay current with the latest trends in technologies, frameworks, and techniques — and build the skills needed to advance your career.

Source: https://earlycoders.com/so-you-want-to-learn-to-code-are-you-a-newbie-programmer-developer-or-a-software-engineer/

Organization to visit Devoxx Ukraine conference

The conference will be held in Kiev. So, my colleague Jeremy and I will be travelling from Zurich airport to Kiev. According to some articles, Kiev is considered one of the cheapest cities in Europe. We will try to explore the nightlife of Kiev. To be honest, I didn’t expect that the conference ticket is so cheap, it just costs 150 usd.

My private trips:

I will write another blog to explain what I and my colleague Jeremy did in Kiev. I can say one thing at the end: “Stay Tuned”!