When to use Modules / Concerns?

An article, posted about 2 months ago filed in ruby, rails, ruby on rails, service, architecture, when to use & modules.

Whenever your model gets too heavy?

The easiest way to clean up your classes might be to create smaller, more concise methods. The next easiest way of tiding up your models is moving stuff to modules (whether they are 'Concerns' or not). Modules can then be included in the final classes. It will lead to a crowded list of methods exposed on these classes, for which alternative solutions exist (Presenters, Decorators), but if you shield off private methods nicely and have a consistent way of naming things, I wouldn't be too concerned about that. Note that having many modules used in only a single class might be a code smell: perhaps you're trying to do too much with that single class.

Concerns or Modules?

When you're using Rails, you can make use of Concerns. They offer a few advantages over traditional modules, so use it whenever you're bothering recreating the same behaviour using plain old ruby Modules. I prefer consistency, so if you've adopted Concerns, use con…

Continue reading...

When to use Form-objects?

An article, posted about 2 months ago filed in ruby, rails, ruby on rails, service, architecture, when to use, async, form & models.

When necessary.

It depends. By default I would advise against them; not creating Form objects to receive and validate data that could be validated by the Model directly. Even when you have a few nested attributes that belong to the main model modified, I would advise against Form objects. Keep It Simple.

But… sometimes you have more complex forms that don't fit the database-mirroring model as nicely.

Continue reading...

When to use Job (or Worker) objects?

An article, posted about 2 months ago filed in ruby, rails, ruby on rails, service, architecture, when to use & async.

Always.

When you are able to do stuff async (not blocking the web-request), make it async. It will also reduce the need for a category of Service-objects. Worker or Job objects can often be called inline if desired.

Sidenote: I personally prefer the "Job" object name, a Job that needs to be performed. Worker is a name that was popularised by Sidekiq, but Sidekiq moved to Jobs as well.

Continue reading...

Tag descriptor

When to use...

An article, posted about 2 months ago filed in ruby.

I've got some opinions about certain ways of setting up more advanced (mostly Rails) applications. These might be short 'posts' which I might return to later. Let's see how it goes :)

Continue reading...

When to use Service-objects?

An article, posted about 2 months ago filed in ruby, rails, ruby on rails, service, architecture & when to use.

Never.

There is of course never an absolute answer to stuff but if you are running it in a background job anyway have you considered directly writing it in a Worker or Job-object? Note that you can always run jobs async when needed.

My main objection against service objects is that all too often they are ill defined as a category. So while having fat controllers or fat models may be a bad thing, just creating a bunch of somewhat arbitrary 'Services' is not making the code more manageable.

When considering adding a 'services' directory to your app, try to think of what class of problems you want to tackle. And when in doubt, just keep messing around with the somewhat fatter models & controllers.

Continue reading...

(Web/View) Components: Should everything be a component?

An article, posted 2 months ago filed in components, design system, structure, todo, programming, development, front-end & html.

Recently I was reviewing a merge request of some front-end code, and a simple div, that changed a bit of the custom appearance of a block of text through a few custom classes, was changed in a call to a view component that then applied the same classes, passed onto the component through a more deeply nested hash.

> -
> + ’itis ](https://en.wiktionary.org/wiki/divitis) you get ‘TextComponent’-itis.. we don’t add better semantic or structural information to the page layout

Instead?

Keep the code as is. And perhaps create a ticket (or annotate it with TODO:) that you perhaps want to extract this ‘custom-class’ call into a true reusable component. While I don’t think there is something inherently bad with offering the option to override or add some custom classes to a component, a component should only be used if it adds structural meaning either from the developer's side of things or (better) from the consumer’s side of things (e.g. semantic output that can be p…

Continue reading...

How I purchase e-books

An article, posted 9 months ago filed in amazon, kobo, ebooks, epub, revenue & usability.

I have a Kindle e-reader myself, but don't like a single monopolist like Amazon to control the market. So I try, whenever possible, to skip their market place. And that is perfectly possible. But say goodbye to one-click shopping.

(same argument probably also applies to the Kobo store, another popular eReader-manufacturer, but perhaps less evil for not being Amazon and supporting 'local' shops, e.g. Bol.com in the Netherlands… which is basically the Amazon of the Netherlands, oh well…)

The alternative

Many books these days come without DRM(!) … they're still watermarked, but that doesn't stop you from converting books.

So, it takes some dedication but my approach is:

  1. To search for the book's publisher, check their website for a purchase link and purchase it there.
    • Or use libris (Dutch independent booksellers collaboration), which allows you to pick a local Libris connected bookshop, and purchase an e-book from them.
    • And…

Continue reading...

Tag descriptor

Analytics

An article, posted 10 months ago filed in analytics, privacy & gdpr.

How many people are visiting my site. What are the most popular pages? How did they reach me? How do they navigate my site. Data about this can help you make informed decisions on how to improve your site or app. Sadly this often comes at price: the privacy of your visitors. Alternatives exists for the major brands, and you can also collect some of the statistics yourself. Either using a self-hosted solution or just by analysing your log files. Yes, awstats still exists.

Continue reading...

Tag descriptor

pupprb

An article, posted 11 months ago filed in rubygems, ruby & gem.

pupprb is a simple wrapper around puppeteer, a tool maintained by Google Chrome engineers, which I primarily use to print PDFs. This gem simply wraps my default settings / approach in a relatively easy to reuse gem.

Source: @gitlab Rubygems: pupprb

Continue reading...

Dienstverlening

An article, posted 11 months ago filed in werk, murb & prijzen.

murb levert diverse diensten aan. Centraal voor binnen de dienstverlening zijn de principes van murb.

Maatwerk (web)applicatie ontwikkeling

Naast eigen diensten staat murb u graag bij om in een korte tijd nieuwe oplossingen te realiseren waarmee gewerkt kan worden. Waarna vervolgens doorgewerkt kan worden aan het verder verbeteren van die oplossing. Neem contact op voor de mogelijkheden.

TheStoryBehind.it

Met TheStoryBehind.it kunt u uw online kunstcollectie gemakkelijk ontsluiten voor de buitenwereld. Dit kan op basis van een eenvoudige excel file of middels een API-koppeling. Met CollectionManagement kan ook de collectie beheerd worden. TheStoryBehind.it is in te zetten vanaf €275 per jaar. Neem voor de mogelijkheden contact op.

HeerlijkZoeken

[HeerlijkZoeken.nl](https://heerlij…

Continue reading...

Triodos en de certificatenhandel

An article, posted 12 months ago filed in Triodos, certificaten, systeem, bank & geld.

De Triodos Bank staat vandaag voor de rechter in verband met diens problemen met de certificaten.

Die certificaten van Triodos zijn een soort van aandelen, maar niet helemaal. Ik heb er op papier zo'n best wat mee verloren. Ze maken echter deel uit van mijn pensioenpot (ben zelfstandige), die uiteindelijk, op de langere termijn dus, enigszins de inflatie bijhoudt. Maar de rechtszaak vind ik echt een vreemde.

De certificaten waren een balans tussen het bewaken van de missie, steun in kapitaal, en meedelen in het rendement, puur op basis van de ingeboekte resultaten, niet op basis van vraag en aanbod van iets een afgeleide.

Ik wil niet dat de bank verkocht wordt en een speelbal wordt van rauw kapitalistisch geweld op een beurs. Zeker niet omdat de handel in een afgeleid stuk papier dat los sta…

Continue reading...

On AI art

An article, posted more than one year ago filed in art, intelligence, ai & stable diffusion.

If you love art, don't bother reading any further. I'm stating the very obvious, but I felt I had to respond. It's NFT-style hype (in Dutch) all over again.

My Twitter timeline contains probably more than average amount of generated AI images, and it is labelled as AI “art”, generated by tools like DALL-E, stable diffusion, mid journey, tools that allow simple beings to create a Monet style picture of a 21 century scene, or complete the scenery of the milkmaid. And the way it is presented angers me.

While being quite impressive in terms of “how did the computer do this”, I hate to state the obvious, but: this is not art. In the end it is just more visual debris. You may put a frame around your Van Gogh 1000pc puzzle, it is not the creative work, even though you spend a day “creating” it. You’re also not an artist if you completed a 15 week course in landscape painting. Nor is probably your beautiful holiday picture, even thoug…

Continue reading...

Overwegingen warmtepomp in een VvE appartement

An article, posted more than one year ago filed in duurzaam.

Ik woon nu twee jaar in een appartementencomplex. Gasloos gaan in een volledig eigen huis is complex, in een appartementencomplex met een VvE is misschien allemaal net weer wat complexer (al is het effect wel weer groter als eenmaal de kogel door de kerk is). Het complex voldoet aan energielabel A; het is een relatief nieuw complex uit ~2010. Momenteel zijn we nog zonnepaneelloos, maar daar wordt inmiddels aan gewerkt :) Deel twee is dat de appartementen gasloos kunnen worden (of in ieder geval duurzamer verwarmd kunnen worden). En dus kijken we naar warmte pompen. Hieronder wat ik daarover nu weet (dit is een iets aangepast bericht dat ik naar wat geïnteresseerde mede-bewoners had gestuurd):

De bodem in? Of uit de lucht?

Een warmtepomp kun je doen ter ondersteuning van een CV installatie, of om volledig elektrisch te gaan, iets waar ik erg in geïnteresseerd ben: Om niet langer fossiele brandstoffen te verstoken en de gasaansluiting niet meer te hoeven hebben. Sinds kort …

Continue reading...

Over NFTs

An article, posted more than one year ago filed in crypto, NFT, web3, decentral, altcoins, bitcoin, tokens, notaris & copyright.

Non-Fungible Tokens, ofwel NFTs, zijn in de tech-wereld alweer over de hype heen, maar in de mainstream media worden ze nog gepusht. De druppel voor mij om dit stukje te schrijven was een column van Ernst-Jan Pfauth in de NRC.

Vaak worden NFTs ontvangen als dé nieuwe manier om elektronische kunst te verkopen. Veelal wordt er gewezen op de enorme opbrengsten en het soort bescherming dat het zou brengen voor de maker.

Geld voor kunstenaars!

De opbrengsten komen vooral voort uit een luchtbel die momenteel bestaat in de crypto-munten zoals bitcoin en Ethereum. Early adaptors zijn op papier stinkend rijk geworden omdat de koers van hun crypto-munten gigantisch zijn gestegen, doordat ze door de hype steeds weer nieuwe kopers van cryptomunten hebben weten te vinden. En wat doe je dan met dat crypto-geld?

De numerieke waarde van kunst voorzien van NFTs is onderhevig aan hyperinfla…

Continue reading...

Over crypto

An article, posted almost 2 years ago filed in crypto, web3, decentral, altcoins & bitcoin.

Er zijn nog steeds mensen die geloven in crypto-currencies. Tijdens ieder conflict wordt het vaak weer geroemd om de a-politieke karakter. Zeker wanneer b.v. een Visa, Mastercard of ander systeem om geld uit te wisselen transacties gaat blokkeren.

Het wordt ook gezien als de oplossing van geld. Ons geld is eigenlijk een soort vertrouwensovereenkomst. En die wordt vervolgens ook nog eens gestuurd door een centrale bank die invloed heeft over de waarde van ons geld. Niet iedereen is daar over te spreken.

Maar het zorgt wel voor stabiliteit en over het algemeen vinden we dat fijn; de meeste mensen zijn gebaat bij een stabiele munt waarvan ze weten dat deze over een maand nog steeds een bepaalde waarde representeert. En dat vereist ook dat er soms ingegrepen dient te worden. B.v. op de rente, uitstaande schulden. Het is complex, het is niet neutraal, maar het dient, ik ben van goed vertrouwen in de instituten, de meeste mensen.

Ja. Misschien moet de rente wel omhoog om de infla…

Continue reading...

murb blog