1
wishcraft
MVC vs. C++ Class/Include structure & XOOPS

You know I honestly even though I sometimes program it thing MVC is more bull than more traditional layouts of source code. See with MVC you have to type around 3 to 4 times as much code and personally I think it is just an industry fad!

Part of the reason why i made the choice to learn XOOPS over the then industry CMS like drupal and Joomla and so on, is it has a c++ style layout of the file structure and it was something I was familiar with from years of c++ programming. The other reason was the condom it come with 'protector' which prevents most forms of attack and keeps the file base safe from things like SQL Injections and forced entry!

See with the MVC style code, there is over 45 more lines of code per even the most basic functioning structured command! With the traditional c++ structure this may consist of a primary driver file, a class and an included common functions! Which is a direct method of call! I think MVC is a fade to make code in-organic and rudimentary obfuscated and long winded... IT is a programmer cum stain on his t-shirt if you swear by MVC.. It is just a fade your caught up in that makes your RSI kick in sooner! I don't know if XOOPS needs to be MVC some people say so, but then for all the old school programmers that program things like c++, c ansi, pascal, delphi and VB the file base becomes obfuscated!

2
redheadedrod
Re: MVC vs. C++ Class/Include structure & XOOPS

Simon, while MVC forces you to think differently it is a new way of doing things and for good reason is the way of the future. You need to change your methods or be left behind. When working in a team it allows you to separate the different sections of code and have different programmers with different expertise work on their areas without affecting other stuff. With Xoops you can see its power with the use of a Templating system. The big difference between the current Xoops system and a true MVC is that Xoops still mixes the Model and Controller into the code where as with 2.6 there has been much progress in removing the View.

Unlike programming I am used to in the late 80's early 90's where you had to fit as much code into 16K of ram initially for a basic program, today's computers have much more space available. By separating out the code you are making maintenance on the program much easier and someone else reading the code much easier. Sure it will make more lines of code but this is not a bad thing. In this age of compilers and caching of code and such it doesn't matter. The compiler or cache engine will convert the code into a useable piece of code for its use. It won't care if you use MVP, Procedural, OOP or any combination.

And regardless of your view, "beautiful" Spaghetti code is still Spaghetti code that is hard to maintain and to understand. Another item that as programmers we hate to do is to document what we are doing or follow standards. These are inconvenient at the time and seem like more work. But in the end it saves you work on your debugging and later maintenance.

New programmers that have never had to worry about fitting their code into a small memory space are not likely to worry about such things but really, MVC is about maintainability, structural integrity, self documentation/simplifying of code and MVC code is generally much easier to reuse.

Another aspect of MVC code is that it allows the use of Unit testing. With Unit tests you can run code in the Model and the Controller without regard to how it will look and fully test the engine of your code and make sure it runs well. Any programmer that is worth their salt will embrace unit tests once they understand how they work and why they are a good thing. Again it seem like a waste but in the end things such as unit tests and MVC save LOTS of time during the Maintenance stage of a programs life cycle.

MVC is a very important progression in programming technology and if anything will likely be split out further with the addition of unit tests being standard. This and other new technologies such as "Agile development" and team based programming are the future and if you don't learn about them and embrace them you will be left behind as less experienced programmers and less talented will be able to program circles around you because they will have much more free time.

You have to get away from worrying about the length of code. There are also studies you can do about the complexity of code. There is a ratio that some development tools can do to determine how complex your code is. This can incorporate "creative" programming techniques that seem like a good idea at the time but can be difficult to figure out later. Just because you can combine everything into one line instead of 10 lines doesn't mean it is a good idea. Also as can be seen by module developers upgrading old PHP 4 based modules, spreading common code throughout your code base may seem like a good idea at the time but isolating it into classes and building an MVC type environment can actually make future upgrades much easier because all of the related code is in one place instead of spread out throughout the code.

When OOP came out there were some hardline programmers that said it was a fad. That procedural programming was the way to do things and OOP was stupid. It is more complex and harder to understand. But if we look today pretty much every language has moved to OOP and as much away from procedural as possible. There still exist languages such as PHP and some others that you can do both in but it is impossible for you to program in languages such as C# or Java without using OOP.


3
wishcraft
Re: MVC vs. C++ Class/Include structure & XOOPS

Quote:http://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller

Quote:
History

MVC was one of the seminal insights of the early field of graphical user interfaces, and one of the first works to describe and implement software constructs in terms of their responsibilities.[6]

Trygve Reenskaug introduced MVC into Smalltalk-76 while visiting Xerox Parc,[7][8] in the 1970s; next, in the 1980s, Jim Althoff and others implemented a version of MVC for the Smalltalk-80 class library. Only later MVC was expressed as a general concept, in a 1988 article.[9]

The MVC pattern evolved, but as a variant of the original concept, and because "parts of classic MVC don't really make sense for rich clients these days":[10] HMVC, MVA, MVP, MVVM, and others that adapted MVC to different contexts.


Rodney with another stuffed contextualised thread which warrants as spam... MVC had been used for at least 8year before 1988.. It is not new and the class/include system was brought out later being more efficent.

MVC is just a fad!

Thats what wikipedia like mine says! Peter Strong an I are close friend for many years!

4
redheadedrod
Re: MVC vs. C++ Class/Include structure & XOOPS

MVC is not a fad any more than OOP or Agile programming.

It works well with teams of disassociated programmers that all have different talents. As we move away from single programmers and work as teams these techniques will become more and more prevalent.

As I mentioned earlier OOP originated decades ago but really didn't take on a world of its own until C++ came out.

Other programming techniques are coming out now that solidify the idea that MVC (or similar structure) is the wave of the future. With Unit tests you can test the model and controller extensively without regard to the GUI.

MVC and OOP are two things that are being pushed a lot in school now. For great reasons. And because of those and other technologies coming out they allow for powerful unit test systems and other such things to develop. I used to be close minded like you about these things until I actually started using them in classwork and saw the over all picture. MVC might be a stepping stone to something else but it certainly is not a fad any more than C++ or OOP is. Other technologies may be developed that can offer the same power but easier to use but this doesn't mean they were a fad. They just got upgraded.

We can look at C and it is certainly not a fad...

It was more or less replaced with C++ but you still see programs written in C. C++ has been simplified and expanded in systems such as Java and C# but this doesn't mean that C or C++ are fads and both are still viable languages although C++ takes more line of code to do the job and C takes even more.

Its all about teamwork and keeping things simple.

There is no room for "artistic" coding in large team oriented programming projects.

So as I said, one needs to evolve if they are going to work in a team environment or be left out. Will you find work? Sure... But you will not be considered a team player.

Rodney

Login

Who's Online

193 user(s) are online (116 user(s) are browsing Support Forums)


Members: 0


Guests: 193


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Apr 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits