One of the things sometimes may be elusive while working with a group of younger and inexperienced programmers, is the team agreement on the correct encapsulation level to implement in the team project.

Encapsulation is one of the four fundamental OOP concepts. The other three are inheritance, polymorphism, and abstraction.

Encapsulation in Java is a mechanism of wrapping the data (variables) and code acting on the data (methods) together as a single unit. In encapsulation, the variables of a class will be hidden from other classes, and can be accessed only through the methods of their current class. Therefore, it is also known as data hiding.

To achieve encapsulation in Java you have to:

  • Declare the variables of a class as private.

  • Provide public setter and getter methods to modify and view the variables values.

 

This obviosly is the small project point of view. But what to do when you have to deal with lots of different projects that share a core, for example the Database Manager? Please make use of managers and APIs to make the project modular.

Always remember to draw down the correct encapsulation by project first. How did you managed this situations? Tell me your experiences!


ImpresaCloud

ImpresaCloud

Laboratorio di informatica e di elettronica

Cerchi informazioni sulle riparazioni in laboratorio? Hai qualche curiosità riguardo la riparazione di qualche scheda elettronica in particolare? Nella sezione Riparazioni del nostro Blog troverai moltissime informazioni utili e curiosità riguardanti il mondo dell'informatica e dell'elettronica.

 

Software gestionali

Nel nostro Blog troverai gratis tante informazioni utili riguardo i nostri software gestionali, guide passo-passo per l'utilizzo dei programmi, suggerimenti e aiuto.

 

Sistemistica informatica

Nel Blog Sistemistica troverai interessanti articoli scritti dal nostro team riguardanti il mondo di BSD, Linux, e dei Server Windows. Tutorial, best-practices, e tanto altro.

 

Notizie

Notizie interessanti riguardanti l'elettronica e l'informatica.