Getting Real - Advanced ActionScript 3: Design Patterns, Second Edition (2015)

Advanced ActionScript 3: Design Patterns, Second Edition (2015)

Chapter 12. Getting Real

I’ve covered an immense amount of intense information, and if you’ve made it this far, I applaud you. If you’ve made it this far feeling more confident in your understandings of design patterns and how they tie into OOP, then I can say my job is nearly complete. I stress “nearly” because I would be doing you a disservice if I did not cover the aspects that make up real world scenarios, which can impair your programming decisions.

Writing this textbook offered me the ability to provide custom examples to exemplify a particular need for a specific pattern. These custom examples also enhance your ability to understand how and why a particular pattern could solve a particular dilemma you need to overcome. Not every problem you will face will be as simple; in fact, some problems will require a great involvement in OOA&D to reveal the appropriate collaborations. While this may seem legitimate and necessary to you, this will be viewed as a luxury to a company. This is not the half of it; there will be many other obstacles that stand in your OO path.

Object-Oriented Obstacles: O3

The industry of RIA is very cutthroat in more ways than one. Clients are unforgiving, projects are expensive, many project managers and designers have a technical disconnect, and development is often the last phase of a project. While many agencies believe they want developers who are object oriented, what they really want is for a project to be completed. For this and many reasons I will soon cover, practicing proper OO techniques can be quite a challenge for an aspiring developer.

Always a Student

Programming is not the simplest career, let’s be honest. We may know our material but the subject area is always changing and evolving. There is always something to learn, and therefore we are always students. As developers, our learning may be initialized by our eagerness to know more, but often the origin of learning can arrive with a new project. The realm of what a client can for is seemingly endless. This is because they are looking for what hasn’t been done—and what sells. A new task may involve motion, audio, data visualization, etc.

Business is Business

Agencies may be bidding against one another to acquire business and will find ways to trim areas to win that business. These areas are budget and time. Depending on company size and/or structure, the developer does not necessarily determine the deadlines, and they may not even get a say. The pressure of a deadline then starts to make an impact as time designated for OO/AD and object-oriented thoughts diminishes. Rapid prototypes, or step-by-steps, could be required of the developer, and these take away from the opportunity to utilize OOP and design patterns.

You may want to resort to a third party and be more lackadaisical with your code to beat the deadline. Unfortunately, the third party code may not be up to your standards and your rushed code may not be anything that can be reused; but, at this point, getting the job done would be the most satisfying.

Now, taking precedence over OOP skill is business. OOP sounds great, but it doesn’t sell.

Varied Priorities

Ideally, it would be great if all developers on a project shared the same vision. Working with five people building reusable code would create a large stockpile quickly. It would also make the utilization of OOP more feasible given time constraints. However, not all programmers share the same vision, and those that don’t may be on your team.

Object-Oriented Solutions

Luckily, every cloud has a silver lining and knowing the pitfalls of OOP can provide insight to combat such obstacles.

Software

As mentioned in Chapter 3, an editor can greatly improve your coding abilities with its built-in features. The faster you are able to code or navigate between your folders/files, the more time you have to pause and think. Many editors provide the ease necessary to navigate OO code and therefore should be given due diligence when searching for a solution to purchase.

While paper is always the fastest way to devise object collaborations, it does decrease the amount of time you may have to physically implement code. Rather than delay the progressing of implementation on a tight deadline, kill two birds with one stone with such applications like UML4AS.

UML4AS is a unified modeling tool for the ActionScript 3.0 language that allows the modeling of UML while generating the ActionScript classes for you. The UML4AS is free and works along with the Eclipse IDE as a plug-in. This is great because Flash Builder/Flex and FDT both make use of the Eclipse platform. You can download the plug-in at www.uml4as.com/.

image

Figure 12-1. A screen grab of UML4AS in action

Another great IDE that supports Flash and AIR development is IntelliJ IDEA by JetBrains. Functional cross platform, IntelliJ IDEA runs on Microsoft Windows, Mac OS X, and Linux operating systems and is ideal for ActionScript and MXML with on-the-fly code analysis, completion, navigation, advanced refactorings, code generation, UML diagrams, UI designer, interactive debugger, and profiler.

IntelliJ’s UML Designer enables rapid analysis of classes and packages. From any class, generate UML by selecting Show Diagram… from the Diagrams menu.

image

Figure 12-2. UML export as image from IntelliJ IDEA filtering fields, constructors, methods, and properties

From the top menu bar, you may filter the view to include fields, constructors, methods, and properties as well control visibility of access modifiers such as showing only public visibility.

image

Figure 12-3. UML export as image from IntelliJ IDEA showing all fields, constructors, methods, and properties

While in the UML Designer view, you can even make changes to code simply by modifying the diagram.

Dedication

Perseverance is the best advice I can give towards thwarting O3. If you truly want to be better at anything, constant use is the best solution. Familiarity will ultimately reduce hesitancy and any reluctance towards injecting patterns into a project with a deadline. Utilization of OOP and design patterns will be the only solution for building a library for of reusable code.

Remember to stick with it. You can’t expect to learn OOP and design patterns any other way. Consistently read books, practice, and experiment. Even while you’re learning something new for a project, perhaps even a new language, you will still get to take knowledge of design patterns with you. The knowledge of design patterns can be brought to other object-oriented languages.

User Groups

When people in your environment do not have the same interests, it is difficult to find support and reinforcement. User groups are a great option to finding others with similar interests, common goals, and a system of support. You may also find someone from a local user group willing to speak to your company or agency. They may be able to provide an informative presentation or productive workshops for quick tips and tricks. It can also increase the possibility of welcoming new thinking.