Advice on converting a design-by-accretion Flex project to Mate - apache-flex

We have an internal Flex application which has been designed more through feature creep than by any kind of clear vision. It's basically a kind of CRM and reporting system which utilises quite a lot of Flex components (trees, graphs, custom components, datagrids - all sorts) and talks to a .NET webservice backend.
It was initially my first Flex project and has been written with the bodge, hope and repair kind of style you might expect from a prototype. However, it's now grown to the point where we'll be adding other (neophyte) developers, but it might not be impossible for one person (sigh, probably me) to rewrite the current snapshot in about a month. So, at this stage I'm thinking it might be a good idea to consider a new version implemented in the Mate framework.
I don't need advice on which framework to choose, what I would like is advice on how to go about refactoring the project. It seems like this will involve tearing everything down and pretty much starting again (which I'm not totally averse to), but does the framework have to be built in from the ground up? Are there any known and recommended methods of attacking this kind of problem?

I did a similar thing a couple of months back. What I did was that I created a new package structure and moved all "ported" code there as I went along. I started with the overall view structure and moved my way towards the "branches". The new code referenced the old where needed, but no old code referenced the new. Having a new package structure helped in making it clear what had been ported and what had not, and it was also easy to see when I made progress.

Related

Is Coolite worth using in a medium-big project?

I'm planning to start a web based stock and current managament project.
I want app to be Ajax but I don't want to spend my time for client-side code.
Thus, I think to use coolite for my presentation layer.
However, before starting project I want to hear some advices about it.
Is it worth using in a big project and do you have any other advice about this issue?
This would be much better asked on the Coolite forums where you'll hear from actual users of the framework rather than people who will just knock it because it's not jQuery (sigh). IMHO, it is a pretty solid framework -- however, I've never used it in a production app. You really should spend some time evaluating it yourself -- take a day and mess around with their samples and see if you can build something simple. Ultimately only you can decide if it will work for your needs.
I'm yet to come across a javascript to asp net framework that isn't full of bugs. I'm in the process of an application rewrite and I'm ripping out the ajax frameworks and just using jquery.
I've found it simple to code, fast to run and easy to bug fix.
I can't comment on Coolite, but for my 10c I'd suggest just learning jQuery.
Way back when Coolite first came out I tried it and wasn't impressed and it ties you down somewhat so I just use Ext with .NET pure, a bit more work but will save you in the long run I think and keep you flexible to changes in both frameworks.

Another "is ASP.NET MVC right for me?" question

Here's my particular situation...
I have a decent amount of experience with webforms, and I must say, a lot of it has been pretty frustrating. I like that there are lots of built-in controls, but then I discover that they don't quite do what I want, out of the box. I end up rolling my own controls (that inherit from the built-in controls), such as GridViewThatCanSortItself or GridViewThatHasASelectionColumn (these may not have been the actual names, but you get the idea). I've often wondered, while struggling mightily to build such classes, whether figuring out the often convoluted event model was worth it. My attempts to use css to style things have been frustrating as well. There are some ASP.NET controls that will result in one html tag for one set of attributes and a different tag with another set of attributes. You don't realize this until you notice your css only works half the time.
So, my brain starts to wonder, could ASP.NET MVC be the answer? Reading some of the posts on SO has basically given me the impression that, while webforms definitely has its issues, I'd only be trading one set of problems for another. It even seems like Microsoft is trying to talk me out of it:
Quote from the asp.net site (http://www.asp.net/learn/mvc/tutorial-01-cs.aspx)
ASP.NET MVC...works well for Web applications that are supported by large teams of developers and Web designers who need a high degree of control over the application behavior.
That is really not me. Most of my projects are relatively small, and I'm usually the only programmer. I sometimes need to create very custom or unusual UI's, but I definitely don't have a team of programmers who can build components for me.
There is also the issue of javascript. I have a definite working knowledge of html and css, but I can't say the same for javascript. As clumsy and bloated as they are, I've been able to do some smooth enough looking things with UpdatePanels. I'm not sure how much time I'd need to spend just learning the javascript to be able to handle even simple AJAX scenarios in ASP.NET MVC.
I'm about to start working on a relatively simple and small web app, so now would be the time to take the plunge if I'm going to take the plunge. This app will use a SQL Server Express (2005 or 2008) back-end, and I'm thinking of also trying out SqlMetal as an ORM solution. So, that's already one thing I'm going to have to learn, although I at least have experience with--and really like--LinqToXml and LinqToObject. The pages of the web app will have some data grids (some with link columns), input boxes, labels, drop-down lists, check boxes, radio buttons, and submit/action buttons. I don't foresee anything more complicated than that. There will be about six or seven pages total.
Questions:
Given my experience, how painful will it be to learn ASP.NET MVC? Will it be worth it?
I've read some earlier questions comparing webforms to MVC, so I'm curious, How has MVC evolved over the past year or so? Is there anything new that would make the learning curve less steep?
Do I literally have to write code to generate all html by hand or are there code/libraries readily available in the community to assist with the process? (I know I read something about "html helpers"--that may be what I'm asking about here.)
Any other advice?
Update
Another question that occurred to me: Is the transition from ASP.NET webforms to MVC anything like going from standard WPF (using code-behind) to MVVM? I found learning WPF itself to be pretty challenging (and I still couldn't say I really get everything about it), but learning to work with WPF using the MVVM pattern was a relatively painless transition. So, I'm wondering how similar a jump it is to go from webforms to ASP.NET MVC.
My advice is to work through the Nerd Dinner Tutorial from the first chapter of Professional ASP.NET MVC (and then buy the whole book, it's great) to get a feel for how it fits together and how it works for you. This covers most of what you are concerned about above.
You will have to get your hands dirty with regards working with raw HTML but this is no way near as terrifying as it may sound. Especially as you're having issues where Web Forms takes control.
Yes, Asp.Net Mvc might be a solution for your problems.
I would highly recommend you not to rush
(without better knowledge you will end up at disappointment).
But in either way - it definitely be worth it. You will learn a lot.
Start with bunch of sample applications while reading some books (start with Sanderson`s, continue with Mvc In Action). Familiarize yourself with asp.net mvc. It demands different way of thinking about web development you are likely used to. And don't be afraid of 3rd party tools - get used to them because asp.net mvc does not focus on 'ready 2 drop through designer and use' solutions and lack of super cool and shiny (with awful js/html underneath) controls at start really frightens.
After few weeks of playing around with it - you will actually be able to answer this question yourself.
And that's the one and only answer that's worth something.
Personally - i prefer asp.net mvc framework and don't want to go back despite that in some cases it does take more work (i.e. - implementation of custom pagination (which can be easily made way more sophisticated than one that pagination control provides)).
Framework demands better knowledge of OOP, architecture and design knowledge, good sense of code tidiness because there is much less 'signs' that provide direction of one and correct way of doing things - they must be figured out in most cases by yourself. So - it is easier to drown in your own sh*t, html tag soup etc. if you are unsure and/or don't know what you are doing.
I kind a disagree with that statement about large developer team. This is where knowledge about OOP, 'convention over configuration' and extensability of Mvc framework comes into play. As i see it - it's way more easier (this is really really subjective) to write code that's reusable. And with features like templates (in mvc version no2) count of code lines is reduced drastically.
And learn javascript. You are missing a lot. Play around with jQuery if you haven't done that yet (greatly reduces cross-browser compability problems). Firebug plugin for FireFox is a great aid at this (for debugging purposes). AJAX`ifying your mvc website might seem awkward at first (there's a great tips in 'Mvc in action' book about this topic like form hijacking that can be used to achieve so called progressive enchancement with AJAX), but once you get used to JS - it feels superb. One thing to mention - JS is quite sharp tool (if you don't drop what you know about development in .NET environment and don't use it as it's supposed to). It's easy to screw up JS code base in no time.
Another thing - there's a bunch of myths about mvc framework along those who have touched only web forms.
It is not hard to work with raw html.
It is not hard to read form values (binding mechanism is excellent and easily customizable/extensible).
I'm sure there are more. Just can't remember at the moment. :)
#DanThMan, I had the same reservations you did when I first took a look at the framework but having worked with it now for some time there is no way, given the choice, that you'd get me back into WebForms.
I also write, from time to time, small applications where I am the only developer and I thank God I stuck to the MVC framework and took the time to really learn it.
In my mind it has made programming fun again and I can now maintain sites quickly and easily which is a first.
For my money this is the way to go but it's a steep learning curve and you need time to get to really understand it. If you have the time I'd say go for it.
There's some good answers here and some good ones in other threads as well. I'll take a stab at a question that hasn't really been addressed yet.
How has MVC evolved over the past year
or so? Is there anything new that
would make the learning curve less
steep?
I made a conscious switch to MVC about 8 months ago and haven't looked back. Version 1 was stable and I began to use it on a couple of sites with the help of a couple of books and the internet of course. Resources were good back then but since I switched things have really blown up in a good way.
There are a couple of books out there for version 1 that are top notch (Steve Sanderson's - Pro ASP.NET MVC Framework and the Nerd Dinner book come to mind). And there is definitely asp.net MVC blood in the water so I imagine there will be some great version 2 books down the line.
The developer community, especially here, is excellent and it's getting better. "asp.net-mvc" is currently the 16th most used tag on this site and often has a very high amount of views per question. As of today I have yet to have a question that hasn't been answered. There's a lot of smart people looking at the MVC questions who are willing to help.
The contrib library over at codeplex is also getting better and getting some nice participation. They've done a great job of filling in some holes that version 1 has left. I can only think that this will continue to get stronger as MVC gets older.
The new features for version 2 are in my opinion awesome. I won't name my favorites as they won't mean much to you if you haven't played with MVC much but just know that the development team has listened and included a number of great enhancements for the new version. They are very actively seeking feedback and always looking for improvements. Do not expect this change anytime soon. (One day I called up Microsoft and said "Shorten '[AcceptVerb(Http.Post)]' to '[HttpPost]'" and bam, Mvc 2 was my idea.)
The point I'm trying to make is: since I made the switch I've seen things get better and better. I'm incredibly happy with my decision and I'm excited for the future of this project. Version 1 is good, Version 2 is better and I can't wait to see what 3, 4, and 5 ... hold.
And I'll leave you with this: I've now converted a number of friends from WebForms to MVC. Every single one of the them is glad they made the switch and the ones that work with all aspects of an application (C# code, html, css, javascript, data access, unit testing, etc) will never go back and are loving the asp.net MVC life.
Given my experience, how painful will it be to learn ASP.NET MVC? Will it be worth it?
Yes and yes. It will be painful and it will be worth it and here's why. You will be a better programmer for it and your skills will more easily transfer to other platforms. MVC is a very common pattern that you will find over and over again in just about every popular language.
You will be working more closely with html, javascript, and css, but that's web programming and you're better off biting the bullet sooner than later.
having worked my last few projects (prior to embracing mvc) using my own controls being rolled via the HtmlTextWriter, I actually found th transition quite straightfwd. i have to say tho', i did put it off until v1.0 was well and truly 'out there' and only made strides from aug/sept 09. i'm glad i got into it as the main reasons i had been using the HtmlTextWriter in webforms was to overcome some of the basic issues of class names and id's when using jquery. i'm not going to say that v1 is a silver bullet but it certainly just works in tandem with my mindset at the moment. as for literature, i too read the sanserson and nerd dinner books and took plenty away from them. at the same time, i also got into subsonic v3 and found a fair amount of tips on rob's site to get me going.
i seriously can't imagine having to go 'back' to the webforms paradigm as i had been looking for a way to drop the page lifecycle and controls bloat for such a long time (i had even looked at php framewirks at one point as a way out of the webforms dilema - kohana is a great little php framework).
anyway, just my scottish 2 pence worth...
merry xmas all and a happy 2010
jimi
Some developers seem to have an aversion to component-oriented programming. For others, it feels natural. If you find yourself constantly fighting the standard components, then it's easy enough to roll your own from scratch--which you would basically end up doing in MVC anyway. If you find yourself fighting the unit test model with web forms, you will find things easier with MVC.
However, MVC isn't a cure-all; there's a lot to learn. Some apps will be less complex than with web forms, and some will be much more complex.
I've found that web forms don't really gel with many developers until they deeply understand the page life cycle and use of ViewState. Until that point, there seems to be a lot of trial and error -- but it's easier to learn that than MVC with IOC, etc. As far as customizing output, it's often easier to use control adapters than to subclass the control. In case it helps, I walk through these issues from the web forms side in my book: Ultra-Fast ASP.NET.
In the end, I think it's partly a mindset thing, and which model fits the way you solve problems and think about your application better.

Why use a Flex framework like Cairngorm or Mate?

From what I understand a framework reduces complexity in areas that are common, like a log-in system. I use ASP.NET MVC at work and have done some work in Zend Framework but do not get how a framework helps with client side development. The reason ASP.NET MVC is used at work is for Unit Testing - does a Flex framework help with this too?
Please let me know why I should or should not use a framework with Flex?
The short answer is: it depends on the framework. :) My thoughts below:
Flex is itself a framework, and you can write reasonable applications without the need for any additional framework. Flash has a built-in event model that allows for bubbling events, so you can dispatch an event in a deeply-nested user interface component and have a listener higher up in the hierarchy that handles the event. The event handler can delegate to your model, which retrieves data from the server, and Flex's binding support can ensure that your views are appropriately updated from the model. I think it's important to understand that Flex applications can and should be written more or less according to that approach, and that any additional framework should help facilitate that approach, rather than providing its own way of doing things that ends up coupling you to the framework.
That being said, an extra framework that helps facilitate this approach can absolutely provide value. I would recommend Mate or Swiz because I think they achieve this goal. They don't try to reinvent the wheel or replace parts of the Flash / Flex APIs; instead they complement them. The dependency injection features make it much easier to provide data to your views, but without coupling them to any framework. There are a number of utilities available to make it easier to work with remote services. They also have a utils to facilitate testing or even persisting data in shared objects.
I have also worked with Cairngorm in the past and I would not recommend it. CG is notorious for requiring you to create a ton of classes that adhere to CG-specific APIs and requiring you to use many of their Singleton implementations which make your app brittle and hard to test in isolation. It is based on a number of J2EE patterns which fell out of favor in the Java community at least 5 years ago.
I've read a little about PureMVC and while I can't speak to its invasive nature, I think that reinventing the event model (called "notifications") is silly and couples you to their framework. Sure, you can say it "insulates" you from the Flash event model in case it changes, but I'd say the odds of PureMVC changing their notification model is far more likely than Adobe changing the event model. :)
If you've ever tried building a slightly large application, or one at all complex, things can quickly get out of control. I don't know how many projects I bailed on when I was first starting out because I didn't know patterns, or how to make parts of the system communicate without being tied to each other, or dependent on each other.
So, basically a framework is a collection of patterns put together. Theoretically, if you learn to follow the "rules" of a (tried and true) framework, your app will not get out of control to the point where you find yourself fixing one bug and causing two. I've been there and it's not fun.
I also found that by learning to use a framework you initially don't have to know so much about the patterns behind what you're doing. But before long you'll get a good handle on the patterns used and you'll be able to apply them in new situations or find a better pattern. So it's a good learning tool as well.
I'm sure people will have arguments against using frameworks -- this is just my experience. But if you become familiar with a few, you will likely find that one might be suitable for one project but not another.
As far as Flex frameworks, I personally like PureMVC. In all honesty the only other one I've given a good amount of time to is Cairngorm. But I like PureMVC because it feels right to me, but also it's generally not dependent on so much on the built-in Actionscript classes. For example, it uses it's own notification system. So if the notifications change in Flex, they'll still work in your PureMVC app. Also, the creator Cliff is super helpful in his forums, and he's really passionate about it. And the documentation is great.
I recommend coming up with a super basic app, and building it without any frameworks, then again with a couple others. You don't have to finish the app, but just get a feel for what's behind the frameworks.
You may find value in using a framework if:
You work in a team environment and want to be sure everyone uses the same approach
You have a large, sophisticated app and want to communicate effectively between parts of the app
You want to be able to hire additional programmers and have them be productive quickly
You want to ensure your application is built with a proven architecture
You want to leverage the knowledge of design patterns and solutions that are known to work well
You want to simplify a complex application
Here's a great article on Flex frameworks.
Flex Framework Comparison
And, I agree with the conclusion...Mate is a great Flex Framework.
Another interesting framework not mentioned in this article is Spicefactory's Parsley.
I use PureMVC (which is an MVC-framework for Flex) for my larger applications. Like 99miles stated, it depends on the application size.
If you just have to make a (relatively) small tool/application, you can get it going with just Flex. But if you want to create a large, complex application a Framework might come in handy.
The main reason I use PureMVC in Flex is because of the Model-View-Controller architecture. This separates the presentation layer from the business layer and works a lot with events and notifications. This gives you a lot of control in creating reusable classes/controls in Flex in a relatively simple way.
As I said before, for a small tool/app/website I wouldn't recommend using a framework, because in that case it might be to time consuming and complex. But for the larger applications, frameworks are quite handy.
More information on the MVC architecture can be found here.
Hope this helps :)

Community Server the new version do you recommend it? can you integrate new modules to it?

I am planning to use community sever for one of our projects, i used it in the past but we had a lot of problems customizing it and understanding how things work, im affraid to get into that again, and i would like to add some things to it but i dont know how flexible it is.
Based on the fact we've been working with CS ever since version 1.0 (and even before as ASP.Net Forums) I can tell you this - CS 2007 and 2008 introduces a great out-of-the-box community solution along with a very extensive platform you can develop on top of and extend.
If you're aiming at Microsoft technologies this is the place to be.
IMPORTANT - Don't rush into their SDK and start changing the moving parts, focus on learning their theming engine (Chameleon) and using it's large variety of controls that get you farther than you could imagine. Use the SDK only when you need a better understanding of the inner working of things and when you've reached the point of extending CS.
IMPORTANT #2 - When extending, remember that Telligent releases two major versions every year, usually including features you'd want for your project, remember to review your changes and develop outside of the product core for easier upgrade to future versions.
Good luck!

Actionscript 3 outside of Flash / Flex

I've just finished a flash project where I did the entire project in "pure" AS3, without the use of the Flex framework. I found very little written about this on the web, so I'm not sure if this is a common way to develop RIA's, or if I've jumped off the shoulders of giants and done something stupid that will bite me later.
It seemed like a good idea at the time (famous last words!), but was hoping to hear from someone who could confirm.
Thanks,
Marcus
There's nothing wrong with it. People do that every day using FlashDevelop and AS3-only frameworks like PureMVC. Doing a complex app without any framework to support may get difficult to support in the future, but should be OK if you adhere to well known best practices. Future maintainability, especially if it has to be maintained be someone else, can also be greatly improved by using common design patterns throughout your code and architecture. Barring all that, if you're really just slinging code to build something with any real complexity, you're probably screwed unless you documented every function and the overall architecture very very well. Maybe not today, maybe not tomorrow, but some day you're (or someone else is) screwed! ;)
Flex is nice if you want to create something that looks great real fast within the confines of what the Flex framework gives you.
We used to fight weird framework bugs which Adobe didn't seem to care about or took way too long to fix. So we opted to drop Flex in favor of our own UI framework and we've never looked back since.
Sounds like a perfectly good idea. Flex is really just an overlay of rapid-prototyping, and communication standards, on top of pure AS3.
What you gain in ease of development and a large library and API, you lose in streamlined, strength and simplicity.
I'm currently developing a medium sized app in Flex and although the first phase of development was a breeze, the later stages have been fraught with weird framework eccentricities.
It is definitely okay. For example, I've heard that the Issuu.com platform is not based on Flex but a custom framework.
Thanks all! I've been very happy with AS3, and like the amount of control I get, as opposed to using MXML/Flex. It's good to hear I'm not crazy!

Resources