PHP Development – Programming Without MVC, Classes, or Framework

frameworksmvcobject-orientedPHPweb-development

I have been programming for several years now, and back then (learning PHP) I've didn't learn to program using classes, MVC-logic or using any frameworks. I found my self solving my problems very well using my own functions.

Eight months ago I was recruited to a start-up, to develop a huge social platform. I have been working there for several months now, and built up a huge website with various complicated features (+35k lines of code I guess), and I could see my self continue like this. Everything is coded without any framework, no classes or with MVC-logic, since I didn't have the time to learn it (we had to move fast).

I do write everything in functions, and put a lot of effort in well documenting/describing my code as well as organizing it beautifully and easy-to-read.

However, it is top of my list to learn Classes > MVC > Laravel (or any other) framework. But I just can't see my self stopping now, learning above list, and then rewrite all code. This would simply push us back in time, and in the start-up we're moving fast and have many deadlines for new features/ideas/development.

I've spoken with many people regarding this, and people say a lot of different things. Some say it's a matter of taste, and you'll be able to move on with it. Others say it's incredibly stupid, you're not scaleable, you're never get serious funding, you're the only one who ever be able to work on the project, you should stop and start learning it now, etc.

Am I doomed? I feel lost. My personal opinion on this is, that even though it is a huge system already, it is still a MVP and I guess at some point in the future we would rewrite the code anyways. This is, if we're at such a successful stage in our venture and growing very fast / getting funding / etc.

Best Answer

Learning OOP is definitely worth it. Passionate hireable developers are always willing to learn to expand their knowledge, specially when you can save time in the long run. I would agree more with the second group of people:

Others say it's incredibly stupid, you're not scaleable, you're never get serious funding, you're the only one who ever be able to work on the project, you should stop and start learning it now, etc.

That's a bit harsh, but the reality is, the more you know, the more you scale. Serious funding is often surrounded by hype, and procedural code is unfortunately not cool enough. OOP and frameworks are.

Am I doomed? I feel lost. My personal opinion on this is, that even though it is a huge system already, it is still a MVP and I guess at some point in the future we would rewrite the code anyways [...]

Large procedural code bases are not uncommon, see WordPress. OOP really helps to abstract and organize your code without relying on procedural conventions (although MVC frameworks have a whole different set of conventions). WordPress started a migration process, that's still going on today. With such large projects all you can do is upgrade your system, step by step, testing that nothing breaks, and keep re-factoring, forever, as you'd introduce new features that will need refactoring later on.

But no, you're not doomed, just a little bit late to the whole process. Learn what you can when you can; less is better than nothing. The learning curve when learning new programming paradigms, or languages, is often steep at first, but after that first hiccup it'll be smooth sailing, and you'll start to really appreciate the difference it can make on your code, and the difference it will make when others read your code.

Edit: Just to clarify, I'm not suggesting the current system needs to be OOP, or that it needs to be built from scratch. Any system is going to be re-factored, at some point, and you may need to break compatibility with previous system, and that's fine if the project requires it; you can have a deprecation cycle as well. What I'm suggesting is to slowly introduce OOP as you refactor your current code, namespaces, etc.

Related Topic