Pages

Showing posts with label interviews. Show all posts
Showing posts with label interviews. Show all posts

Tuesday, February 18, 2020

Kafka F.A.Q

In here a few questions around Kafka that may appear on interviews. As I will collect more, I will add them to this post. Other Java related interview questions, can be found here:
http://javing.blogspot.com/2018/12/java-developer-interview-questions.html

In the context of Kafka, what does back pressure mean?
It means that a slow consumer should be capable of handling throughput coming from a fast producer.

Do you know any solution(other than increasing partitions) to deal with consumers back pressure? 
- Increasing partitions
- The consumer signals to the producers that they are sending the data to fast(reactive streams can do this)
- Buffering 

Name one advantage and one disadvantage of Kafka?
advantage: using Kafka can reduce the amount of integrations needed in a large ecosystem of applications. This reduction of integrations often results operational cost savings for the company.
disadvantages

disadvantage: order in which events arrived in a multiple partitions scenario is not guaranteed. Using timestamps can help consumers understand the order. If the cluster is being distributed across different time-zones, the event may also need to carry some sort of unique identifier so that alongside the timestamp, the consumer can understand the order. 

Can race conditions happen in Kafka and how can we prevent them?
Race conditions with Kafka consumers can happen and one of the main reasons is that in multi partition scenarios, the order of the events is not guaranteed. In order to guarantee ordering timestamps and/or unique identifiers is needed.

Saturday, February 15, 2020

Restful app demo and explanation (recruitment code challenge)


Today I did a code challenge that a recruiter gave me. Is for a vacancy at a London company.
I thought to record a demo explaining the code that i implemented and some of my thoughts, just to have here for future reference. I uploaded the code to this repo: https://github.com/SFRJ/offers
In the requirements it says to publish in github, so if I am allowed to publish in github, maybe I am allowed to also publish on the blog and on youtube :)

Here the demo:



bonus using vavr(formerly javaslang)
The exercise said that I could choose any tool I like, I was thinking in doing vavr but since is not so well known maybe the reviewers don't like it. But just for myself I decided to modify the code to use vavr and upload it in a separate repository on github(https://github.com/SFRJ/offersvavr). This a very short video with some of the changes i did to introduce vavr:



Update(morning after)
When I was uploading the video in youtube i was just previewing and I noticed there was a little bug. I added tests for it and fixed it. Interesting, this situation made me thing about the importance of QA(Quality Assurance). I did not write automated acceptance tests but AAT are basically programmatic quality assurance. Maybe with AAT I woulda catch that but earlier. Doing the technique used to bring QA before code implementation is called ATDD(Acceptance Test Driven Development). Link to article written in this blog some time back on the topic: 


I uploaded this other video with the explanation of the bug:

 I just noticed that in the video I didn't explain that I refactored that overridden cancel method I was talking about at the end, since that method extraction was not really needed if I call again the repository in both get and cancel methods.

Monday, December 17, 2018

Java Developer interview questions.

I decided to make a compilation of possible interview questions for Java developers. I personally don't really like when in interviews this kind of academically oriented questions appear but unfortunately not every company does live coding exercises.

Hopefully this blog post will be useful as a mind refreshing tool when going to one of those interviews where the interviewer reads questions from a script(sometimes managers or semi-technical tech leads, etc ...) and you have to explain technical things with your own words. 

This compilation are real questions that can appear and they did in fact appear in interviews I've been in, at some point in my career. I will try to include more questions to this video in the future as I remember them.

For Kafka related F.A.Q have a look at
http://javing.blogspot.com/2020/02/kafka-faq.html


What is the equals and hashcode contract in Java?


What is the difference between an ArrayList and a Linked list?


What is the final keyword in java and where it can be used?

Can you describe the inner workings of a Java HashMap?


What is "try with resources" in Java? 


Do you know what "volatile" is?


Can you write code to check if a String is a Palindrome?


How can you reverse a String using Java?


How can you reverse an Integer using Java?

@Component vs @Service vs @Repository



What is database indexing?


Explain asynchronous non blocking calls and what are circuit breakers
                    








Share with your friends