aspose file tools*
The moose likes Servlets and the fly likes Development environment vs Deployment environment Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Development environment vs Deployment environment" Watch "Development environment vs Deployment environment" New topic
Author

Development environment vs Deployment environment

Ryan McClain
Ranch Hand

Joined: Nov 27, 2010
Posts: 106
Why does the development environment have to be different than the deployment environment? Different in the sense of project/folder location.

Could I not simply have this structure under the Tomcat root and make it work?
Just pass in the classpath for the javac and that's it?

webapps
|
ch1\
|
web-inf\
| web.xml
classes\
| Ch1Servlet.class
src\
| Ch1Servlet.src
|
etc\
|web.xml

Or is this a bad design?
What is the reason for separation of these two environments? Cleanliness? Maintainability? It is not immediately transparent to me as of yet.
E Armitage
Rancher

Joined: Mar 17, 2012
Posts: 892
    
    9
Not sure I get the question but the development environment will contain the source code while the deployment environment will only contain the executable artifacts.
So e.g your deployment environment won't have a compiler at all. The development structure should make it easy for the developer to work on the sources while the deployment env is optimized only for executing the executable.
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12781
    
    5
Personally I can't imagine working on changes and additions in the deployment environment.

A simple ANT task takes care of deploying a new build.

How would you support working on a new version while keeping existing customers happy?

Bill
Ryan McClain
Ranch Hand

Joined: Nov 27, 2010
Posts: 106
I suppose with a versioning system.
E Armitage
Rancher

Joined: Mar 17, 2012
Posts: 892
    
    9
Ryan McClain wrote:I suppose with a versioning system.
But you have only one deployed version. Also, deployment strategies differ for different environments (operating systems) and sometimes even between different clients using the same source code. The fact that your source code doesn't get deployed to to deployment environments really makes it pointless to mirror the same folder structures.
Ryan McClain
Ranch Hand

Joined: Nov 27, 2010
Posts: 106
E Armitage wrote:
Ryan McClain wrote:I suppose with a versioning system.
But you have only one deployed version. Also, deployment strategies differ for different environments (operating systems) and sometimes even between different clients using the same source code. The fact that your source code doesn't get deployed to to deployment environments really makes it pointless to mirror the same folder structures.

I don't understand your last sentence.
Ryan McClain
Ranch Hand

Joined: Nov 27, 2010
Posts: 106
I should mention that I am following the book 'Head First Servlets & JSP'. They laid out a folder structure there for the reader to follow. Chapter 3, page 72.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61202
    
  66

Most developers don't even develop on the same system that they deploy upon. Like others, I develop on a local machine, then use Ant builds to create war files that I deploy to remote servers dedicated to deployment.

Are you advocating doing development in the actively deployed application?


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Ryan McClain
Ranch Hand

Joined: Nov 27, 2010
Posts: 106
No, I am not advocating that. I did not know that development and deployment were done on separate machines. I simply noticed that if I am on my local machine and I combine the development environment and deployment environment together, I assume Tomcat is not going to give me errors. I am just combining three specs. Servlets, JSP and Java 1.x. I know that the setup is a mess, but I am not adhering to any technical constraints. I am simply messing around with the system out of curiosity.

So what I am doing is a pure hobbyist practice. If I am following the book I might as well try out my curiosity on the technologies. That way I will learn more. Just like authors in the book advocate that one should best start bare bones with a text editor, a Tomcat installation and a Java installation. No fancy IDE/helper tools (such as Ant). I will move on to those later. First, I am going to study the entire book bare bones, then I am going to study it again using tools. People don't become great HTML developers by using Dreamweaver the first time around. They become it by using notepad - no syntax highlighting, no warnings, no error warnings.

That being said, I presume that I can perfectly execute javac -params /my/class while being in the deployment directory and things would be deployed fine. It works, but it's against good practice of course.
I want to understand why I am following best practices - why they are best - I don't want to blindly follow them.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61202
    
  66

Whatever floats your boat. My projects consist of hundreds, if not thousands, of classes. I'll not do without build tools such as Ant.

Sure one needs to know how to compile from the command line (I've said so hundreds of times in other posts); but once you get beyond a handful of classes, it's time to step up the game and use build tools.
E Armitage
Rancher

Joined: Mar 17, 2012
Posts: 892
    
    9
Learning to use javac should not be done while learning JSPs and servlets. You do that while learning the standard Java SE APIs which you should learn before learning JSPs and servlets.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Development environment vs Deployment environment