ut2. instalación y uso de entornos de desarrollo · ut2. instalación y uso de entornos de...
TRANSCRIPT
UT2. Instalación y uso de Entornos de Desarrollo
Juan V. Carrillo
Entornos de Desarrollo
CFGS DAM
IDE: INTEGRATED DEVELOPMENT ENVIRONMENT
IDE: Integrated Development Environmnet
• IDE: Entorno de desarrollo integrado. Reúne las herramientas necesarias para la programación. Comúnmente:
• Un editor de texto.
• Un compilador.
• Un intérprete.
• Un depurador.
• Un cliente.
• Un sistema de control de versiones.
• Sistema de diseño de interfaces gráficas de usuario.
In the Beginning was the Command Line
http://www.cryptonomicon.com/beginning.html
FUNCIONES DE UN IDE
Ayudas para examinar y comprender el código fuente
• Resaltado de Sintaxis
Ayudas para examinar y comprender el código fuente
• Dar formato al código fuente
Ayudas para examinar y comprender el código fuente
• Localizar declaración/definición de un elemento
• Localizar referencias a un elemento
Ayudas para examinar y comprender el código fuente
• Plegado/desplegado
Ayudas para examinar y comprender el código fuente
• Índice de contenido – Físico: ficheros, módulos – Lógico: paquetes, clases, funciones, var. globales
Editar el código fuente
• Autocompletar o insertar código
• Emparejar paréntesis o llaves
Editar el código fuente
• Plantillas de código
Editar el código fuente
• Mostrar declaración en las llamadas
Editar el código fuente
• Refactorizar: cambiar nombre, argumentos, etc.
Compilar, montar y ejecutar
• Comprobación de la sintaxis
• Compilación de ficheros individuales y montaje
• Ejecutar
Depurar
• Ejecutar paso a paso en busca de errores
Control de versiones
• Gestionar distintas versiones del código
Análisis dinámico
• Uso de memoria y procesador
Testing
• Prueba de programas
Diseño de GUI
INSTALACIÓN Y USO DE NETBEANS
Instalación de Netbeans
• NetBeans es un IDE – Completamente libre (GPL y CDDL)
– Multilenguaje
– Multiplataforma
• Podemos descargar versiones lite para el entorno de programación que deseamos, e ir agregando otros lenguajes posteriormente
• Se puede extender a través de módulos
• Configuración basada en ANT
Instalación de NetBeans
Proyectos en Netbeans
• Netbeans no trabaja a nivel de archivo sino de proyecto
• Un proyecto incluye todos los ficheros necesarios para construir un programa: – Código Fuente
– Librerías externas
– Imágenes, sonidos, etc.
• Físicamente, un proyecto de NetBeans es un directorio con una organización específica
P
R
O
Y
E
C
T
O
S
P
R
O
Y
E
C
T
O
S
Directorios / Ficheros generados
Ficheros • nbproject/build-impl.xml. The Ant script that contains all of the
instructions for building, running, and debugging the project. Never edit this file. However, you can open it to examine the Ant targets that are available to be overridden.
• build.xml. The main Ant script for the project. The IDE calls targets in this Ant script whenever you run IDE commands. build.xml contains a single import statement that imports targets from build-impl.xml. In build.xml, you can override any of the targets from build-impl.xml or write new targets.
• nbproject/project.properties. The Ant properties file that contains important information about your project, such as the location of your source and output folders. You can override the properties in this file.
• nbproject/private/private.properties. The Ant properties file that contains properties specific to your installation of the IDE. For example, if you are sharing the project over VCS, any properties you set in private.properties are not checked into the repository. You can copy a property fromproject.properties into private.properties and give the property different definitions in each file. The definitions in private.properties take precedence over those in project.properties.
Organización Lógica y física
Compilar y Ejecutar
• Al ejecutar, se compila de forma automática
• Compilación manual
– Build: compila y empaqueta
– Clean & Build: elimina los ficheros compilados previamente y compila desde cero
Ejecución de un fichero
Librerías
• Para añadir una librería a nuestro proyecto, botón derecho sobre Libraries:
– Proyecto: un proyecto de Netbeans existente
– Jar: una librería compilada en un Jar
– Librería: una librería predefinida en NetBeans
Librerías predefinidas
Librerías predefinidas
Librerías predefinidas
Librerías predefinidas
Configuración de un proyecto
CONFIGURACIÓN DE NETBEANS
Ventana de Tareas
• Tareas pendientes
– Etiquetas @TODO
– Warnings
– Errores
Colores, librerías, etc
Tools > Options
– Editor • Use code Folding • Formatting • Code Completion • Code Templates
– Fonts & Colors – Keymap. Shortcuts && Code templates
https://netbeans.org/project_downloads/www/shortcuts.pdf
Code Templates
File Templates
• Tools > Templates
File Templates
• NetBeans utiliza su propio lenguaje de edición de plantillas: FreeMaker
• https://platform.netbeans.org/tutorials/nbm-filetemplates.html
• http://freemarker.org/docs/index.html
• user.properties vs project.properties
File Template <#assign licenseFirst = "/*"> <#assign licensePrefix = " * "> <#assign licenseLast = " */"> <#include "../Licenses/license-${project.license}.txt"> <#if package?? && package != ""> package ${package}; </#if> /** * * @author ${user} */ public class ${name} { /** * @param args the command line arguments */ public static void main(String[] args) { // TODO code application logic here } }
File Template Settings
#
# Here, or in other properties files in this directory, you can define
# various properties that you want to make available to the template
# processor while creating various templates.
#
# uncomment the next line and specify your user name to be used
# in new templates
user=Your Name <your.name at your.org>
https://platform.netbeans.org/tutorials/nbm-filetemplates.html
Licencias (Template)
Instalación de módulos
• Tools > Plugins
http://plugins.netbeans.org/
Añadir proveedores de módulos
Directorio de usuario
• The NetBeans userdir is a directory where NetBeans stores user configuration data:
– Window layouts
– Editor settings
– Menu and toolbar customizations
– Module settings
C:\Users\<user>\AppData\Roaming\NetBeans\7.2\
Referencias
• Funciones de un IDE. http://lml.ls.fi.upm.es/ep/funciones.html
• Libro Netbeans Oficial: http://docs.oracle.com/cd/E40938_01/doc.74/e40142/toc.htm