Builder Pattern is useful when we need to create complex objects(structs in rust case). Also if you want to do a fluent DSL Builder is a useful pattern for that as well. Today I will show how we can implement this Pattern in Rust, so I have a simple POC to show and also a video. So Let’s get started!

The Video

The Code

Cheers,

Diego Pacheco

Originally published at http://diego-pacheco.blogspot.com on July 5, 2021.


Rust has amazing support for concurrency programming. Today I will cover Mutex, Rc, RefCell, Channels, and Threads. I might make a second post covering the rest of the concepts like Arc. Rust dont have green threads since focus on having zero cost of abstractions. However, using channels we have a powerful abstraction to work with threads. Combined with Rc/Arc and RefCell/Cell we have a good foundation for good concurrency programs. Today I want to share 4 small pocs and 4 videos about Mutex, Rc/RefCell, Threads, and Channels in Rust. Let’s get started!

The Videos

The Source…


Rust has this interesting trait called Add which allows us to use the + operator and add 2 structs together. This is very useful for numeric types but also for engineering productivity lets say you are building a DSL for instance or an internal DSL. So I made some implementation and a video — Let’s get started!

The Video

The Code

Cheers,

Diego Pacheco

Originally published at http://diego-pacheco.blogspot.com on July 5, 2021.


Rust allows us to do functional programming. One important thing in FP is being also to pass functions as parameters and also return functions which are also called high Order Functions. Today I want to share 2 videos and 2 pocs showing how we can do High Order Functions in Rust also you will get currying for free :-). I also will show how we can do closures using traits as well. So Let’s get started!

The Videos

Source Code

Cheers,

Diego Pacheco

Originally published at http://diego-pacheco.blogspot.com on July 5, 2021.


Java Agents are an interesting capability of the JVM. Agents can either be Static(Load when the java app starts with a special flag) or they can be Dynamic(using the dynamic API from java we can dynamically bind to a specific JVM PID. Agents can be used to run any code before the app starts or even to change the bytecode. The cool thing about agents is the fact that is a runtime thing and we do not need to change the source code of the target app. Agents are similar to Aspects but IMHO much better. Mockito uses mocks in…


Bloom Filter is a probabilist data structure, created in the 70s. The data structure is used to test if an element is a member of a Set. False Positives(possible in Set) are possible but False negatives(Definitively not in the set) are not. Who uses Bloom Filters? Apache Cassandra, Google Bigtable, Apache HBase, and Postgress to avoid Disk Lookups. Bloom filters are also used by Akamai CDN to prevent one-hit wonders to hit the disk. Medium use Bloom Filters to avoid recommend articles the user already read to the user. Bing, Squid Proxy, Bitcoin, Ethereum also use Bloom Filters. Today I…


Bitwise operations are faster and secure. Highly used in Security/Encryption, Finite State Machines, Graphics, Comunication over ports/sockets, and Bit Fields. Java has support for: AND, OR, Complement, Signed/Unsigned Right Shift, Signed Left Shift. Java does not have Unsigned Left Shift. Today I want to share a simple POC showing all these operations and understanding them in detail. So Let’s get started!

The Video

The Code

Originally published at http://diego-pacheco.blogspot.com on July 2, 2021.


This is not a production-ready neither serious parser, it’s for pure fun! I was bored during one of the pandemics late nights watching Sam Rose’s 3h parser video. So I decided to do something similar, inspired by Sam’s video. Of course, I did not want to make a 3 hours video fighting Rust compiler — which is the ultimate reality but something shorter. The code is similar but I have few more operations like * and inc. I also using a queue for Args not Stack so we can preserve ordering. So this is a cool way to learn rust…


Vector is a core collection in Rust. Vector(Vec) can be used for storing a list of values or even if you need a Stack — it’s your data type. Rust language is pretty fast and secure however dealing with borrowing, ownership, and lifespan lifecycle is a high wall that often you can bash your head pretty hard against it. Returning Vecs and passing them as parameters could be pretty challenging if you were new to Rust. Strings also are pretty challenging in Rust. So today I want to share a video doing common operations with Vecs but always using functions…


Complexity is something that needs to be managed down and is an eternal battle. Part of the battle is to stay away from the style and cosmetical changes. Can we really get 100% of style discussions? Even removing discussions of 2–4 tabs, there will be some form of style on the discussion because every engineer has a background towards JEE, Spring, or Functional. That’s a greater generalization, and there are other “design schools” over there but still quite common to find people within these 3 backgrounds. A Philosophy of Software Design is a great book that explains what complexity means…

Diego Pacheco

Brazilian, Software Architect, SWE(Java, Scala, Rust, Go) SOA & DevOps expert, Author. Working with EKS/K8S. diegopacheco.github.io (Opinions on my own)

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store