You are not your Framework

Nick Cinger on January 31, 2018

There is a worrying trend developing among web developers that should be raising red flags in the community. We've gotten so good at promoting Be... [Read Full]
markdown guide
 

Inevitably the frameworks will fail you, so yes, learn how to dig in deeper and change things.

I can assure new programmers that the idea of a "best practice" is tenuous. They change all the time, and there are several competing ones. This isn't an invitation to invent everything from scratch, but feel free to tweak the best practice to accomodate your project.

 

One thing I've learned in eight years: there's no such thing as Best Practice.

We have Good Practice. Learn it well, and use it until you have a reason to depart.

But there is no Best Practice, because it is saying there is One True Solution To Solve All Problems, and literally the entire history of computers proves that premise ridiculous.

 

I wrote my own version of MVC and also tried creating a custom CMS, am glad I did that it made me invest in a proper framework, and for each I always read the internals to understand the Philosophy before picking it up. I would never take a Framework popular for magical methods and all, because that would increase debugging time for me. It's important to know the underlying concept and practice while using a Framework.

 

I remember writing my own terrible CMS that my website ran on for years. Would I use it now? No. But the things I learned from building it were definitely worth the time investment - I just loved working on it, learning how classes worked, setting up a database schema for it, trying to secure form submissions and trying to hack my own work. It was fun!

 

And that's how developers learn!
I did the same, I used to have "Custom CMS building" listed in my freelance profile. Definitely not something to write home about, but it did the job and I learned to appreciate the work that frameworks take care for me under the hood.

 

Couldn't agree more. I cringe every time I hear "Don't reinvent the wheel", how am I supposed to learn?

 

Trying to make and use a square wheel can be very educational, and is in no way a waste of time for a learning dev.

 

Eeeeexactly. Doing it for an on-the-job thing where time is an issue and there are a bunch of other factors? Totally different story. But for side projects and your own edification? Oh hell yes.

 

And sometimes, it turns out to be a pretty darn useful non-square wheel in the end. See also, Please Reinvent the Wheel...

Great minds think alike, or some such :)
Thanks for sharing!

 

This is so beautifully put, it makes me grin from ear to ear. THANK YOU.

Especially...

But for goodness sake learn to ride a bicycle after a while - don't just title your portfolio "Tricycle Expert".

Goodness, you just described a good 2/3 of the industry!

To put this in even more relative terms, don't bind yourself to abstractions. I make a point to always know what's going on under the hood of any abstraction I use - language, library, framework, toolkit, whatever - and to be flexible enough to move from one abstraction to another.

And yes, that means I eventually work my way down to a basic understanding of Assembly. If you're not willing to touch there at some stage in your career, you're in the wrong field. ;) [But, by all means, take 20 years to get there if it takes you that long.]

 

Thank you very much for the kind words!

Agreed on going lower into the tech stack. It's not mandatory, but it'll help you understand how it all comes together. It comes especially handy when doing serious optimizations.

 

Good point for Paragonie Scott ! Such great projects he's pushing forwards.

 

Honestly, I don't know of anyone else that's improving PHP security/cryptography with his tenacity. That deserves a highlight.

 

So true ;) This remind's me a lot of @vaidehijoshi and her basecs ;) Make sure you understand what's behind the curtain.

 
[deleted]
 

That's awesome!

I don't know at what level your own framework is, but there's no harm in learning one of the bigger more popular frameworks. Chances are they handle a lot of what you may need. And with you knowing the ins and outs of a framework, with it's routing, request handling etc, you're probably ahead of the curve on a lot of the technical bits.

There's a place and time for the popular frameworks, and a lot of advantages to using a battle-tested one as opposed to your own. Don't write it off out of hand, more so because you probably won't have trouble learning how to use one.

 
[deleted]

That's awesome :)
Composing a framework like that is a good way to go.

 

This is an excellent article. Frameworks can do awesome things for you, but you can break free if something you need to do can be done more efficiently outside of it. Also, it's worth doing at least some vanilla stuff because then you'll see what the framework is helping you with - and where it might be getting in your way.

 

Thank you!

Frameworks can do awesome things for you, but you can break free if something you need to do can be done more efficiently outside of it.

I wish I had know this starting out. Would have saved me a few headaches.

 

young people do this crap because they feel like the places other people crowd around (frameworks) are more valid than themselves because people who are inexperienced or young (like me) dont like to self-actualize.

self-actualization is difficult for everyone, even those who are self-aware, and the especially anxious ones dont want to get their feet wet with trying it the way that involves file_put_contents(); and similar length functions or with actually using the language's constructs like for loops. its like using shiny new es7 iterables over a simple for loop.

im constantly in anxiety with my code that whatever i write is "impure" or like youve alluded to doesnt follow "B E S T P R A C T I C E (tm)". i go with express rather than native node.js http functions not because its easier, like with automatically sending back headers and formatting json, but because it feels more "right" to do so.

ironically what keeps us young bois from healthy challenges like critically thinking is unhealthy challenges like fear of failure or fear of missing out.

 

I can relate to this very much.

I've used the framework tools constantly, just for the fact that they must be somehow better than using the language constructs directly.

After a while I started hitting odd bugs within those methods, and I started digging into them, only to realize that they're usually over-bloated, and that they merely wrap around the language constructs.

Not to mention that they caused performance issues with huge data sets, where a every bit of memory saved was important.

After this happened a few times, I made it a habit of actually reading the code for the internal framework tools. Granted, this was easier with the older frameworks as the more modern ones are abstracted into oblivion. It's still possible with the new ones as well, once you go beyond the initial fear of seeing things like Traits, extensions and interfaces.

 

i do this too with documentation. i often try to break things down or try to reimplement things on my own time so i can understand whats going on in an intuitive way. you can be a lazy js developer and copy and paste app.get("/bla", (req, res) { do stuff(); }); or you can break it down and understand it.

i dont even count as anywhere close to a junior developer, but something ive noticed about professionals is that the more "professional" you are, the more you can make yourself seem like you know what youre doing

It's all "fake it 'till you make it" :) Experience you'll come by with time, but having the right attitude and approach will get you far, so try and hold onto that!

One of my "life hacks" for learning new things was to NEVER copy/paste. I'd always force myself to type it out, even if it meant ALT-tabbing 10 times. Helps make the new code "stick" and get into muscle memory.

 

Question: does that mean I need to learn C before I can write any PHP? If you follow this line of thinking all the way down, a framework is just another language on top of PHP in userland.

I think the intention is good in your post. Learning the tools takes you from beginner to journeyman, and mastering them makes you a craftsman. That takes years of work.

Frameworks are excellent at hoisting up beginners while they learn how to code, and as they get deeper they will naturally gravitate towards learning more of the "magic".

 

does that mean I need to learn C before I can write any PHP?

Uhm, well no, that's not what I'm aiming for, but a parallel can be made. For example, if you want to be better at optimizations and handling memory, then yes, please learn C. I know it helps me in my work. For that same reason, you should learn how PHP Sessions, Requests and Headers work, to be an effective web developer, even while using a framework.

As to whether you need to, that's totally up to you. But you would definitely be better off for it.

Frameworks are excellent at hoisting up beginners while they learn how to code, and as they get deeper they will naturally gravitate towards learning more of the "magic".

Usually, I would agree with you, but I've been encountering a different reality in which experienced developers never grew out of their favorite framework, and never learned what the cost of the "magic" is. Hence this post!

 

Another point that I realised at some point is that, as others said, frameworks will fail you.

Even if you don't decide to move onto to a new shiny framework, the one you currently use, and have used for years, may just start going on a direction you rather not follow.

Alternatively the web, users' or your workplace's may change, making it harder for you to deliver solutions inline with those new requirements whilst abiding by the rules your framework imposes.

I think that in summary, accepting that frameworks (and even languages to a degree) are just tools for the job will make things a lot easier in the long run.

 

Great article!
I got my first job 10 years ago because of my horrible CMS I made from scratch, that's the best way to learn.
If programming was to be compared to art then frameworks would be "paint by numbers"

 

That was absolutely true, with many kind of frameworks around us, new developers are directly involved in analysing what framework to learn rather than thinking what makes those frameworks work. They just try to compete with the people around them rather than trying to learn from the scratch, not to mention that i had this perspective too and took some time to come over it. Moreover, the basics matters the most.

 

Ever considered that PHP is an Assembly framework? (For a given definition of ‘framework’)

 

That might be pushing it a bit though :)
PHP by itself is already a web framework. Maybe a C framework, if we're being cheeky.

But even in that line of reasoning, there are advantages to going lower into the stack. Understanding how C and ASM work will make you a better PHP developer, although with more diminishing returns.

 

So basically, it's all relative ... which was the point I was trying to make :).

 

I can't agree more with you Nick, all I can say is "Thank YOU!" :)

 
 

Bye bye Fat Models, hello Services!

Seriously? That's obvious...

 

Hah, you'd be surprised! Wasn't obvious to me when I was starting out, and there was this trend of Skinny Controllers, Fat Models back then.

code of conduct - report abuse