Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I intuitively think that an application should be exactly the same in DEV, QA, and PROD environments. However, I have been asked to add a feature to an application that will only be available in DEV environment.

The tool modifies DEV database values and produces an output script that will be tested in QA and afterwards will be used to modify production data. The authentication that allows access to the feature will not be available in QA and PROD environments. I understand that this will work, but is this correct for Java EE standards?

Additional details:

-I removed "best practice" because of the comments below.

-I have a development server and development database, a testing server and testing database, and a production server and production database. I want to know if there would be any possible issues that could arise (and "best practice" for avoiding them) from having a feature of a large application only available on development server.

The feature would modify values in the development database then export a SQL script that has the current state of the development database. The SQL script would then be run on testing database and if every function worked properly afterwards it would also be run on production database. The code that would modify the testing and production databases is not available in either of those environments. I apologize, I know that says basically the same thing as above. If it is still unclear, I will remove the question. Thanks.

share|improve this question

closed as unclear what you're asking by gnat, GrandmasterB, Robert Harvey, GlenH7, Dynamic Dec 19 '13 at 0:45

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question.If this question can be reworded to fit the rules in the help center, please edit the question.

    
What environment is it? Java EE? Java SE? C#? Some thing perl, python, or ruby like? There are different approaches for each of these. –  MichaelT Dec 18 '13 at 16:01
    
recommended reading: Why is asking a question on “best practice” a bad thing? –  gnat Dec 18 '13 at 16:54
    
@MichaelT, It is Java EE. –  Andrew Campbell Dec 18 '13 at 17:34

2 Answers 2

There is the best practice of "dev code never makes it into production". There is also the best practice of "all builds are the same". Unfortunately, these two can make for some difficult decisions and compromises between the two best practices.

If you have to compromise them, the all builds being the same is probably the better best practice. In part because it means you can pull a production build into the dev environment, flip the appropriate switches and be able to investigate the internals with the dev tools available.

One example of this is how logging works. LOG.debug("foo"); only runs in the environments where the debug configuration for logging has been enabled - which isn't production.

Within Java EE, one of the settings available is that of the server/vm settings. With Java, you can use the -D option on the vm to set certain properties that can be queried at runtime with System.getProperty("propname");

With this approach, one could change the VM options to have -Djmoreno.debug which means its running in a dev enviroment.

This can also be put to good use when you have multiple machines in production that need properties (for example file paths)... and you want to only deploy one copy to both - change the option so that each vm knows its file path and then your code remains consistent between the two production deployments.

Its not so much a 'best practice' issue, but rather an inevitable design to avoid bad practices.

share|improve this answer

While I agree that you want all three to be as close as reasonably possible, there are frequently situations where it is unreasonable to make them identical.

Whether this is one or not, I of course can't know -- but it doesn't sound like it. Nothing you've said, indicates that you can't create a seperate utility to make whatever changes are necessary and create your script. Which is what I would suggest doing when you have a feature that is only used in dev (instead of the more common scenario of having a feature that needs to act slightly different in dev).

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.