

Ask HN: Is it bad to dislike using frameworks so much? - chromium

Hello HN,<p>I've been programming web applications since I was 13 years old. I love doing it, but lately, something's been bothering me. Up to this point, the entirety of my server-side programming has been done in PHP. I learned web development with basic PHP and MySQL, and now work as an entrepreneur in my own company, using that combination.<p>However, lately, I've been bored with PHP. Each time I make a website, I feel like I'm reinventing the wheel when I write new code for things like user authentification or account systems. I keep looking at Ruby on Rails tutorials, and salivating at the beautiful syntax and elegant, DRY expressions. I love the <i>idea</i> of using Rails, as a modern MVC framework that lets me get things done quicker and doesn't require me to re-invent the wheel.<p>The problem is, every time I start using frameworks like Rails, and create my first "Hello World" application, I am dissatisfied. It works- I can list, create, edit, and delete objects that I've specified in the code. However, it just doesn't feel right, because <i>I don't understand how the framework is doing it's thing</i>. What is being compiled into what when I run the app on the server? When Rails "magic" happens, what is really going on? If there's an error, how on earth will I know how to fix it?<p>-I feel like since I didn't code the framework from scratch, I can't use it because I don't truly understand how it works.-<p>Is this a justified sentiment, or am I just too used to working with PHP? Does anybody else feel this way?<p>Thanks for any answers you can give me, I really appreciate it.
======
grovulent
In every aspect of your life you are using tools that you don't understand or
couldn't build yourself. So the question is - how far down the stack of life
should you go? And as far as I've learnt in this life the answer always seems
to be:

as far as you need to.

Which of course - is no answer at all. How far you need to go down the stack
depends on what you're trying to achieve - the particular stack you're working
on, the difficulty of acquiring the skills... and so on.

Perhaps your anxiety comes from the fact that when using a framework that you
don't understand you don't know how to fix stuff when things go wrong - when
your app needs to scale... etc. I guess you have to try to make an assessment
of the risks you face in this respect. Perhaps do research on apps similar to
yours and the technologies they used.

But in general - much of the comments I've read here on HN about scaling and
whatnot seem to suggest that it's something that you can only learn to deal
with by living through it since every application scales differently.

I don't know - I use Django and haven't faced these problems. I choose not to
fret about what might happen because there is too much to worry about in the
here and now.

~~~
amorphid
I agree. You will never know everything, but you can choose to accept some
thing and focus on understanding others.

------
lysol
I think you should write a micro-framework. I feel the same way about ORM.
It's completely irrational on my part because I'm extremely comfortable
writing absurd numbers of joins using crazy criteria for my day-to-day at
work, and have some cognitive dissonance because here I am, about to let a
library do all the heavy lifting for me.

The end result is in order for me to accept ORMs I had to know the pattern. To
know the pattern, I had to write a simple ORM layer on my own. It wasn't
pretty, it wasn't as good as SQLAlchemy, by far, but it gave me enough insight
to appreciate them, and to know when to use them. By all means, keep using
CGI, but leave it to the small projects.

And yes, you're too used to PHP. Branch out, it's more fun.

~~~
chromium
"you're too used to PHP"

So I should write the micro-framework in Ruby? Any suggestions for starting
out with that?

~~~
lysol
Not at all. It's just good sense to pick up other languages in general. Find
one that has something interesting, play along with the official tutorial,
writing the code as you go along.

------
damoncali
It's not bad, but it will slow you down tremendously if you learn how every
framework or library you use works. It's a psychological barrier - just as you
(probably - I'm going on the odds here) don't really know how a processor
works, you really don't _need_ to know how a framework works.

By all means, dig around in the frameworks, but treat that activity like the
hobby that it is.

------
Khao
As an example, would you drive a car if you didn't build it from scratch? What
if you buy it and it _just works_?

This is the way I feel with frameworks. At first I always wanted to code
everything myself but I couldn't achieve anything because it was too much
work. Then I started making websites on top of a CMS (I used CMSMadeSimple but
anything will do really). It could do everything I wanted and really quickly,
and at some point if there was something that I couldn't do in the CMS or
there was a bug, I could easily dig in the source code and fix it myself. Just
like a car, you can pop the hood and play around with the stuff inside, but
since it's already built and working you shouldn't have to play inside it too
much.

------
MattBearman
I was like you, so I eased myself into it, ie:

Raw PHP -> CodeIgniter (PHP) -> CakePHP -> Ruby on Rails

The reason this worked for me is that the CodeIngniter MVC Framework is so
lightweight, well documented and well written that you CAN understand what's
going on behind the scenes just be reading the source code.

In fact CodeIgniter is still my most used combination for web apps, CakePHP is
a weapon of choice for bigger projects or when I want complex ACL and/or the
kind of automatically linked MVC structure that Cake provides.

I'm still relatively n00b at RoR, but I suspect that will replace Cake in my
arsenal once I'm better with it.

Hope this helps you.

------
sylvain_
I completely understand your desire to know how the 'magic' works. But the
good thing with open source frameworks is that you just have to checkout the
sources and see how things are working internally.

If it's too complicated at the beginning you can start by trying to develop
your own micro framework to get more confidence with this and then retry
understanding how the magic works.

------
isleyaardvark
Scale may be a factor. If you're working on a large web project, you're too
busy implementing and taking advantage of what the framework has to offer.
When you're just doing "Hello World", it's overkill. You wonder what's going
on under the hood because there's not much else to look at at that size.

------
ippisl
There's a similar question in stack overflow
[http://stackoverflow.com/questions/203288/how-does-ruby-
on-r...](http://stackoverflow.com/questions/203288/how-does-ruby-on-rails-
work)

The top answer give book recommendations and tools to understand rails.

------
clark-kent
I think your answer will be to go deeper into the Ruby language. You will find
out its not really magic, it's just the way Ruby's metaprogramming works. You
will appreciate Rails more after mastering Ruby.

------
meric
You can look at django instead, I heard it hides less details from the
developer than rails.

