[JavaScript framework wars] The phantom of MVC

Since I was a student, the term “MVC” would be the most of popular words that repeat over and over from my friends and my lectures. They could talk all day about “MVC”, but did nothing else as putting the codes into certain folders M, V, C. Starting working as Flash Developer at Pyramid Consulting and the term “MVC” was haunting me once again. All the ActionScript project should (or must) be implementing strictly as “MVC”. The beginning of MVC framework for me as when we met “PureMVC” that solving several questions and concerns that we never known before. It showed how M-V-C parts working together, communicating with notification … That was fantastic emotion !

“PureMVC” turned into our standardize framework until its alternative “cairngom” appears. This alternative stuff not only offered us “MVC” but also “DI”, “Unit Testing” – the stuffs that we only seen in Java world. For years lately, we had more choices since Flash was on the peak of trending, but Flash was mostly focused for online gamings and the frameworks borns as suppose for game development.

For now, we all know Single Page Architecture (SPA)  using AngularJS, BackboneJS … but don’t we know that Flash Web had played very well on SPA battle fields ? We enjoyed fullscreen websites, and experiment pages transition without refreshing, sounds, 3D, augmented reality … So my wondering was that something ables to replace ActionScript/Flash must offer us the same stuffs as ActionScript/Flash did.

As ActionScript, JavaScript  says “hello world” without “MVC” as its first library jQuery that offering DOM manipulation, animation … HTML web is to create with its own way, slicing psd to html/css, then embedding JavaScript As I mentioned above that “pureMVC” as first offering “MVC” to ActionScript, it’s also offering “MVC” to JavaScript and opened our mind for first SPA HTML/JavaScript stuffs. Flash/ActionScript has stopped their steps and gave its way to HTML5/JavaScript, this chance opens new opportunities for the born and develop of JavaScript frameworks (hold a sec, that makes me think about the death of dinosaur …). Have you ever answered yourself that how many JavaScript frameworks are there ? Find your own at “TODO mvc“. Seriously, then several questions come to you now.

– Which one is the best suitable for me ?

– Which one that I should pick up for starting ?

– Which one is suitable for mobile development ?

– MVC and MVVM, which one is right for me ?

While you’re sinking with those questions, don’t you realize that you’ve just joined the war – the war of making choice your suitable framework. The fact that you would not be alone, because not only you but several developers get confuse with a ton of frameworks. By this time, I am in charge to pick up the right framework for my organization. We have several kinds of projects and we must pickup the right one with ensuring less risk, but most suitable for maintenance. Once again, I must face my face with the phantom of “MVC” but now it’s not seriously because “MVC” has been became the most popular pattern, or set as standard of JavaScript frameworks.

The war was out there, but just happening to me. I must choose my side, or do compromise. The next post that I will perform some statistic, queries from Stack Exchange that how developers on the world choose their own framework. That may give us an overview for a big picture.

[pureMVC] Javascript version – bình mới rượu cũ

Cách đây vài năm, khi Flash/Flex development còn phổ biến thì pureMVC được xem như là một trong những framework mẫu mực dành cho công nghệ này.  Nếu bạn từng là một flash/flex developer, bạn chắc hẳn đã từng sử dụng hoặc nghe về framework này. Bản thân pureMVC – như tên của nó làm một framework thuần túy theo pattern MVC nên nó được port sang rất nhiều các ngôn ngữ phổ biến như Java, C#, Python … Javascript cũng không ngoại lệ.

Một số thống kê gần đây cho thấy pureMVC không nằm trong danh sách các framework javascript phổ biến như thống kê dưới đây chẳng hạn.

Theo quan điểm cá nhân của tôi thì bản thân pureMVC không thật sự hỗ trợ tốt cho HTML (tương tác với DOM object, hỗ trợ HTML template, partial …). Tuy được port sang nhiều ngôn ngữ nhưng nhóm tác giả pureMVC lại không cập nhật và phát hành thường xuyên, có lẽ vì ít người sử dụng nên hầu như không có nhiều feedback cũng như bug report.PureMVC là một framework gắn liền với Flash /ActionScript nên các lập trình viên HTML/JS cũng ít quan tâm đến framework này hơn. Bản thân tôi khi chuyển sang HTML5/JS cũng đã chọn lựa AngularJS, BackboneJS, KnockoutJS cho các project của mình hơn là pureMVC.

Điểm hấp dẫn của pureMVC chính là tính “thuần” MVC pattern của nó – bạn có thể dùng pureMVC để kết hợp với các framework Javascript chưa có MVC như CreateJS, KinectJS để từ đó tạo ra các project có cấu trúc tốt và dễ bảo trì.  Bạn có thể tham khảo source từ puremvc.github.io  hoặc từ app-seed project mà tôi đang thực hiện.