Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

When starting the first project in a new language, you have basically two approaches to learning. Either you do a quick Google search, pull together the most popular frameworks and libraries and work your way from their tutorials towards what you want to achieve (top-down). Or you start with the language basics and the standard library and by and by replace your own simple components with more sophisticated third-party components once you know what you're searching for (bottom-up).

Now I'm about to embark on my first serious Javascript project. There's probably as much to know about the language as there is about jQuery, ExtJS and whathaveyou, and I'm trying to decide what to focus on.

share|improve this question
3  
I usually approach a language from the middle, gutting out its internal structure until the top crashes down on the bottom and forms one giant tangled mess of ASCII characters...but I digress... –  Stargazer712 Nov 3 '11 at 17:15
    
^ Sounds like jenga. –  George Duckett Nov 4 '11 at 10:38
add comment

8 Answers 8

I have used the bottom-up approach with C, PHP and Python and the top-down one with Java.

Bottom-up seems to take longer and makes you write a lot of code that has already been written by others in a better way. In PHP, I'm still reluctant to spend time learning frameworks because I feel I could just code the relevant parts myself in less time, which is kinda stupid in the long run. On the upside, I found that it's easy for me to fix problems I have with some foreign codebase, even if it's huge, like, say, Magento.

Top-down gives you a lot of speed at the start, but sooner or later the abstractions start to leak and you encounter a lot of problems you are not yet equipped to deal with. This deferred learning can be very painful and slow, because you already have this huge app running and it's under load and there's tons of stuff in it you don't understand. This hit me hard with OSGi and Eclipselink: I had to fix serious problems in my app that used both, without understanding JDBC, annotations, class loaders, JVM optins etc. Also, I overengineered a lot.

Anecdotally, a nice example of the side effects from top-down learning is this question of mine on stackoverflow. After having used servlets, JSPs and Struts for quite a while, I was still lacking some very basic knowledge on servlets that I then discovered on SO's wiki page for the servlets tag.

share|improve this answer
    
Totally agree, but for me, one of the best parts of the whole StackExchange range of sites is finding out all those things you didn't know you didn't know, regardless of years of experience or skill. Even if you do things from the bottom up, it's no guarantee you know everything :-) –  dash Apr 10 '12 at 22:08
    
Maybe the problems you encountered while approaching Java in a top-down manner are not inherent to the approach, but rather to the language (or the libraries)? ;) –  back2dos Apr 10 '12 at 22:49
    
@back2dos - I don't think so. It seems to me that it's implicit in the fact that you start out with a huge amount of code already written, as opposed to slowly growing your own code. I definitely think it applies to the jQuery / JS universe as well. –  Hanno Fietz Apr 11 '12 at 10:07
    
@back2dos - Also, I wouldn't generally favor either approach. Both have their merits, and the more time you spend with a technology, the less difference there is between the two. –  Hanno Fietz Apr 11 '12 at 10:10
    
Well I think that in fact Java's unwieldy nature is a factor in the problems you encountered, but that's off-topic here. Still "slowly growing your own code" sounds a bit like reinventing the wheel on a not-invented-here basis. Don't hesitate to use 3rd party libraries without understanding their internals. If your system is properly designed, you can always swap them against some custom homebrew. –  back2dos Apr 11 '12 at 12:13
show 1 more comment

I think it depends on whether you want to really learn the language (e.g., you'll be using it on a regular basis for quite a while) or just want to learn enough to get by (e.g., after completing one fairly small project, you're unlikely to use the language again).

To really learn the language well, you just about have to use what you've called the "bottom up" approach. If you're not planning to use it for very long, what you've called "top down" is probably more appropriate.

share|improve this answer
add comment

I've tried both approaches, and personally I must say that the bottom-up approach has worked the best for me.

When I do the top-down approach I tend to over-engineer. Usually I find it easier to just start if I find a simple enough problem (for instance implementing something from Project Euler or doing a Coding Kata), and then trying to utilize the language I want to learn for solving the problem.

share|improve this answer
add comment

I believe most human learning are bottom-up by design. How much ever you try to learn to drive car by theory or book, you only remain a beginner until you have driven actually for quite a few kilometers, unless you have had and avoided some accidents and managed to break and fix things.

Also, a lot of time you don't quite need to learn everything about the programming before you start. Many a times, it is easy learn just basics and start applying thought on given problems and keep seeking for "how should one do this" from experts till you form your own opinion about it.

True insight in programming comes only by trying most thing first hand and that comes only by experience.

share|improve this answer
add comment

I'd argue for a middle-out approach. Start by learning what's unique/cool about the language. If you're learning Lisp, learn macros first. If you're learning C, try to wrap your head around pointers. If you're using D, try to grok template metaprogramming and ranges. If you're using C++, try to understand STL. If you're learning Python, try to understand list comprehensions and creating types at runtime. If you're learning Java, learn your way around a fancy IDE from the start, since Java's main strength is tool support.

Third-party libraries/frameworks are so specific and change so fast that they're only worth learning if you actually need them for a specific project. The standard library can be learned as you go. The basic syntax and semantics of the language will naturally come to you while you're trying to learn the unique parts of the language.

Such an approach will prevent you from seeing your language as just another syntax for the same old thing, and expose you to whatever is likely to be the most challenging and least like anything you've seen before immediately.

share|improve this answer
add comment

I think it depends on two main things, first the programming language which you are trying to learn, and second, the way you personally learn best.

For JavaScript, I would recommend using the top-down approach, especially if you're already familiar with programming in general. If you were looking into a library such as jQuery first, I feel that you will gain a lot more insight, and will be able to start building really neat web functionality quite quickly. However, if you were trying to learn a huge general-purpose programming language such as Java, in my opinion, the basics are where you should start.

On the other hand, if you're just not the type of learner who is able to process the amount of different concepts jumping full force into a library such as jQuery would present to you, the approach just wouldn't work.

share|improve this answer
add comment

I almost always take the bottom up approach.

When I learned C, C++, Perl, Haskell, and Ruby, I took the bottom-up approach. IMO, you cannot truly learn a language from the top-down. If you can't yet use some the lower-level skills, you really have no business (excuse my language) to be doing any major project in that language.

As for JavaScript specifically, there are a few exceptions (according to "law"). First, if you are going to go into a big project using JavaScript, you MUST use JQuery. It makes life 1000000000 times easier. As for any other libraries, learn those at a later date.

share|improve this answer
add comment

The first thing you should do is to learn about why it was made and by whom. Then, read about the problems it solves, and most importantly, the limitations of itself. Frameworks are not the language, it like learning japanese from those small books "speak japanese in 12 hours". That's a framework. I try to tackle small problems first and then look at what's different, unique. Another thing to note is that you must look for implementations, where it runs, how it does it's thing, and everything that will get you to know it's culture. It's like learning the grammar of japanese and believing that's the whole thing. A hard example of this is C++. Almost everyone codes C++ as C with objects. It's much more than that. In your case, a lot of coders think of Javascript as a crude language with almost nothing and resort to just JQuery or whatever library to solve their problems. My advice is to learn the culture first, then the special problems it was made for, then general "glue" stuff. Only then resort to frameworks designed to cope with it's inherent problems.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.