Re: [Vala] Use defined pathes inside a method



From: Sascha Manns <Sascha Manns mailbox org>
Sent: Thursday, 20 April 2017, 16:08
Subject: [Vala] Use defined pathes inside a method

i have defined some stuff in my Defines class [1].

What is a good way to use the contents of the properties inside a mathod

or class?

I would create a single configuration object that implements multiple
interfaces. The interfaces allow settings to be grouped. So the single object is
passed around, but a specific interface is given as the type for the argument to 

a service object constructor. This also makes it easier to test a service
object because you need to pass a dummy configuration that only matches the 

interface and not the whole configuration object.

A few bookmarks I've collected over time:
https://softwareengineering.stackexchange.com/questions/114924/config-class-struct-pattern-or-anti-pattern-alternatives
https://lostechies.com/joshuaflanagan/2009/07/13/how-we-handle-application-configuration/
http://stackoverflow.com/questions/12302702/configuration-design-pattern-across-java-system
https://softwareengineering.stackexchange.com/questions/40313/is-a-single-config-object-a-bad-idea

You can have multiple interfaces with the same property name. So you can have quite small
interfaces for different use cases and not worry that the same property is being re-used.
When refactoring the interfaces I find it useful to adjust the interface definition and
then let the Vala compiler point out where the changes need to be made.

I'm curious if other people have a better approach.

All the best,

Al


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]