style

A collection of 20 posts

A Java geek
  • Me
  • Books
  • Speaking
  • Mentions
  • Focus
Sep 22, 2019 exercise programming style

Conclusion of Exercises in Programming Style

This is the 20th post in the Exercises in Programming Style focus series. Over the course of several months, we worked through chapters of the Exercises in Programming Style book. Everything has to come to an end. But before switching to other interesting subjects, I’d like to dedicate this week’s post to some general thoughts about those articles.

Nicolas Fränkel
Sep 15, 2019 exercise programming style mapreduce

Exercises in MapReduce Style

This is the 19th post in the Exercises in Programming Style focus series. In the last episode of Exercises in Programming Style, we solved the word frequency problem with the Hazelcast library. This time, we are going to use MapReduce for that. MapReduce is a process consisting of two steps: Map performs transformations, filtering and sorting into different queues. Reduce aggregates the content of the queues into a result.

Nicolas Fränkel
Sep 8, 2019 exercise programming style hazelcast

Exercises in Programming Style with Hazelcast

This is the 18th post in the Exercises in Programming Style focus series. The previous week, we shared data among threads to solve the now well-known word frequencies problem. The very next day, I joined Hazelcast as a Developer Advocate. Therefore, I thought it would be extremely interesting to use Hazelcast In-Memory-Data-Grid to improve on the previous solution.

Nicolas Fränkel
Sep 1, 2019 exercise programming style

Exercises in Programming Style: sharing data among threads

This is the 17th post in the Exercises in Programming Style focus series. Last week, we solved the word count problem using the Actor model: objects running on different threads and communicating through messages. This week, we will drop objects, and use data structures that are shared among the threads: such a shared structure is called data space in the book. The original Python code uses two dedicated data spaces.

Nicolas Fränkel
Aug 25, 2019 exercise programming style

Exercises in Concurrent Programming Style

This is the 16th post in the Exercises in Programming Style focus series. In the book, this chapter is called Actors. In software, the actor model is a very specific way to design code: The actor model in computer science is a mathematical model of concurrent computation that treats 'actors' as the universal primitives of concurrent computation.

Nicolas Fränkel
Aug 18, 2019 exercise programming style

Exercises in Programming Style: spreadsheets

This is the 15th post in the Exercises in Programming Style focus series. Last week, we solved the top 25 word frequencies problem with the help of the database. This week, we will get back to solve it with code alone. The design is to model the problem as a spreadsheet. The spreadsheet holds a number of cells, each cell having a value and a formula.

Nicolas Fränkel
Aug 11, 2019 exercise programming style rdbms

Exercises in Relational Database Style

This is the 14th post in the Exercises in Programming Style focus series. So far, we solved the word frequencies problem with code alone. This week, we will solve it with the help of infrastructure. And with this specific problem at hand, what better fit than the database? We can approach the problem by loading the data read from the files in the database, and retrieving the top 25 words with the relevant query.

Nicolas Fränkel
Aug 4, 2019 exercise programming style

Exercises in Programming Style: FP & I/O

This is the 13th post in the Exercises in Programming Style focus series. In this week in Exercises in Programming Style’s post, we will cover one of the foundation of Functional Programming, I/O. In Functional Programming, functions should be pure: a pure function’s return value must only depend on its input parameters.

Nicolas Fränkel
Jul 28, 2019 exercise programming style aop

Exercises in Aspect-Oriented Programming Style

This is the 12th post in the Exercises in Programming Style focus series. This week, we will focus on Aspect-Oriented Programming, a powerful programming technique: In computing, Aspect-Oriented Programming is a programming paradigm that aims to increase modularity by allowing the separation of cross-cutting concerns.

Nicolas Fränkel
Jul 21, 2019 exercise programming style

Reflecting over Exercises in Programming Style

This is the 11th post in the Exercises in Programming Style focus series. This week’s post is dedicated to reflection: In computer science, reflection is the ability of a process to examine, introspect, and modify its own structure and behavior. The original Python solution is handled in different ways: the exec() function.

Nicolas Fränkel
Jul 14, 2019 exercise programming style

Exercises in Programming Style and the Event Bus

This is the 10th post in the Exercises in Programming Style focus series. In last week’s post, we solved the now familiar top-25-word-frequencies-in-a-text-file problem by using Event-Driven Programming. When the number of observer-subject pairs grows, an alternative is to migrate to the Event Bus. The Observer pattern is a messaging pattern: an Observer subscribes to a Subject. When the later emits an event, the former is notified.

Nicolas Fränkel
Jul 7, 2019 exercise programming style

Exercises in Programming Style: Event-Driven Programming

This is the 9th post in the Exercises in Programming Style focus series. In the post from two weeks ago, we solved the problem using Object-Oriented Programming: we modeled the problem space using objects. For an object to communicate with another one, a dispatch() method was made available. Remember before the web was ubiquitous? Graphical user interfaces were already a thing.

Nicolas Fränkel
Jun 30, 2019 exercise programming style

Exercises in Programming Style: maps are objects too

This is the 8th post in the Exercises in Programming Style focus series. Last week’s post was dedicated to OOP. Despite popular belief, the exercise was solved using neither accessors i.e. getters and setters, nor shared mutable state. The solution’s implementation was based on traditional OOP constructs offered by the Kotlin language: classes, inheritance and overriding. Other languages may offer different ways to do OOP.

Nicolas Fränkel
Jun 23, 2019 exercise programming style

Exercises in Programming Style, back to Object-Oriented Programming

This is the 7th post in the Exercises in Programming Style focus series. The post of this week is special, as it’s about Object-Oriented Programming. It’s quite popular nowadays to dismiss OOP. There’s a lot of confusion around it. Some people conflate OOP with accessors (i.e. getters and setters), or shared mutable state (or even both). This is not true, as we will see in this post.

Nicolas Fränkel
Jun 16, 2019 exercise programming style

Composing Exercises in Programming Style

This is the 6th post in the Exercises in Programming Style focus series. Last week saw us using higher-order functions by passing them as the parameter to another function, and dynamically calling them. The parameter passing is quite nice, but it’s not easy to follow the flow of the program. This week we are going to keep those functions, but make use of them in a different way, with function composition.

Nicolas Fränkel
Jun 9, 2019 exercise programming style

Exercises in Programming Style with higher-order functions

This is the 5th post in the Exercises in Programming Style focus series. This week, the chapter is named 'Kick forward'. The style’s constraint is not to call a function directly, but to pass it to the next function as a parameter, to be called later. I’m not sure whether the concept of higher-order functions has its roots in Functional Programming. However, the concept itself is easy to grasp.

Nicolas Fränkel
Jun 2, 2019 exercise programming style

Exercises in Programming Style, recursion

This is the 4th post in the Exercises in Programming Style focus series. This week’s post will be back to fundamentals, as the constraint is to use recursion. Recursion in computer science is a method of solving a problem where the solution depends on solutions to smaller instances of the same problem (as opposed to iteration). The approach can be applied to many types of problems, and recursion is one of the central ideas of computer science.

Nicolas Fränkel
May 26, 2019 exercise programming style

Exercises in Programming Style, Kwisatz Haderach-style

This is the 3rd post in the Exercises in Programming Style focus series. In previous posts, we had a simple problem to handle - find and sort the 25 most frequent words from a file. Then, we had to comply with different sets of constraints regarding the code: first, no variable but a single untyped array; then, only a stack and a heap. This week, the constraint is to achieve the goal with the shortest code possible. For that, the usage of Kotlin’s stdlib is more than welcome.

Nicolas Fränkel
May 19, 2019 exercise programming style

Exercises in Programming Style, stacking things up

This is the 2nd post in the Exercises in Programming Style focus series. Last week, we had our first taste of Exercises in Programming Style. Remember, the goal is to write a simple program, but to comply with some constraints. The previous constraint was that there was only a single variable available, an array. With a statically-typed language such as Kotlin, it required a lot of casting variables to their correct types before using them. This week, the constraint is as radical, but different.

Nicolas Fränkel
May 12, 2019 exercise programming style

Introducing Exercises in Programming Style

This is the 1st post in the Exercises in Programming Style focus series. Recently, my colleague Bertrand lent me a copy of the book Exercises in Programming Style by Cristina Videira Lopes. Among all the books that sit on my reading pile, I decided to put it on top, and started reading right away. The concept behind the book is pretty simple, but very interesting: there is a problem to solve with code - search for the 25 most common words in a text file. But here’s a twist.

Nicolas Fränkel
A Java geek © 2008-2026
v. c90dd4d646b9e4bbf57f27db1c7f530278e83315/13214997907
Latest Posts