• Advertisement
Sign in to follow this  

Best programming paradigm for noobs?

This topic is 1048 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

If a noob, who knows nothing about computer programming, wishes to embark on the painful journey of developing software, what is the best paradigm to start with and why? Procedural? OO? Functional?
 
 
I've been thinking about this lately because at college Java is the first thing to be taught and I noticed there to be a lot of confusion among the students. Those who have never been close to computer code are having an extremely hard time grasping the concepts. Those who have programmed before are having less of a hard time, but are still utterly confused (try explaining to them what the "this" keyword does, for instance).
 
I personally started out with BASIC when I was 14, and much much later I decided to learn about OO. I think it's a lot easier to learn a procedural language before learning OO.
 
What do you think?

Edited by TheComet

Share this post


Link to post
Share on other sites
Advertisement

I've no experience with functional, and I must remedy that, but I do like a lot of what I read/hear about it.  From what I understand, the concepts that functional programming teaches you are genuinely useful and are going to be more useful as we move more and more into an era where writing good, robust, thread-safe code is of paramount importance.  So if my understanding is correct, then that's what people learning programming today should be learning.  It's not something I've given a great deal of thought to I must admit, but it is something that seems obvious enough to me.

 

It seems that a number of universities agree with you - as I recall, my alma mater used to teach Java as a first language, but now uses Racket, a dialect of Lisp.

Share this post


Link to post
Share on other sites


OO because it can encourage boilerplate and over-architected solutions that contribute little to actually solving the problem.

 

YES. I think this may have been what went wrong with me... I struggled with over-engineering solutions and not beginning my code until I had gone over every possibility in my head for a very long time. Think I'm getting better now, but it may have been starting with the OO mindset being so popular that led me to such madness.

 

Has to some better compromise that doesn't get students caught up in extreme OO adherence, but also doesn't lead to spaghetti code and confusion.

 

I feel a lot more confident and interested now that I've decided to drop some of my excessive planning and fear of having to change things down the line.

Share this post


Link to post
Share on other sites


From the perspective of acquiring good habits as early as possible I think both procedural and OO fail.  Procedural because it makes it easier to go hacking and slashing through a codebase without giving real thought to what you're doing, OO because it can encourage boilerplate and over-architected solutions that contribute little to actually solving the problem.

 

I started to reply earlier and then thought better of it because I didn't feel I was being clear enough. I'm glad you've come in and made my point for me so articulately.

 

 

On the topic of functional languages, I'm of a split mind -- on one hand, the concepts they emphasize are those that will continue to hold whatever languages you come to work with in the future and their signal-to-noise ratio (lack of boilerplate) is famously excellent; but on the other hand, the concepts themselves seem hard to grasp for many (perhaps these concepts are things that come easier to a mind yet untainted by baser paradigms) and that functional languages are so high-level in many ways that they make even languages like Java look positively remedial. Lazy evaluation, Abstract Data Types, Continuations, Monads, all the run-time optimizations that the environment can make for you... hard things to really wrap your head around. That said, among programmers who started in other languages and paradigms, those who have taken the time to learn functional programming almost universally praise it as a mind-expanding experience, which is perhaps the highest compliment that can be given to such a thing.

 

I've delved some into a handful of functional languages. I like Haskell best (in general, I prefer the syntax of the ML-lineage rather than the lisp lineage), and Learn You A Haskell for Great Good is a very approachable and well-conceived book to learn from (its also available for free as a website). Scala is also good, and incorporates object-oriented notions as well as running cross-platform on the JVM (which is certainly a better use for it, IMO, than running Java). I suspect Functional languages can be an excellent place to start, but that they also might require a little more structured guidance to get started -- unfortunately I lacked the perspective of a green programmer by the time I began to approach functional languages, so I can't say with certainty either way.

 

Another language I've been keen to look at more deeply soon is Nim (formerly Nimrod) -- which is syntactically similar to python (e.g. indentation is significant, like python and many functional languages), but its a multi-paradigm language that has some really awesome meta-programming capabilities that seem at a glance to be less complicated than in other languages. It also compiles to optimized C code (or C++, or Objective-C) which means you can write Nim code anywhere there's a C compiler, and it has a runtime (it gets built into the C output) that provides a garbage-collected heap when you want to use it (you can ignore it and manage objects explicitly, or use both approaches as appropriate in one program).

Share this post


Link to post
Share on other sites
I think you should learn everything. If you only know how to do one thing, you'll try to use it no matter how inapplicable it might be.

Share this post


Link to post
Share on other sites


Personally, I feel that it doesn't matter. If you start programming procedurally, you will write bad procedural code. If you start programming in an OO fashion, you will write bad OO code (and probably bad procedural code too ). Same with functional.
 
When you start programming, you will suck. Same as when you start anything. and the only way to get better is to practice. 

 

That's an important point -- there's no language in which you're going to write good code in right from the start. In turn, this means your goals matter -- if your goal is to be a reasonably compenent programmer who can whip up scripts and little programs for yourself, that's a different goal than if you want to write operating systems or engines for AAA-games. Even still, either goal is pretty far removed from the absolute beginner, so it might be better to divorce the decision of which language or paradigm is best for early learning, from the decision of which language or paradigm that you want to grow into -- although the choice of the latter might influence the choice of the former.

Share this post


Link to post
Share on other sites


I think you should learn everything. If you only know how to do one thing, you'll try to use it no matter how inapplicable it might be.

QFE.

 

It really doesn't matter what language/paradigm you start with. What matters is that you go on and learn all the rest, once you are comfortable with the first one.

Share this post


Link to post
Share on other sites

If a noob, who knows nothing about computer programming, wishes to embark on the painful journey of developing software, what is the best paradigm to start with and why? Procedural? OO? Functional?
 
 
I've been thinking about this lately because at college Java is the first thing to be taught and I noticed there to be a lot of confusion among the students. Those who have never been close to computer code are having an extremely hard time grasping the concepts. Those who have programmed before are having less of a hard time, but are still utterly confused (try explaining to them what the "this" keyword does, for instance).
 
I personally started out with BASIC when I was 14, and much much later I decided to learn about OO. I think it's a lot easier to learn a procedural language before learning OO.
 
What do you think?

 

I would prefer to avoid the paradigms completely until someone learned the basics. That's one reason I do not like Java or C++ as beginner languages - at the beginning, there's some boilerplate with objects in Java or the iostream in C++ that is distracting to someone who just needs to learn how to write a loop and spit out a greatest common factor or whatever to learn how programming works at a line-by-line level.

 

I guess that means I prefer a procedural education, but I don't think a beginner program should grow to the point where that means anything. Maybe I'm setting my sights low, but I think it's hard enough for people to learn how to put one good function together from scratch: even just deciding what the parameters and return value should be, and gaining the experience necessary to implement even a simple concept cleanly, without extra variables or strange conditional statements. Once someone figures that out, I'd like for them to move into learning algorithms, which in my experience are written in procedural pseudocode. Then, once someone has the ability to program a small piece of something, I'd worry about teaching how to break larger problems into small pieces, which is where the paradigms have meaning.

 

If you're going to suck, at least start with something you can break down, where you can learn from your mistakes.

Share this post


Link to post
Share on other sites

There isn't really any goggles you can put on or paint you can coat coding in to make it easier to deal with, no matter the language people are always going to have to jump over hurdles and make a lot of mistakes to really start to understand a language.

 

Although some languages are more user friendly, i.e. starting with C++ is probably less than desirable, even with C++ you can get the concepts across to people, it will just take longer and be filled with a bit more peril.

Share this post


Link to post
Share on other sites
Best programming paradigm for noobs?

None.  Just concentrate on getting shit done however a mess of your code is.  Seeing result on screen is more important for a noob than worrying about OO, Functional, Procedural, imperative, declarative, logic etc.. paradigms.

Share this post


Link to post
Share on other sites

When you start programming, you will suck. Same as when you start anything. and the only way to get better is to practice. 

 

^  This. 

 

While learning you will make stupid mistakes. Create code that does not run fast, is too complex, too hard to test... the list is endless. But you also have to make those mistakes to learn from them. The key is not to get stuck in your ways, learn new techniques and not be scared to rewrite or refactor bad code. You will also only really learn when your programs gain enough scale and you have lived with them for a while to see duplicated code or the hidden faults. Lots of small toy projects are great to learn the basics but things only really start to fall apart when size comes into play and you need to make changes etc.

 

I would say the order of difficulty is:

Procedural - Learn the basics 

OO - Learn abstraction and working with data shapes

Functional - mess with your mind unless you are used to lambda based maths

 

You really want to aim to lean all the paradigms over time, all will add tools to your toolbox that are invaluable. 

 

The past couple of years I have journeyed into the functional world and it is now my favourite space. I have just started working on a pure functional roguelike in C# without mutable state (I know I should use F# but love resharper lol) .

 

It does requite a very different mindset to all the other paradigms though and many of the concepts are subtle and very complex to grasp for beginners, such as closures, functions as data, using recursion instead of loops and operations such as map and flatmap. Immutable state also add complexity and you really have to plan data structures carefully or you will create huge amounts of work for yourself and performance bottlenecks. 

 

There are languages that can ease you into a functional style, such as Java 8, C#, Scala and F#, as they cross the OO/Functional space and allow both styles to various degrees but unless you are mindful you will quickly fall back on an imperative style, loops and mutability because it feels more comfortable and is available. C# for for example transformed once it gained Linq, lambda and anonymous types and has become more functional with each new version. Too many people think Linq it is just about IEnumerable because that is the only monad supplied out of the box but it is really a monadic comprehension engine if you implement the other monad types or pull in a library.

 

Practice, practice, practice then pause then learn, learn, learn..... repeat :)

Share this post


Link to post
Share on other sites

The ceramics teacher announced on opening day that he was dividing the class into two groups. All those on the left side of the studio, he said, would be graded solely on the quantity of work they produced, all those on the right solely on its quality. His procedure was simple: on the final day of class he would bring in his bathroom scales and weigh the work of the "quantity" group: fifty pound of pots rated an "A", forty pounds a "B", and so on. Those being graded on "quality", however, needed to produce only one pot - albeit a perfect one - to get an "A".

Well, came grading time and a curious fact emerged: the works of highest quality were all produced by the group being graded for quantity. It seems that while the "quantity" group was busily churning out piles of work - and learning from their mistakes - the "quality" group had sat theorizing about perfection, and in the end had little more to show for their efforts than grandiose theories and a pile of dead clay.

 

Art & Fear: Observations On the Perils (and Rewards) of Artmaking Paperback – April 1, 2001

by David Bayles

 

 

Get in there and code.  I've written software in C, C++, Java, Python, Scheme, ML, Javascript, and C#.  Every one of those languages is just different enough to have different good and bad features.  Depending on your problem, you can pick the one you need.  But you can't expect to do that at first.  

 

I assume because you're asking this on Gamedev you want to make games.  So pick a language and an Engine and make some games.  Buy a book, watch videos, read tutorials.  Some options are:

 

Java - LWJGL: http://www.lwjgl.org/

Java - libGDX : libgdx.badlogicgames.com/

C++ - SFML : www.sfml-dev.org/
Python - pyGame : pygame.org/
 
Unity uses variants of C#, Javascript, and Python.
 
Pick something and try it out.  Go make lots of bad pottery!

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement