The Myth Of Framework vs. No-Framework On Web Development
The debate has been for as long as the word “web framework” exists and the supporters on each side are pretty much standing firmly on their grounds. I am not here to even give an answer of which one is better base on my makings/experiences/encounters. I am here to briefly (yes… briefly… otherwise, it’s going to be an dissertation ^_^… trust me on this :) ) show my journey of building an web application project using my very first web framework.
I put a specific title which is “Web Development” on this writing. However, it should apply to any kind of developments too. Really…
It’s a myth and I am still learning about how to get the hold of the right balance and stand right onto the fine line in between.
My Background & What I Do
I have been a web dev for… forever (and a mobile dev for couple of years). I am intriguing to say that I am a hacker, a developer, an engineer, or a coder, but usually I don’t describe myself as a REAL coder/programmer since I sort of self-taught myself to this point. Of course, I got some helps along the way. For instance, I got my 1st software engineer job from a VoIP company back in 2002 when I knew very little about programming (meaning that I was not capable of handling even a small project myself or … you can say that I was a hobbyist at that time). Lucky me, the CEO of that corp. gave me the opportunity and I grabbed it and, voila, I am who I am now. Since I didn’t hold any computer science or EE or any engineering degree, I rarely describe myself as an engineer or programmer even if my job was exactly to get that kind of stuff done. In fact, my majors are all in business (e.g., statistics, marketing, finance, and international business) through my years of study. Din’t help much here, did it?
What I Do
Don’t know because I have been influenced by my parents (they run their own small business) since I was a kid or I got hooked when I was in school. I have been trying to build a sustainable business of mine for couple of years since I quit a pretty nice job from a monopoly corporation (over 90% market share worldwide & almost 100% market share in the US) in a traditional industry that most people don’t even give a glance at it. Believe me, those markets are the ones where the big money is.
I started from the embedded system (VoIP products) and then the web and gradually into mobile (well… too much details … so … I am going to fast forward things about me and get into the topic of this writing in about couple of paragraphs). Over the years, I created over a dozen web apps and maybe 5 ~ 7 mobile apps. Partnered up with my friends and iterated … all those stuff… the point here is that … I have never used any frameworks to do any of my biddings before even if I have built a bunch of apps (web as well as mobile). I have never been a believer of any of the frameworks.
Frameworks — I thought they are overrated.
There Must Be One VERY Compelling Reason
Over the years, people have been embracing frameworks and talking about the pros & cons (mostly on the pros). Especially when Laravel framework suddenly took over the PHP world. People have been flocking into developing apps based on Laravel framework. It got me thinking that there must be, at least, ONE very compelling reason to attract the crowd. And… I would like to find out what that is.
There must be, at least, ONE very compelling reason driving people into one place.
Tried But Din’t Get Convinced (the first 2 or 3 shots)
Again, my main purpose here is to understand why people want to use framework based on the time they might be able to save and also the effort that they might need to waste due to the choice of using the web framework. That is why I chose “Laravel”. Since it’s the coolest kid in the playground, I believe it’s the best pick in my case.
Since Laravel is the new cool kid in the playground, it’s the best pick in my case.
Tried about 3 times but each time I sort of convinced myself that it’s not worth it since I spent more time on wrapping my head around the logic of the framework (e.g., where the heck are those files? Where the heck should I pass those variables?… etc.). It’s a lot easier and much faster for me to just use my own libraries and get things up and running. So … even if I started this process about 2 years ago but I wasn’t really into it … I decided that it should not be counted as a real attempt.
It’s a lot easier and much faster for me to just use my own libraries and get things up and running.
Real First Framework Journey Begins
About 3 months ago (by the way, I do 3 different works/jobs… gotta get bills paid, right? so … I only have about 1 hour or 1.5 hours… maximum 2 hours a day to focus on this), I decided to really really give myself and the framework approach (in this case, it’s Laravel) a chance (well… to give web frameworks a chance in general); therefore, I picked up one of my projects (currently running on iOS & Android) and tried to convert its backend to Laravel based product. And … the process and the result were … nightmares… That’s right … the word of “disappointing” isn’t going to describe what went wrong. “Nightmares” is the closest one to describe that.
The Outcome & Process was a nightmare.
What Went Wrong On This Endeavor?
You Gotta Tailor What You Need With What You Can Get From The Frameworks Of Your Choice
The project I was trying to convert is a backend data access point for 3 different mobile apps. It’s a pretty simple concept which is using Apache’s Virtual Host feature to host 3 domains on one web server. All 3 domains have their own databases having their own database users as well as passwords to perform in/out data access tasks. It’s a very straightforward procedure. When I used my own way a year back, I literally spent 5 minutes to get stuff figured out and about an hour everything was up and running. However, when I tried to apply Laravel onto this type of concepts, I kept running into issues every single day. I spent 2 weeks and still hadn’t gotten things done (maybe about 70%… the struggling point was that I couldn’t figure out how to cleanly access 3 different databases on one single Laravel project whenever users access data from different mobile apps). Well… in the end of the 3rd week, I decided to let it go since I could tell that I would keep running into issues if I forced those mobile apps to access Laravel backend this way. (by the way, I modified authentication module… lots of classes associated with it and got things going to an extent but … )
I couldn’t figure out how to cleanly access 3 different databases on one single Laravel project whenever users access data from different mobile apps
What went wrong was that (just my point of view) every framework has its own rules (just like programming languages or anything in the world in general), maybe Laravel just isn’t designed to handle this type of projects. I am not saying that it cannot be done. I am saying that if you wanna get this type of projects done, you will need to twist tons of stuff that aren’t supposed to be modified. Or even if you can touch those classes, it’s going to suck big chunks of your time. Is it worth it in the end? It all depends on what you are trying to achieve.
Is it worthy of doing in the end? It all depends on what you are trying to achieve.
Get Up & Give Laravel Another Try In A Right Way
Since I am a firm believer of “if people are flocking into one place, there must be, at least, ONE very compelling reason for that”, I decided to give Laravel another try. This time, I am doing it the right way which is building everything from the scratch (well… almost everything).
Another try — Doing it the right way
The project is a whim that I had a while back. Actually, I went ahead and built that but didn’t release it. It’s a pretty straightforward project which has one domain accessing one database so … I believe it’s going to be much easier than the last try and shouldn’t have any troubles at all. Well… it took me about 1.5 months to get to this stage. By the way, I built the previous version before using my own library and it took me about 1 week to have the prototype up and running. This time… it took me more than 1.5 months to get to this point (even though I already have almost every component in hands). Partly because I don’t put enough hours onto it (as I mentioned … average 1 hour to 1.5 hours per day) and partly because I am new to Laravel or I should say that I am new to the web framework as a whole.
What’s The Project?
Like I said that it’s a whim that I think it might be an interesting starting point for both development side and consumer demand side.
Countless startups are building great products in every market every single day. However, no matter how great those products are, the succeeding rate is low. Most products fail. We all know we have a marketplace gathering existing great and interesting products information — “Product Hunt — producthunt.com”; however, we don’t have an apparent place to go and see what kinds of products consumers REALLY want nowadays. What if there is a place on the web that you can go and see what people want?
What if there is a place on the web that you can go and see what people want?
“This is What We Want — thisiswww.com" is the implementation behind the above thought. And, as I mentioned, it’s been 1.5 months to convert it from the previous structure to Laravel framework based project. In a way, you can say that I built it from the scratch since I changed quite a bit stuff.
The composing style is inspired by Medium. Since, in my mind, Medium is the best writing platform on the market so far, I thought it will be cool to have thisiswww users having the same feel.
Now Comes The Fun Part
Now the interesting stuff come into play. As I brought up, I am trying to have this writing as my journey to my very first web framework attempt; therefore, I am going to write the struggles and the benefits of using Laravel framework (again… framework in a whole).
Power Tools V.S. Hand Tools
I heard this type of comparisons. “Framework vs No-Framework” is just like “Power tools V.S. Hand tools”. Well… true and false. I’d like to think that it’s an all-in-one tool v.s. a bunch of hand tools in a tool box which you need to look and search for tools you need to use when you need them. The power tools comparison could be true but, once in a while, hand tools just suit what you are working on.
Winding Route V.S. Straight Shoot
In order to pack so many features into one framework, there are rules that you need to follow in order to really take advantage of using a framework. Often that you will find yourself lost in a winding route deep in a forest. On the contrary, if you use your own library, it’s a straight shoot. If you are doing the procedural approach, it’s even more plain and straightforward. What you write will be what you should get from top to bottom. Files, routes, passing variables, receiving parameters… all of such are just super easy to grab, to understand, to process, to modify… even if you aren’t the author of that piece of codes.
In order to pack so many features into one framework, there are rules that you need to follow in order to really take advantage of using a framework.
The Biggest Challenge — to me
The biggest challenge is to wrap my head around the framework every single day
The biggest challenge is to wrap my head around the framework every single day since there are rules that you need to follow; therefore, you just don’t have the privilege to put your files EVERYWHERE you’d like to… which … in a way it’s a great practice (I am referring to using a framework here) because it’s easier to maintain codes as this is one of the selling points of using a framework.
Yup… MVC style … blah blah blah… starting from the route and get hooked on the model then passing variables around to the controllers, views … etc.
Wrapping my head around the logic of the framework is the biggest quest for me so far.
The Pros Of Using Laravel (or web framework in general)
As they often market to the public, it’s a standard if you so choose to use one. Hence, it’s going to be easier to maintain down the road either by yourself or by someone else. Especially if you work as a team having more than 3 devs working on the same project. So … without further ado, I am listing pros of using a framework from my angle,
1) Highly Maintainable
As mentioned, either by yourself or someone else. Why? Because every framework has its own structure/logics, you need to follow “IT” in order to use them properly.
Because every framework has its own structure/logics, you need to follow “IT” in order to use them properly.
As many of devs put weights on this, they often bring up the saying of “do not re-invent the wheels”. It’s true to an extent. If you only need standard wheels, it’s going to be super efficient of using one of the frameworks; otherwise, your vehicle might just break down in the middle of the operation.
If you only need standard wheels, it’s going to be super efficient of using one of the frameworks.
Frameworks usually went through the security scrutiny rigorously already. When you use it, you don’t need to put yourself into that turf to get everything checked/patched yourself. However, again … if you just wanna have a super clean and simple MVP (minimum viable product) up and running, this might not be the route you should take.
4) New tools on the belt proactively
Although most of us like to learn new stuff (and also constantly push ourselves to acquire new knowledge), we just have so much time as any single living species in the world has. I, for instance, sometimes just got lazy that I don’t look for new things that will make my life easier proactively. However, by diving into a framework, some of the plugins or stuff (codes, styles, some other features grabbed from other open source projects) just need to be absorbed before I can start build my own creations. This forces me to get my hands onto those useful tools and puts those tools in my toolbox so … I can pick and choose depending on the encounters that I might face down the road.
5) Refining your own codes
It’s a great way to refactor your own code base since you will need to read through other devs’ codes, it will present an opportunity of getting your codes being cleansed. Or in a plain English, you will become a better dev because you will see and need to go through great code bases (… well… of course, you might see some bad practices as well. So … pick and choose what you would like to have and you can apply those practices to your very own code base).
The Cons Of Using Laravel (or web framework in general)
It’s the life… there are trade-offs.
Of course, there are cons if you so choose to get on with a framework. It’s life… there are trade-offs.
It’s just so much more layers of codes on the top of one another. Layers over layers over layers over…. well… you do the math. In order to have a highly maintainable code base, frameworks need to have some complicated structures to limit creator’s flexibility. So you face the complexity and traded off your maximum flexibility in terms of writing codes… in return, you (might) get on an express lane to get your jobs done.
you face the complexity and traded off your maximum flexibility in terms of writing codes… in return, you (might) get on an express lane to get your jobs done.
I mentioned that the structure and logic of the app flow are the most challenging points to me. I still constantly try to wrap my head around the Laravel framework to figure out where the heck my codes are. In this stage of my encounter with frameworks, this is inevitable since I am new to it and still have much more to learn. Therefore, instead of the flexibility of writing codes in any files and putting codes anywhere I want, I need to write codes on designated files and put those files on the assigned folders. In a long run, it supposed to be and should be a better way to get back to review the codes, to debug, or to add new features since it’s highly structured. I know that I will still need to scratch my head around to find codes… but … well… thanks to those modern text editors (I use Sublime Text to do most of my biddings by the way), locating codes shouldn’t be too painful… at least… in my case, I can tolerate that.
2) Many Unnecessary Features & Checks
Most projects are trying to solve just one or maybe two very specific problems in the beginning. Using frameworks put unnecessary weights on those projects.
If you wanna have a simpler and straightforward explanation, take a look at the video as follows. It’s from Rasmus Lerdorf, creator of the PHP scripting language.
Only 2 Cons?
You might think … wow… there are only two cons but many pros… so … everyone should opt-in to use frameworks, right? Well… again … this is just from my point of view. For instance, many devs think that using frameworks are no good since you waste time on learning frameworks instead of learning programming languages. However, I think that even a programming language is a framework. Therefore, to me … it’s another pack of tools that I need (I believe that I should also say that “want” since it probably will make my life easier) to have to get jobs done.
I think that even a programming language is a framework to me.
Of course, if you don’t know the language behind a certain framework, I highly recommend that you should try to build up a project from scratch without any additional frameworks other than the programming language behind it (confusing… right? since I mentioned that programming languages to me are frameworks too … well… you will get your head around on this very soon if you choose to dive in) if you can afford (e.g., side projects and not going to affect your living… again… gotta bring foods onto the table).
you should try to build up a project from scratch without any additional frameworks other than the programming language behind it … if you can afford.
It is always better to have choices
If you are expecting me to give a definite verdict on “Framework V.S. No-Framework”, you will be disappointed because I really don’t have a absolute answer for this. It all depends on your needs. However, I can tell you one thing though… It is always better to have choices. If you have many weapons which you can pick and choose in your arsenal, your chances of winning battles/wars are going to be much much higher. If you wanna me to give you an example of power tools vs. hand tools, here comes as follows,
Scenario #1 — tighten sunglasses screws
Well… if you only have a power tool (most of the power tools don’t have this small screwdriver for you to use), you are screwed. So … you need to have a simple hand tool screwdriver to do the job.
Scenario #2 — mounting a flat screen tv on the wall
In this case, you can use either tools but which tools will make your life easier? If you have a power tool screwdriver, you will get this job done faster and, in most cases, better.
There Is One More Thing
Ha… I still have one thing to say though. Remember I mentioned that many devs usually bring up the saying of “Do not re-invent wheels”? Sometimes you need to if all the wheels you can find on the market just don’t fit into your vehicle.
One more thing — Sometimes you need to (re-invent wheels) if all the wheels you can find on the market just don’t fit into your vehicle.
Therefore, … really … you should try both approaches. I know you will be reluctant to do that since it totally will mess up your head and, in a way, the creation process (I see building software products are a process of creating arts) will be totally destroyed. You might lose your creativity when you first start a new journey on this but you will get it back once you get your head around it. After that, again … you will have more tools on your belt. More choices is always better down the road.
Building a software product is a process of creating an art
AngularJS + Laravel — Here I come :)
I would like to try to mix AngularJS with Laravel together. Although there are some posts for this type of mixes already (AngularJS on the front-end; Laravel takes care of the back-end), I wan to get though it myself to see the feasibility of putting this sort of actions on the production level.
And then … I’d like to get into mobile by taking Ionic Mobile Framework into action. It’s hard to say how difficult (or easy) those moves are going to be; however, at least it seems feasible to me though and … that is what matters most :)
It’s hard to say how difficult (or easy) those moves are going to be; … it seems feasible to me … and … that is what matters most :)