DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports Events Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones AWS Cloud
by AWS Developer Relations
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones
AWS Cloud
by AWS Developer Relations
Building Scalable Real-Time Apps with AstraDB and Vaadin
Register Now

Trending

  • Designing a New Framework for Ephemeral Resources
  • How To Manage Vulnerabilities in Modern Cloud-Native Applications
  • Microservices: Quarkus vs Spring Boot
  • Creating Scalable OpenAI GPT Applications in Java

Trending

  • Designing a New Framework for Ephemeral Resources
  • How To Manage Vulnerabilities in Modern Cloud-Native Applications
  • Microservices: Quarkus vs Spring Boot
  • Creating Scalable OpenAI GPT Applications in Java

The Power of Copy and Paste

Biju Kunjummen user avatar by
Biju Kunjummen
·
Oct. 26, 10 · News
Like (0)
Save
Tweet
Share
5.63K Views

Join the DZone community and get the full member experience.

Join For Free

A reasonably large sized “Enterprise” Java web application ends up being multi-tiered , multi-layered, multi-moduled in that order,  with at least a few million dependencies. The task of putting together such an application from scratch is truly daunting.

So how do you go about creating an application from scratch? I have a few favorite techniques that I have faithfully followed over the years:

  • Copy an existing working application;start trimming it until I get to the point where I have an “archetype” that I can start back from.
  • Start from one of the archetypes provided by maven. Most of the standard maven archetypes (obtained using mvn archetype:generate) are very lightweight, but could be a reasonable starting point.
  • Another variation of the above 2 points is to generate your own archetypes – strip down an existing application and create a maven archetype for yourself.
  • Use Appfuse as a starter application. Appfuse though is starting to get a little bit dated now, with no updates for the last year
  • Use the sample applications provided by the Spring folks as a starting point – say the spring mvc-show case application

All of these approaches follow the common theme of “Copy and Paste” to create an application.

Now, copy and paste helps you kick-start an application, once you have started an application how do you keep adding functionality, after all most of the code structure would look similar – In Java you would add a new entity, a corresponding DAO to manage the persistence of the entity, a service tier, a controller, a view and so on.

The Rails folks did a wonderful job understanding that providing a simple way to kick-start, add functionality and pull in dependencies, is the quickest way to developer nirvana. Well, people who work with Rails are lucky, we Java guys don’t have that option, until now that is (Yes there is Grails, Lift, but these have not been an option in the enterprise shops that I have worked in).

Roo is turning out to be a wonderful alternative. With a few commands , you have a fairly green looking application up and running with all dependencies nicely pulled in. Adding functionality is equally easy; the roundtrip experience from creating an entity, to viewing the entity in a web page almost has the feel of a Rails based development. Well, Roo is still maturing, so it is not an option where I work yet, however that still leaves the “Copy and Paste" as a viable alternative for now!!. A simple way that I follow to add functionality to an application that I am working on is to simply start the Roo console, create the entities in roo, run the push in refactor and then creatively “copy and paste”.

"Copy and Paste" the most under-rated way of expanding code.

application

Opinions expressed by DZone contributors are their own.

Trending

  • Designing a New Framework for Ephemeral Resources
  • How To Manage Vulnerabilities in Modern Cloud-Native Applications
  • Microservices: Quarkus vs Spring Boot
  • Creating Scalable OpenAI GPT Applications in Java

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com

Let's be friends: