Last week, we had the author of TDD for a Shopping Website LiveProject. Friday at 11am Ranch time, Steven Solomon will be hosting a live TDD session just for us. See for the agenda and registration link
Last week, we had the author of TDD for a Shopping Website LiveProject. Friday at 11am Ranch time, Steven Solomon will be hosting a live TDD session just for us. See for the agenda and registration link
  • 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
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

packages -namespace

 
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"packages prevent name collisions because each package creates a class namespace".:-taken from a training manual on java

I understand the concept of deviding the classes into seperate packages where one class can have the identical name to another class as long as it is sourced in a different directory.I wonder if someone could describe what is meant by creating a "class namespace".I realise this probably means a seperation of the classes into different packages but hopefully someone could just confirm this for me . thankyou in advance
 
(instanceof Sidekick)
Posts: 8791
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You got it. Packages have several uses. One is just to organize code so it's easier to manage than a zillion classes in one folder. For that purpose, packages are pretty much just namespaces. They mirror a directory structure on disk so you can have the same name in two packages just as you would in two folders.

Packages also play a role in design by managing visibility and scope of some classes. And you can think of a package as a unit of deployment, though that usually turns out to be a larger "component" than just a package.
 
My pie came with a little toothpic holding up this tiny ad:
free, earth-friendly heat - a kickstarter for putting coin in your pocket while saving the earth
https://coderanch.com/t/751654/free-earth-friendly-heat-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic