Just a little while ago I was considering the possibility of pre-built PHP Display Components, which would allow me to build applications faster and re-use a lot of the boilerplate code that I currently spend too much time on. And once those components are built, they could be improved individually, which would make all my applications better without having to do anything.
It seemed like a good idea, and while considering how I might go about doing it, I discovered Adobe Flex. I'd heard of it before, as "Flash for developers," but had never been that curious. Having investigated Flash before, I was not interested in having to purchase a visual development environment and then messing around with timing, tweening, layers, and all the other crap Flash puts you through.
But Flex isn't like that at all. In fact, it's essentially just a set of visual components you can use in building a visual interface, along with a slew of classes for connecting to web services and easily binding XML data to the visual components. Additionally, ActionScript appears to be what JavaScript wishes it were ... which is nice.
Best of all? They provide a free SDK with a command line compiler. So as long as you're willing to actually write the code (rather than drag-drop-connect, which seems to be the direction the IDE companies want programming to go), you don't have to pay a dime and can check Flex out. So I did.
I decided to write a quick program to calculate quarterback ratings. Since the ratings formulae are different in the NFL and in college, I figured I'd have it calculate both.
Here are links to the app and the source code.
The first thing I did here was set up the visual interface, which is at the bottom. I used Flex's Label, TextInput, and Button components to build a simple form. I used absolute positioning because it's supposed to be better for performance (and because all the examples on Adobe's site use it, which means I haven't learned much about their automatic layouts yet -- I certainly would like to).
These components should be pretty familiar to anyone who's used HTML and Swing ... the tags seem to be a mix between the two, which is pretty interesting.
After writing the interface (and compiling and testing it to make sure it looked the way I wanted it to), it's time to add the functionality itself. The calculations will be done by ActionScript, in the <mx:Script> tag. It's a lot like JavaScript, except that you can define strong types and public/protected/private status, both of which are nice additions. The functions in here are simply designed to pull the data from the input fields, convert to Numbers, apply the formula, and set the label.
The one slightly non-basic feature I used in this program is NumberFormatter. Flex claims you can instantiate any component either with tags or in the script code, but the only way I got this working was to make an <mx:NumberFormatter> tag and reference it from the script. It's actually pretty interesting, and once I get used to having to do that, I may grow to like it.
I then went ahead and compiled it, and it worked quite nicely. Flex looks like a promising way to build web applications -- it's even possible that I could grow to prefer it to PHP + AJAX for my own applications.
It seemed like a good idea, and while considering how I might go about doing it, I discovered Adobe Flex. I'd heard of it before, as "Flash for developers," but had never been that curious. Having investigated Flash before, I was not interested in having to purchase a visual development environment and then messing around with timing, tweening, layers, and all the other crap Flash puts you through.
But Flex isn't like that at all. In fact, it's essentially just a set of visual components you can use in building a visual interface, along with a slew of classes for connecting to web services and easily binding XML data to the visual components. Additionally, ActionScript appears to be what JavaScript wishes it were ... which is nice.
Best of all? They provide a free SDK with a command line compiler. So as long as you're willing to actually write the code (rather than drag-drop-connect, which seems to be the direction the IDE companies want programming to go), you don't have to pay a dime and can check Flex out. So I did.
I decided to write a quick program to calculate quarterback ratings. Since the ratings formulae are different in the NFL and in college, I figured I'd have it calculate both.
Here are links to the app and the source code.
The first thing I did here was set up the visual interface, which is at the bottom. I used Flex's Label, TextInput, and Button components to build a simple form. I used absolute positioning because it's supposed to be better for performance (and because all the examples on Adobe's site use it, which means I haven't learned much about their automatic layouts yet -- I certainly would like to).
These components should be pretty familiar to anyone who's used HTML and Swing ... the tags seem to be a mix between the two, which is pretty interesting.
After writing the interface (and compiling and testing it to make sure it looked the way I wanted it to), it's time to add the functionality itself. The calculations will be done by ActionScript, in the <mx:Script> tag. It's a lot like JavaScript, except that you can define strong types and public/protected/private status, both of which are nice additions. The functions in here are simply designed to pull the data from the input fields, convert to Numbers, apply the formula, and set the label.
The one slightly non-basic feature I used in this program is NumberFormatter. Flex claims you can instantiate any component either with tags or in the script code, but the only way I got this working was to make an <mx:NumberFormatter> tag and reference it from the script. It's actually pretty interesting, and once I get used to having to do that, I may grow to like it.
I then went ahead and compiled it, and it worked quite nicely. Flex looks like a promising way to build web applications -- it's even possible that I could grow to prefer it to PHP + AJAX for my own applications.