Posts

Showing posts from July, 2020

Quarkus with Panache

Image
Quarkus is a super interesting project.  IMHO Quarkus is JEE done right. It's super-fast, relies on Netty, uses GraalVM . Today I want to share a video I made about Quarkus with Panache using the Postgres database running on Docker. So Let's get started.  Video Code https://github.com/diegopacheco/java-pocs/tree/master/pocs/quarkus-hibernate-panache-fun https://github.com/diegopacheco/java-pocs/tree/master/pocs/quarkus-jpa-mysql-fun Cheers, Diego Pacheco

Spring-Boot-2 with Kotlin

Image
Kotlin  is a Jetbrains language that has lots of inspiration from Scala. Spring-boot-2 is a popular solution for microservices like Quarkus and Micronaut . Today I want to share a simple video I made so you can get started with Maven, Spring-Boot-2, and Kotlin. If you are new to Kotlin I also recommend seeing my previous post about the language. Okay, let's get started. 

Kotlin 101

Image
Kotlin is a JVM language created by JetBrains in 2011. Google declared the official preferred language for Android in 2019. Kotkin is heavily inspired in Scala . Kotlin claims to have the good parts of scala without having the bad parts. It's also possible to see some Python and Groovy influence as well. Kotlin makes java much less verbose and has awesome support in sense of IDE thanks to IntelliJ. I'm a Scala guy and prefer scala, however, kotling is an interesting choice especially if you are making android native apps. So today I want to share a video I made with a good walkthrough through several features of the language in a Maven project. So Let's get started!

Property Based Testing with Jqwik

Image
Property-Based Testing in a really nice functional programing way todo testing. Originally created at Haskell with QuickCheck . Today there are frameworks for pretty much all languages.  Jqwik is a property-based testing framework for java.  Property-based Testing is cool because you focus on a predicate / boolean expression and forget about inputs. When I say forget about, thats happen because the property based testing takes care to generate all possible inputs for you and you can save lots of typing, creating uses cases. You still need to work in your property/assertions however you end up writing much less code and cover a much wider range of possible inputs.  Today I want to share a video I made about it, so let's get started.

Immutables Builders

Image
Fluent Interfaces(Internal DSL) are a nice and sweet way to code. However, make a builder in Java all the time can be a bit verbose and time-consuming. Immutables Builders is a very interesting library that can help us with the heavy lifting.  Immutables can generate builders which are Type-safe, null-safe, and thread-safe. They are super easy to use and serialization ready. Immutables make your code clean and fun. So today I want to share a java video made about Immutables Fluent DSL in Action. So Let's get started. 

Swagger + Spring Boot 2

Image
Swagger is a great API documentation tool. Today I will show how we can generate Swagger Documentation based on a Spring-Boot-2 Application. We will be using SpringFox . Swagger is interesting because you have a very useful contract for services/microservices. It's possible to generate code from that spec and also invoke the services. Spring-Boot is a popular java framework for services/microservices the integration between to solution is more than ideal and SpringFox does that for us effortless. So Let's get started! Video Code https://github.com/diegopacheco/java-pocs/tree/master/pocs/spring-boot-2-swagger-fun Cheers, Diego Pacheco

AssertJ

Image
Everybody write tests or we should at least. Assertions are used in lots of different kinds of tests such as Unit Test, API Test, Integration Testing, E2E Testing, Contract Testing, Stress/Load testing. Unit tests, Integration, and Contract tests can often be done with Junit . However, assertions sometimes can be a bit verbose and you might need to write some extra code in order to test what you are required to test. Today I want to share a video about a library for Java called AssertJ. AssertJ is Assertions fluent API.  AssertJ has integration with other java libraries like Guava, JodaTime, and others. Today I want to share a video I made about it. So Let's get started. 

Hashing in Java

Image
Hashing is an interesting technique we need to use in standard java solutions such as services and microservices. SHA-256 is a secure hash algorithm for data you want to hash. Often this technique can be used for Passwords or high entropy PII Data.  For this blog post, I want to share with you guys how we can create secure hashes in java using SALTS. We will be experimenting with 4 flavors of Hashing(SHA-256) being: Standard Java API , Guava , Apache Commons Codec, and Bouncy Castle . Today we will see a Java video I recorded going through the API. So Let's get started.

Sidecar Pattern

Image
There are several architectural patterns we can follow when we need to distribute a shared piece of software. My favorite and default pattern is Service Pattern. However, there are other patterns for software distribution.  If we think about startups for instance there is a popular tool called Lean business Canvas where you model the business model of your startup and there are many dimensions there but one particular dimension called "Distribution Channels" is highly related to the subject of this blog post. We, as engineers often just think about one dimension with is either a Service or Binary shared library.  However, there are other dimensions we could explore. The other options are Tooling, Internal Services / Self-Service Platforms, Runtime Platforms, and Service Mesh. So for this blog post, I want to cover a little bit more the Sidecar Pattern. 

Micronaut

Image
Micronaut is a JVM(Java, Groovy and Kotlin) framework similar to Spring Boot or Quarkus. Micronaut is modular and blazing fast. It has a minimal memory footprint and is a bit cleaner API compared with Spring Boot for instance. Micronaut does Reflection based IOC(with Cache). Micronaut also has GraalVM support. Micronaut is a non-blocking IO and has a Reactive API based on Netty and Rectivex projects. Today I made a quick video going trought the Micronaut API DEMO I made. 

Core Design: Avoid coupling at the Core

Image
Software Design it's a huge sub-set of Software Architecture. Software design is really about the domain and the designer. Good design takes time to make and it's not a one-size-fits-all solution. In order to have a good design, you need someone who first of all cares about design and study design a lot. In order to improve as a Designer you need to:  * Write code  * Read code (a lot)  * Think about responsibilities  * Think about bringing things together  * Think about braking things apart * Do and participate in Design Sessions  * Time and Experience  There are several schools out there like Services, OOP, FP, and many others. IMHO there are some CORE ideas that we can use besides your language, school of thought, and experience.  Knowing what not to do is as much important as knowing what to do. For this blog post, I want to talk more about CORE Design.

Code Forensics

Image
Troubleshooting it's a very interesting skill-set. Often engineering teams dont expose this issue. People are always fixing bugs but very little we are talking about bugs(investigations).  Being able to run investigations(Fix bugs) is a must-have skill in a cloud / distributed systems world that we live. I believe troubleshooting is someting much more strong in SRE/DevOps than it is on engineering. I deeply believe we can and we should improve our debugability tools, tricks, and techniques not only because we want to build better user experiences in digital products but also because we want to spot major trends and fix and improve our overall engineering process and products.  Today I have a slidecast for you guys, so let's get started. 

JUnit 5 Tricks

Image
JUnit 5 is much better than previous versions. Testing is something every engineer should be obsessed about it. Junit 5 improved a lot the assertion API being much more clean, easy to use, and concise. Today I want to share a video I made about Some cool JUnit 5 tricks. I should make this post a long time ago, however is better late than never :-)  Let's get started.

Double Down on Service Orientation

Image
Service-Oriented Architecture( SOA ) is not new. Microservices which are a specific flavor of SOA are the default architecture you will find out in digital products. I'm not sure if Microservices will be here for much longer . However, thanks to the silicon valley, companies can be structured in 2 organizations(Which is a good thing IMHO). Product and Engineering organization. An engineering organization means that you create software for your product engineers to be more productive and focus on the product and improving the user experience. Engineering organizations have different ways they could be distributing software. Software distribution is a fascinating theme for me. There are several ways we can distribute software however we often dont consider other distribution models. As your company grows and depending on your business segment you might have several specializations insider engineering like Data Science, Security, Big Data, Architecture, Storage, Mobile Devices, and so

Spring Boot 2 running with Netty

Image
Spring Boot 2 - It's the default Java way to implement REST endpoints and microservices nowadays. I really miss old days of spring where we used XML and there was no coupling and spring was really lightweight. IMHO Spring is great if you use it under a service, If you use a shared library of the big framework, you can easily get Binary Coupling which will be bad for you in the long run.  Today I want to show how easy is to use Netty. Using netty directly is not that hard and really anyone can use without spring. Netty comes as default dependency if you use webflux instead of the web. So Let's get started. Video Code https://github.com/diegopacheco/java-pocs/tree/master/pocs/spring-boot-2-netty-fun Cheers, Diego Pacheco

Serde Benchmark

Image
Serialization is always an important aspect of any Microservice or solution. Often people associate Benchmarks as potential flame-war enablers, thats not my goal here. Benchmarks are sensible things, they really vary from config, hardware, use case, payload. I'm trying to convince you guys of anything. I'm Just sharing some simple comparison exercise I did so you guys have any idea about performance to Serialize and Deserialize and the resulting size. I highly recommend you do this benchmark for you use case. However, my pet project here might give you some ideas on how to get started. The benchmark I will show is coed in Java but you can take this ideas and do them in any language. I will use Junit as way to run the benchmarks. So let's get started.