Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Development environment vs Deployment environment

 
Ryan McClain
Ranch Hand
Posts: 145
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 989
9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 13061
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 145
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I suppose with a versioning system.
 
E Armitage
Rancher
Posts: 989
9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 145
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 145
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64830
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Ryan McClain
Ranch Hand
Posts: 145
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64830
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 989
9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic