• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Package Structural Problem

 
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi guys,

I got a problem here. I orginally wrote a utility package (called printResult) in a project.

> uni.project.utility.printResult

And now I got another project(project 2), and I want to reuse the printResult package.

> uni.project2

However, I don't want to make a copy of the package. Since otherwise I had to maintain the same packages separately. I did think of promoting the package to the root level.

> uni.util.printResult

And then have the 2 projects imported the uni.util.printResult.

Is there any other ideas, coz if I modify the structure as above, I had to modify all the files inside the project 1. And it is a pain..... even though it requires only a import statement. Thanks for any contribution.
 
Ranch Hand
Posts: 4982
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Could your IDE allows you to reference to the package in another project?

In WSAD, I can refer to other projects, and thus, I can refer to packages located in different projects.

Nick
 
Ranch Hand
Posts: 995
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by John Ip:



You can do a code dependency analysis and even to create a different library from the package you are talking.

./pope
 
(instanceof Sidekick)
Posts: 8791
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes, I'd like a package name with no project name in it for this class. If you're using Eclipse or something equally capable you might be able to pull off the move in the package view with no typing atoll. I'm able to open all my projects at once and do things like this with great ease.

Robert Martin suggests the package is a unit of deployment. You could shrink wrap it, deploy a single changed package to various clients, etc. We've debated this at length in the forum and there are certainly other ways to bundle your code. But it might be a helpful way to think about this and would encourage moving it out of any project package.

Let us know what you wind up doing!
 
Ranch Hand
Posts: 1312
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by John Ip:
Hi guys,

I got a problem here. I orginally wrote a utility package (called printResult) in a project.

> uni.project.utility.printResult

And now I got another project(project 2), and I want to reuse the printResult package.

> uni.project2

However, I don't want to make a copy of the package. Since otherwise I had to maintain the same packages separately. I did think of promoting the package to the root level.

> uni.util.printResult

And then have the 2 projects imported the uni.util.printResult.

Is there any other ideas, coz if I modify the structure as above, I had to modify all the files inside the project 1. And it is a pain..... even though it requires only a import statement. Thanks for any contribution.




For me : I'm use Eclipse IDE

All project can reference to another project(dependency project).

When dependency project was changed , you can use Refactoring option of Eclipse IDE to refactoring code.

This will help you.

Reference Website
http://www-106.ibm.com/developerworks/library/l-eclipse.html
[ September 08, 2004: Message edited by: Somkiat Puisungnoen ]
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic