If you are implementing a design pattern such as MVC ( Model-View-Controller ) or DAO ( Data Access Object ), it is best to follow its specifications because they are considered good practices that include good code structure, maintenance, among others.
How "Compulsory" is to use a controller for each view and NOT a controller for all views
It is not mandatory but it is desirable since it is better to aspire to have high cohesion and low coupling between classes, that is, that each class has a certain function and only that is dedicated.
The class Conexion.java and Main.java if they go in that package?
They can work properly where they are but it would be advisable to move them to a better location according to their objective. In the case of the Main.java class, it usually goes to the root of your project and Conexion.java in a package such as config
.
For example:
com
+- example
+- myapplication
+- Main.java
|
+- config
| +- Conexion.java
+- dao
| +- ...
+- controller
| +- ...
+- model
| +- ...
+- view
| +- ...
There are different ways in which you can organize your packages in Java, including a package by functionality / characteristic or by layer each with its respective consequences.
It might help to read the following Project Package Organization ( English ) to know the advantages and disadvantages of each orientation.
If you have questions about the organization of classes you can review the package definition ( package ) that Java provides in its documentation which can help you get an idea of how to organize your application: (< em> Translation )
A package is a namespace that organizes a set of classes
and related interfaces. Conceptually, you may think that
Packages are similar to different folders on your computer. Can
keep the HTML pages in one folder, the images in another and the
scripts or applications in another. Because the software written in the
Java programming language can be composed of hundreds or
thousands of individual classes, it makes sense to keep things
organized by placing related classes and interfaces in packages.
Note: You must remember that these are recommendations that are usually made to maintain order in your project especially when many people are working on it and may vary depending on whether it is a small, large project or just for demonstrative purposes.
Finally I leave you these links where you can find more detailed information of the patterns you mention.
References