Escolar Documentos
Profissional Documentos
Cultura Documentos
Who am I?
Im Scott Battaglia!
Application Developer @ Rutgers
Java Developer for 5+ Years
Lead Developer/Architect on JA-SIG CAS
Committer to Acegi Security
Agenda
Methodologies
Language Features
Non Language Specific
Tool Chest
Discussion
1.
Methodologies
http://butunclebob.com/ArticleS.UncleBob.TheThreeR
ulesOfTdd
JA-SIG Summer Conference June 24 June 27, 2007
Use real data (e.g. copies of production data) when they need
to.
Represent one step towards your overall goal.
Iterative Development
Cyclic/incremental
Milestones, Release
Candidates
Feedback before its too
late!
Allows you to take
advantage of previously
gained knowledge
Code Reviews
Systematic examination of course code
Goals
Improve quality of code
Share knowledge
Ideally
Short
Focused on code
2.
Language Features
final Keyword
Used as follows:
final Object o = new Object();
Advantages:
Gotchas:
Final primitives and Strings are substituted at compile-time
Final means no variable re-assignment
JA-SIG Summer Conference June 24 June 27, 2007
StringBuilder
Usage:
final StringBuilder builder = new StringBuilder(50);
builder.append(myString);
builder.append(moreOfMyString);
Enumerations
Traditional Enumerations:
public final int ENUM_VALUE_1 = 1
public final int ENUM_VALUE_2 = 2
Java 5 Enumerations
enum COLOR {BLACK, WHITE, RED, GREEN, BLUE, YELLOW}
JPA
JPA is
Java Persistence API
-Entities
Java Persistence Query Language
Advantages
Pluggable backend (TopLink, Hibernate, etc.)
Database agnostic DAO layer
No complex mapping files
Disadvantages
Difficult to retrofit legacy tables
JA-SIG Summer Conference June 24 June 27, 2007
PreparedStatements
Statements vs. PreparedStatements
Advantages:
Compiled
Correctly escape characters
As of JDBC 3, can be pooled
Annotations
Extra information associated with Class, Method,
Variables
3.
Non-Language Specific
Design Patterns
Recurring solutions to common problems
Solve design problems not computational problems
Five types of Patterns
Benefits:
Easy to understand code
General solutions
Allow people to communicate using the same language
Model-View-Controller
Division of Labor into the following parts:
Those responsible for business logic (the Model -- often
implemented using Enterprise JavaBeans or plain old Java
objects).
Those responsible for presentation of the user interface (the
View).
Those responsible for application navigation (the Controller -usually implemented with Java servlets or associated classes
like Struts controllers).
Interfaces
Interface vs. Abstract Class
Coding to Interfaces
Examples
Collections Framework
CAS
Logging
Makes debugging easier
Everywhere you would have put a System.out, put a
logger statement
log.isXXXXEnabled() vs. log.XXXX(data)
Logging via AOP
Unit Testing
4.
Tool Chest
Build Tools
Wiki
Issue Tracking
Continuous Integration
Version Control
5.
Discussion
Further Reading..
Thinking in Java by Bruce Eckel
J2EE Design and Development by Rod Johnson
Refactoring: Improving the Design of Existing Code by
Martin Fowler
Effective Java by Joshua Bloch
Domain Driven Design by Eric Evans
?
What are Your Best Practices?