Entries Tagged 'Work' ↓

Flex and Flex Builder 3

I just have to tell everyone how cool Flex really is! When I did flash work several years ago it was a real pain developing an entire site in Flash especially if you wanted to incorporate any backend to it. This is definitely not the case with Flex and I have to give Adobe its’ props on this.

However, let me state, that I do want to see Flex Builder 3 ported to Linux. I could then ditch my Windows Virtual Machine and run things natively, but that is my only complaint at this moment.

So why do I love Flex?
Flex is just easy to use, the components built it are amazing and you have the ability to build components on your own too! Much like Server Controls in .NET, .NET gives you a TON to begin with and you can create your own as well. However, this is for Flash! That is extremely important to acknowledge, as I do not have to have Macromedia Flash MX or whatever the latest version is on my PC to build a Flash application now.

Not only do I love being able to build a Flash application without Macromedia Flash, but I also love how it can work with an infinite number of backends without a lot of effort. Got a web service you want to plugin to? No problem, how about an RSS feed? Again, No problem. Well how about just a plain HTTP stream with a custom format? No Problem! I mean literally, you can plugin to any service that can send back a response. If it is a custom type of response, then you can write a routine to read your custom format. However, if you are using a Web Service, be in written in .NET and it returns an XML stream, then you literally have to do nothing! It will read it without any custom code from you, the developer. And that my friends is the “cream of the crop”.

So where do we go from here?
I am going to be doing a lot of things with Flex fromt his point on. I was just totally amazed by the simplicity and yet the complexity you can have within it. I still have a lot to test. Updating the grid’s data when it has changed, and similar events. But time will tell and so far Adobe has bought me back with this wonderful technology. Just bring it to Linux and I will move right next to your head-quarters Adobe!

Let the code work for you.

The past two/three days (work days), I have been plagued with the task of working on a complex portion of a project. The piece I am working on, I did not start, but I did write the foundation of it for 5 other projects and its’ success and easy maintenance was largely due to how I designed it.

To keep a long story short, the architecture I used was not followed in this piece and now I am paying the price for something I didn’t do. The original code was developed so the code would do 50-70% of the work for me dynamically. Yes, this has performance cost implications but they were minimal (1-2 seconds at best), but the time it saves is nearly 60-75% of development time.

Now the particular piece I am referring to does a lot of output work. It takes the data inputted by the user and develops a results page to the user describing the information the user typed. Now, to make my life easier, I build a hash table of the user’s values and associate them with a code. The code is related to a table that defines the text to display regarding that entry.

By creating code to associate the hash table data with the database table, the results page can be generated dynamically saving me the countless time of programming each possibility the user can come up with.

Thus, sometimes it is smarter to go a dynamic route at the cost of performance, than it is to develop the most efficient masterpiece you can imagine.

That is my food for thought.

JSON versus XML

There has been much debate on using XML or JSON with your AJAX, but in my mind, the debate is pointless. Both are nice, one is quicker, one is slower. However, when it comes to development pick what you know best and what you can implement/maintain easiest.

If you do this, you are guaranteed the following:

  1. It is easy to maintain and understand the code you wrote months later
  2. Chances are your application will not be the quickest in response
  3. You will make use of techniques you fully understand than trying to adapt ones that you are unfamiliar with and may implement wrong

So how does JSON differ from returning XML in your AJAX requests? Lets first look at the advantages of XML.

  1. Standardized and easily serialized into via .NET
  2. The XML is easy to read all within itself
  3. You can make use of XSLT, DTDs, etc

How about disadvantages of XML?

  1. It is slow in comparison to JSON
  2. It can be clumsy when not designed properly

Now for the advantages of JSON:

  1. It is faster than XML to parse in JavaScript
  2. There are addin’s you can install in .NET or a library in PHP to serialize a JSON string from an object
  3. It is hard to make this clumsy as it is based on the Object Design

And the disadvantages of JSON:

  1. It is harder to read the serialized output
  2. You can’t use XSLT, DTDs, or something of the sort to validate or style the request

As for myself, I am a JSON person. I didn’t used to be though. My original AJAX applications were focused around XML primarily because I could make use of an XSLT and I always validated against a schema. However, JSON has won me over due to speed. JSON’s speed is just ridiculously fast and it showed when I converted a major application over to it. I saved nearly a third of the time it took to do a fairly simple task.

However, pick the poison that you understand most, otherwise, it could have detrimental affects.