Tag Info

Hot answers tagged

23

That would be super obnoxious. You: Wouldn't be able to see them all at once Wouldn't be able to place comments explaining why things are set the way they are Wouldn't be able to have documentation on what commands do, or what possible options are right in the configuration It would make backing up/version controlling your configs more obnoxious. Using a ...


21

My experience with developing on VMs in a corporate environment is that due to virtualisation of multiple cores being fraught with difficulties, it's difficult to get the kind of performance that many enterprise development machines need. Getting the code-compile-test inner loop to be as fast as possible requires the best machines possible - compilation and ...


17

I don't have a problem with a single config object, and can see the advantage in keeping all settings in one place. However, using that single object everywhere will result in a high level of coupling between the config object and the classes that use it. If you need to change the config class you may have to visit every instance in which it is used and ...


17

INI files have the disadvantage that they can't elegantly represent complex data structures like arrays. Therefore they are only useful for very simple configuration. Using a PHP file for configuration can be viewed as a security problem: Any code might be entered there. Worse, a simple syntax error like forgetting a closing quote could render the whole ...


16

In my opinion this is a huge issue. It tells me that company doesn't understand how their software works and is relying on voodoo to make it work without understanding why it works or why it fails.


15

The same question arises in most of projects I work on. Usually I do this: If the set of possible values is unlikely to change any time soon, I use class/interface constants in the code and enumerable fields in the database. Example: state of publishing of blog entries: 'not published', 'under moderation', 'published', etc. Values will probably change, but ...


14

I think the first one will give you the ability to create a config object elsewhere and pass it to ExampleA. If you need Dependency Injection, this can be a good thing because you can ensure that all intances share the same object. On the other hand, maybe your ExampleA requires a new and clean config object so there could be cases where the second example ...


12

Personally I would only use constants as default values, and let them be overridden by values from a configuration file. If the application takes command line arguments, then those would in turn override the configuration file parameters.


12

It's up to you to define the rules for your app. For instance, you may define that: Whitespace before or after the equality sign is ignored, Whitespace inside the key is forbidden, Whitespace inside the value can be used only if the value is enclosed in quotes, so: say-hello = Hello, World! is forbidden, while: say-hello = "Hello, World!" is ...


12

As a user, I don't expect the whitespace on either side of the equals sign to change the value of the key or the value. See this related question on unix.SE as too how confusing the situation can be. Don't make it harder on your users, trim whitespace from both the key and the value. If leading whitespace has a real use case for either, then let the user ...


11

Configuration Management encompasses "everything else" that's not directly related to writing code. So it's how you manage releases, how you manage and triage bug reports and feature suggestions, how you perform your builds and so on. It often also includes how your source code is managed (e.g. what version control you use, branching strategies, how you ...


11

Martin Fowler and Pramod Sadalage have written an excellent article on this subject. Every developer has his own database to which changes can be made. These changes are then communicated back (as a changeset) to the DBA who implements them in the master database, so he's still involved in the process, he probably knows best about the structures and needs ...


10

When there are a lot of sub-classes of a class which don't differ at all in their behavior (method implementations) and only differ in their values, it is often a good idea to represent them all with one class and read their previously hard-coded values from a configuration file, database table or other data source. To add a new sensor type, you would then ...


9

I would like to add that certain types of development are much more difficult (if not impossible) through virtualized machines. I happen to work at a company where we offer software packages that integrate with a number of different USB peripheral devices (Eg. webcams, label printers, magnetic stripe readers, etc...). Even if I were to map USB ports to a ...


9

If your team find email disruptive or tune it out, something is wrong (they've set their notifications to be too in-your-face, or they're getting too many private emails, or they haven't set up filters/triggers properly). Email is, in my opinion, the perfect tool for this. Set it up right and it will serve its purpose. You could do something silly and ...


9

Most likely, you want a separate file. App.config is for application configuration, whereas what you are specifying is data. Your data store could eventually become a database or json, or whatever else. Keeping it separate will make moving to something else easier in the future.


8

Do not forget about testability! Usually if the behavior of Example class depends on the config you want to be able to test it without saving/modifying the internal state of the class instance (i.e. you would want to have simple tests for happy path and for wrong config without modifying the property/memeber of Example class). Therefore I would go with ...


8

I think YAML is best fit for your case. To my understanding, YAML is the de facto standard format for configuration files that need to be edited by hand. Many programming languages have a library for reading and/or writing YAML. JSON is closely related to YAML, but is little bit less easier to write than YAML, and is used more for communication between web ...


8

In my opinion, the nicest way for Exception handling in C# is the same exposed in this article: http://johannesbrodwall.com/2014/02/07/c-tricks-slimming-down-your-controllers/ (look for "Exception handling") Please note that the same pattern can be used for Java: http://johannesbrodwall.com/2013/09/25/offensive-programming/ The most important concept is: ...


7

As others have mentioned it depends on several things: What does your environment look like? Do you have sufficient access rights to do development? Is your HW up to snuff? Environment Using a VM can help if you are working on multiple versions of a project; multiple projects; or targeting a different OS from the one you normally run (host OS). I do a ...


7

I do all my personal development in VMs. I have several VMs setup for different environments and it works fine. I have a dell studio 15 laptop (quad I7 2.8ghz, 8gb ram, ati graphics) running win 7 ultimate 64bit with virtualbox installed on. I have all my VMs running off an external 500gb usb drive velcroed to the laptop. VM 0 - Win 7 64bit clean install ...


7

I would consider any change that forces a user to modify their code/configuration as a result to be a breaking change. So, in this particular case, I would wait till v2 to introduce the default of enabled=false and would instead add a note in the next minor release that explains this known scenario, that you should explicitly set enabled=false to avoid it ...


7

With PHP in particular; the difference between an .ini file and a .conf.php file is negligible. Using PHP directly for configuration has the distinct advantage of only needing to relate to one well-defined, portable syntax for configuration, and the fact that the configuration file is properly code is occasionally useful. Compared to that; an ini file has ...


7

I'd generally go with option 2 BUT I'd have multiple columns to enforce data type ConfigOption | textValue | DateValue | NumericValue Option 1 Has the additional Benefit that you can very easily "Swap" entire Configurations by adding an Active Column.


7

This is a perfectly fine way of representing tree-shaped data. A file system is a tree database, why re-implement one on top of it? The most well-known implementation of this idea is the Windows Registry. Its main flaw is that it implements a filesystem alongside the filesystem and doesn't support the filesystem API, which means you can't use filesystem ...


7

There are two extremes: Hard-code everything. This has the advantage of being easy and avoids the overhead of configuration. The disadvantages are obvious: maintainability, hot-deploying config changes, varying settings across environments, etc. Make everything a configuration setting. This has the most flexibility at the cost of having large ...


7

The first thing to do is to move to version control without modifying anything. Just get the files in there. If you discover any breakage later you can still retry. Enforce a "lock" on the sources until you reach step 4. Convert everything to a non-binary format. In the case of Excel you should be able to convert to OOXML, or you could go for a simpler ...


6

I segregate groups of related settings with interfaces. Something like: public interface INotificationEmailSettings { public string To { get; set; } } public interface IMediaFileSettings { public string BasePath { get; set; } } etc. Now, for a real environment, a single class will implement many of these interfaces. That class may pull from a ...


6

In our company we are now using the VM for development and testing. Although there are some drawbacks for using VM's the benefits significantly outweighs them. Before we started using the VM's we were having constant problems with setting up development machines for new developers. The first task for new developer in the team was usually to set up his own ...



Only top voted, non community-wiki answers of a minimum length are eligible