They also have training for Java Fundamentals that I suggest you check out.
Thanks for making the video, Webucator!
In today’s article, we follow up last week’s article about making Kotlin-like builders in Java and Python, expanding the builder APIs to take some of the optional parameters for more flexibility. We continue on with our HTML example, trying to add tag attributes, such as class, id, and style. Continue Reading
Kotlin is probably my favorite language right now, and possibly one of the coolest things it has to offer is type-safe builders, built upon several features (explained in a bit). I find myself really really wanting to have this feature in my other two primary languages, Java and Python. This article explains what I believe to be the closest we can get to having type-safe builders in those languages Continue Reading
When I first laid eyes on Java 8’s Stream API and found out that it worked lazily (then found out what that meant), I was blown away and utterly baffled. It didn’t seem possible at all. Eventually, I was able to wrap my head around it, realizing it was done with my favorite design pattern: the Decorator Pattern!
In this post, I’m going to go through and write up a simplified implementation, only going through the
reduce() methods. We’ll also be ignoring the ability to parallelize the calls. Lastly, for the sake of readability, I’ll be ignoring
extends in the generics. Continue Reading
Last week, I talked about currying a little bit, and I’ve been thinking about how one could do in languages that don’t have it built in. It can be done in Java, but the type of even a two-parameter function would be something like
Function<Integer, Function<Integer, Integer>>, which is bad enough. Imagine 3- or 4-parameter functions.
There’s also the fact that calling curried functions doesn’t look good. Calling the two-parameter function with both parameters would look something like
func.apply(1).apply(2). This isn’t what we want. At worst, we want to be stuck with
func(1)(2), but that’s not possible in Java. At best, we want to be able to choose
func(1)(2) (calling it with the first argument at one point in time and using the second one later) OR
func(1, 2), depending on our current need. It’s possible to do so in python, so I’m using that. Continue Reading
I love the decorator pattern. It’s the epitome of composition over inheritance and the greatness that can come from it. It also has potential for fluent APIs. In the following article, the writer presents a generic decorating method that I really like, for times when you may extend the list of decorators in the future and you don’t want to add additional methods for them.
Check it out!
Disclaimer: This is going to come off a bit ranty. I’m not as frustrated by the “problems” I bring us as it sounds; rather, it is used to emphasize why my thought processes did what it did. I’m not even going to be using header titles, which is weird for me 🙂
I’ve had a recent thought process about calling functions. It has been ceaselessly frustrating to me how functional languages (and even other languages at times) accomplish a certain goal.
That goal is chaining calls. Continue Reading