Flex best practices – Part 1: Setting up your Flex project
This is the first part of my series on using and applying best practices to your Flex development process. This article will focus on best practices for setting up your Flex project.
Why follow best practices? During your Flex development career, your hands will touch many projects. Not all projects will be created from scratch. More than likely you will be working on an established codebase that has been built up over time by different developers working in different stages of their careers. You will be facing projects that may have already begun or have already been released and now need to be refactored, changed, and updated. Time and time again, you will find yourself being thrown into the middle of the development process for various projects. Because of this, it is critical that the project has been started using best practices. Otherwise, you will be spending additional time making sense of the project and understanding the codebase rather than making the requested improvements or changes. This additional time can increase the cost of a project and dramatically detract from the task at hand. For these reasons, the Flex development community has established a set of common best practices for Flex developers to use. Following these best practices improves the clarity of a Flex project and enables Flex developers to focus on innovation rather than learning a myriad of nonstandard development approaches.
Whether you are a contractor or an employee, these best practices will serve as a set of rules and your roadmap to navigating a project's structure, organization, and code format. This article explores common techniques and conventions adopted and used throughout the Flex development community.
Please note that the techniques and practices outlined in this article should be used and adopted where they make sense and clarify the development process for you and your team.
In order to make the most of this article, you need the following software:Flex Builder 3
If you are willing to sacrifice the powerful tool set provided by Flex Builder 3.0 standalone or plug-in, applications can be developed using only the Flex 3 SDK.
The practices covered in this article should be followed regardless of which setup you use.
Previous Flex experience is not mandatory for this article. However, some previous application development experience will be helpful.
Using workspaces for project organization
Follow the best practices below to use workspaces to organize your Flex projects:
Use workspaces to keep your Flex projects organized.
A Flex workspace is basically just a directory on your computer that stores a collection of Flex projects. Workspaces are a good way to organize multiple Flex projects. If this is your first Flex project, I recommend using the default workspace, at least until you are comfortable with what a workspace is and how it relates to your computer's filesystem. A common issue that can arise for beginners when the workspace is changed is that the project files can become difficult to locate. The location can always be found within Flex Builder, but if you're not sure where to look or what a workspace is, questions can surface. As you mature as a developer, you will be held responsible for the management of multiple Flex projects. Setting up a fresh workspace for each project may be the best approach to reducing clutter and enabling you to focus on one project at a time. Be aware that Eclipse preferences are often stored in the workspace, so key bindings need to be set for each workspace; and that can be frustrating if you stray from defaults.
Be sure to note the locations where Flex is storing your project files. The default Flex Builder 3.0 workspace locations are:
Windows XP: C:\Documents and Settings\<User Name>\My Documents\Flex Builder 3
Mac OS X: /Users/<User Name>/Documents/Flex Builder 3
To find more information regarding Eclipse workspaces, see Setting the Workspace.
(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)