Skip to main content

Questions tagged [fluent-interface]

Refers to a practice of coding object-oriented APIs with the aim of improving readability of the interface, normally implemented using method chaining.

Filter by
Sorted by
Tagged with
1 vote
0 answers
86 views

I am coding a NuGet package heavily inspired by Scrutor. I wanted to simplify Scrutor's fluent interface and improve its attribute-based class registration. Thus, I'd like to gather some opinions and ...
Manuel Fernandez's user avatar
3 votes
0 answers
400 views

Part 1 - A fluent unit testing framework in VBA: A fluent unit testing framework in VBA Part 2 - Fluent VBA: One Year Later: Fluent VBA: One Year Later Two (almost three) years have now passed since I ...
Brian Gonzalez's user avatar
1 vote
1 answer
69 views

I have this simple POJO: ...
coderodde's user avatar
  • 32.3k
1 vote
1 answer
554 views

Builder pattern separates object construction from its representation I have to generate username and password for the Account class. Since this operation is a bit ...
nop's user avatar
  • 819
4 votes
0 answers
235 views

A little over a year ago, I asked for feedback on Code Review for a unit testing framework I created in VBA. Development of this project has been off and on for the past year. Sometimes I wouldn't ...
Brian Gonzalez's user avatar
2 votes
1 answer
385 views

This package is on pub dev here It's on Github here ...
Christian Findlay's user avatar
0 votes
2 answers
132 views

I'm trying to make a safe builder using Kotlin that can be partially built and then copied, perhaps multiple times, to avoid repetition. Note that the properties that are reused aren't always the same ...
user's user avatar
  • 539
12 votes
3 answers
3k views

I assigned the following contrived problem in a comparative programming languages course to give students practice with "streaming": Write function that returns the top ten players by ...
Ray Toal's user avatar
  • 765
1 vote
4 answers
249 views

My gut tells me this is poor practice, so, I thought I would ask for some feedback. The goal here is to fake a fluent API design for any class without using reflection while keeping it as pretty as ...
Oliver's user avatar
  • 152
1 vote
1 answer
2k views

[Posted yesterday on Software Engineering, but was apparently "disappeared"...maybe better here] Background: I am just starting to get my head around the idea of separating the domain model from the ...
S'pht'Kr's user avatar
  • 119
7 votes
3 answers
3k views

Inspired by this question by t3chb0t and as an elaboration of my own answer, I have written the following solution. My goal was to reduce complexity both in implementation and use. Eventually - I have ...
user avatar
0 votes
1 answer
163 views

Based on feedback on my previous question, I made many small adjustments to the code, added more APIs and tried to follow through with delivering on the excellent advice I have received in regards to ...
BanMe's user avatar
  • 75
4 votes
1 answer
181 views

The below code is aimed at providing you the most amount of control and flexibility with control which value gets set to a property. I Introduce to you, the ...
BanMe's user avatar
  • 75
0 votes
1 answer
378 views

Problem statement I have entities whose relations form a graph. As an example, let's imagine Users and Groups. Each user has a <...
Turing85's user avatar
  • 137
3 votes
1 answer
293 views

Before I can perform a more or less complex mappings, treatments in business objects and saving results in databases, I often need to validate contents from flat text files or excel files All the ...
NicoD's user avatar
  • 131
1 vote
1 answer
169 views

I was trying to wrap a Logback logger in order to provide some handy methods and already defined default keys of the logged json output and I came up with something like this. Do you spot any ...
Enrichman's user avatar
  • 161
2 votes
1 answer
123 views

Intro This class emulates a switch statement, in order to include non-switchable types (POJOs) have the same switch statement executable for different values be ...
Zymus's user avatar
  • 207
1 vote
1 answer
167 views

I've created a simple API wrapper that I intend a few developers to utilize. I decided to follow an Fluent Interface methodology, similar to this. ...
jon.r's user avatar
  • 429
5 votes
0 answers
371 views

My previous RestClient wasn't disposing a lot of resources. I've fixed it (hopefully without introducing new issues) and because a few new patterns emerged I did a ...
t3chb0t's user avatar
  • 44.7k
3 votes
1 answer
110 views

I have this simple builder here: ...
baant's user avatar
  • 31
2 votes
2 answers
268 views

I'm working on a project where I want to create a API that can be used to do some mathmatical calculations. Here are the important aspects: I used the revealing module pattern I added method chaining ...
codeForBreakFast's user avatar
6 votes
1 answer
1k views

Introduction I have this C++ pathfinding library. My primary requirement is that a client programmer may couple his/her own graph representation and the library will work with that representation. ...
coderodde's user avatar
  • 32.3k
4 votes
0 answers
222 views

I've spent a couple of weeks implementing a simple text editor. The entire program uses only immutable objects and a functional, fluid programming style. After reading about ways to implement Fluent ...
LegendLength's user avatar
2 votes
0 answers
875 views

This library [GitHub] helps merging partial WEB API JSON payload with existing prepopulated DTO objects. Let's say that JSON is represented by JObject from JSON.NET package. Naïve implementation ...
Dmitry Nogin's user avatar
  • 6,131
5 votes
3 answers
973 views

I make my original program more interesting and try to make the builder API more easier to read: Now it's a static method of Builder: Pizza.Builder.recipeBuild(...) ,who bake the pizza with your ...
RainningTW's user avatar
3 votes
2 answers
404 views

I tried to implement the builder pattern of GoF. After searching for almost every related posts/examples on the Internet, I'm still confused. But I found that there are two kinds of patterns, which ...
RainningTW's user avatar
2 votes
3 answers
7k views

I created these little utility methods to build fluent C# dictionaries. The value declarations shall be quick to write and easy to comprehend when somebody views the code. Usage conditions are as ...
Erik Hart's user avatar
  • 311
0 votes
2 answers
102 views

I've a class called MassIndexer.java (on GitHub) and it uses chained invocation for building a batch job. Each method assigns a property of this job and finally the ...
Mincong Huang's user avatar
0 votes
1 answer
220 views

I'm working on a fluent interface builder that takes: an array of strings, each of which becomes a key to an object that is a function that follows the fluent interface pattern a terminator function ...
Mega Man's user avatar
  • 101
9 votes
1 answer
3k views

There's been a lot of questions lately about database provider and repository design especially without entity framework or alike. I thought I try myself to create a reusable framework for this kind ...
t3chb0t's user avatar
  • 44.7k
6 votes
3 answers
154 views

Let's say you want to display something like: One Two Three Four 1 2 3 4 And since you hate the idea of predefining the widths of the columns you ...
candied_orange's user avatar
7 votes
1 answer
222 views

Sometimes I need to auto-generate html-emails. To make this task a little bit easier I created a simple framework that takes care of rendering HTML. Because I'm mainly interested in generating HTML ...
t3chb0t's user avatar
  • 44.7k
3 votes
0 answers
84 views

Accessible apps allow more users to use your app; however, it is usually an afterthought for developers, and it makes your XML layout files messy whether Accessibility was a forethought or ...
Christopher Rucinski's user avatar
3 votes
1 answer
168 views

Sometimes when designing a fluent-api it's important to build an object in a specific way/sequence. I tried to create such a guided builder and came-up with this: ...
t3chb0t's user avatar
  • 44.7k
12 votes
3 answers
4k views

I need to initialize several parameters of an object but I also wanted to make it immutable. At the same time I don't want the constructor to take all several parameters because some of them are ...
t3chb0t's user avatar
  • 44.7k
23 votes
4 answers
28k views

This is a builder pattern implementation to build immutable Person objects: Person class ...
Levent Divilioglu's user avatar
2 votes
0 answers
397 views

I've just completed writing a spec for a Doctrine2 repository. The repo contains only one method so far, the spec for which takes in an OAuth Identity token object (that contains an ID that matches up ...
danbroooks's user avatar
5 votes
2 answers
1k views

Since reading Robert Martin's book "Clean Code" I have been inspired to revisit and refactor some of my code to break it down into succinct methods and small specialised classes. Given the need to ...
Dib's user avatar
  • 355
3 votes
1 answer
1k views

As part of a larger project I've created recently a simple CssBuilder and CssParser. It's composed of three classes and can ...
t3chb0t's user avatar
  • 44.7k
7 votes
3 answers
295 views

Now I have this fluent API for creating random integer arrays. I can say that I want an array of particular length, having a particular minimum/maximum values and using a particular (or default) ...
coderodde's user avatar
  • 32.3k
2 votes
1 answer
457 views

(Follow-up on RPG Character Builder) This implements a fluent interface for RPG game characters. Is this a valid implementation? There are 3 characters: Paladin, <...
Edson Alcalá's user avatar
7 votes
1 answer
1k views

In our automated test framework, written in Java 8, there are different entities representing test data, having different states and transitions between them. To model this behavior, I started to ...
stuXnet's user avatar
  • 171
5 votes
1 answer
120 views

I have attempted doing a fluent API for creating random int arrays, and the following is what I came up with: fluent_arrays.h: ...
coderodde's user avatar
  • 32.3k
7 votes
1 answer
4k views

I've been toying around making my repositories a bit more fluent for a while. I was ending up with crazy long method names when I had to query on multiple conditions. So I've been working on a way to ...
Smith.h.Neil's user avatar
7 votes
2 answers
502 views

In this answer I suggested using a fluent interface "builder" to replace all the hard-coded, repetitive and quite error-prone inline XML string concatenations. This code might need a bit of tweaking ...
Mathieu Guindon's user avatar
10 votes
6 answers
3k views

I would like to improve the interfaces of some polymorphic classes going from positional to named parameters and I came up with the fluent interface. The following is the most clean, compact and ...
DarioP's user avatar
  • 917
8 votes
1 answer
907 views

I wanted to try experimenting with fluent interface design in the C programming language. That's why I wanted to ask you, Dear Code Review users, comments on the way I have implement this simple ...
otto's user avatar
  • 277