Posts

Builder Pattern in Rust

Image
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! 

Concurrency in Rust

Image
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!

Add trait in Rust

Image
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!

Closures in Rust

Image
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!

Java Agents

Image
 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 order to test difficult scenarios, pretty much all observability solutions for logs and metrics also have agents. Today I want to share 2 pocs, one using a vanilla java app and doing bytecode manipulation, The second using Spring Boot 2.x and running code forever in a background thread as the app also runs. So Let's get started!

Java Bloom Filter

Image
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 want to share a simple Bloom Filter implementation in Java. So Let's get started! 

Java Bitwise

Image
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!