Algorithms/problems to solve while learning a new language [closed] - algorithm

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
At some point in our lives we're put in the situation to learn a new language (either by job requirements or just passion). Personally, I'm trying to learn Objective-C coming from a background of several years coding php. My problem is that I'm bored with your average starting programs (most of them coming from maths; eg: Fibonacci).
What are your first algorithms and programs you write when learning a new language?
I'm thinking we could make a list of interesting problems to be solved and that would make the learning curve at least more entertaining.
Later edit:
My question is about fun things (and also useful), but not like Code Kata or other very boring math stuff (I've done many of those already)
Later edit [ 2 ]:
I found this today and the problems there seem fun to do.

Try to develop something proper, a project of some kind; solving algorithmic problems really only teaches you to apply the algorithm, not really a lot about the language your using.
Deciding on a useful project then deciding on a language and then 'doing it' will cover many of the bases you need to learn a new language.

I like this series of articles by Larry O'Brien.
http://www.knowing.net/index.php/2006/06/16/15-exercises-to-know-a-programming-language-part-1/
http://www.knowing.net/index.php/2006/06/16/15-exercises-to-know-a-programming-language-part-2-data-structures/
http://www.knowing.net/index.php/2006/06/16/15-exercises-to-know-a-programming-language-part-3-libraries-frameworks-and-mashups/

Have a look at these:
How do you find interesting problems to solve?
https://stackoverflow.com/questions/6327/what-are-your-programming-exercises

Just as an idea: Look at the problems of the The Computer Language Benchmarks Game.
When you've done a snippet, you can compare your solutution to the provided one.

Whenever I pick up a new language, I try using it to solve the problems at SPOJ. They basically support every mainstream language out there (as well as a few esolangs like Intercal and Whitespace). The problems are mostly from various ACM and similar format contests around the world and so can be quite hard, and perhaps be too CS/math for everyone's tastes. The tutorial problems are quite doable in any language.
I would also recommend adding that language's tag to your SO interested tags list. Many SO questions involve small snippets of code, and trying to answer them and looking at the other answers can be very enlightening.
But as soon as I've got the basics right, the strategy I choose is to try my hand at a very small project. Usually this a simple game, GUI app or a tiny webapp. This is valuable since there are some things you cannot learn by only doing small isolated blobs of code.

Try to solve these challenges using your new language. What's it all about:
In software we do our practicing on
the job, and that’s why we make
mistakes on the job. We need to find
ways of splitting the practice from
the profession. We need practice
sessions...

I sometimes use the exercises from the first few chapters of Structure and Interpretation of Computer Programs.

You can also try to understand or improve existing open source projects as suggested in this so question. Even though the answers are cocoa biased it should be a good starting point.
This way you can dive in to the level of your choice (understand, debug, improve) and in direction of your interest (UI, specific library, etc, etc...).
EDIT: When I said starting point, I meant that you can browse repositories for objective-c code, for example sourceforge

Related

What are some good beginner tutorial websites and resources for learning the three.js library? [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 9 years ago.
I'm not a beginner per se to programming (like C++ or Java) but I am a beginner to JavaScript and three.js. I want to learn three.js for a project I want to work on but I have no idea where to begin. I tried just diving into the source code on github but a lot of it can be confusing at times especially for someone new to JavaScript. I was wondering if there are any tutorials, videos, books, websites, etc... that go over the basics of three.js library?
When you download Three.js they have an awful lot of examples. Why not use those? There are almost 200 of them.
Regarding looking at the source code, I know how you feel, javascript is quirky and there are no really well-established ways of doing something as simple as inheritance. However, I have to say that Three.js is very, very well written and easy to understand, if there's any time to see how javascript gurus write good javascript, Three.js is it. It's very well laid out, not too much indirection, objects are well abstracted, the hierarchies make good sense and methods do what they sound like they do, not too much, not too little.
I suggest start by splitting up your project, adapting the closest example that does what that part of your project will do. By the time you've done 3 or 4 aspects, you'll have a great feel for it and can build up your project by looking for an example that resembles each problem you face.
However, 3D programming is not simple. So you're going to be on a doubly steep learning curve. The problem I've found with 3D programming in Three.js (as with other 3D javascript libraries), as opposed to regular javascript programming, is there's very little feedback regarding errors. So it's very hard to know what's going wrong. You'll need to get used to debugging javascript. If your progress is like mine, you'll end up having to refine individual problems into small demonstrable snippets which you can ask for help on stack exchange. Isolate the problem and paste it into a jsfiddle. The most common bugs result from subtle properties that need to be configured, for example, if you draw a circle, you'd expect it to display no matter which side is being viewed, but that is not the case! However a quick question on stack overflow in those situations will help.
try googling and i believe you will find many :)
try this http://www.aerotwist.com/tutorials/getting-started-with-three-js/
There are some excellent beginner tutorials on YouTube: Three.js - YouTube
A guy named Nikita Severinov made some really nice introduction series, but they are unfortunately only in Russian:
WebGL Three.js - Solar System Tutorial Series
Hope that helps at least a tiny bit.

Are there any "fun" ways to learn about Languages, Grammars, Parsing and Compilers? [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 9 years ago.
I'm preparing for an exam concerning languages, grammars, parsing and compilers. It's not really my cup of tea and most resources I find use the language of mathematics to define the different terms of the trade and explain the different concepts I need to know rather than stick with English or French, which I would very much prefer. Therefore, I'm having some trouble both with finding the motivation to continue studying and with simply understanding the theory.
So here is my question: Do any of you know where I could find a "fun" way of learning all this? Or at the very least, maybe a more "concrete" and less "mathematical" way of handling this subject.
I need to cover the following so anything on these subjects is welcome!
Parsing (LR, LL, ...)
Grammars (Context-free, deterministic, ...)
Syntax analysis Static flow analysis
Impact analysis concerning software maintenance and dependency to user interfaces
Dynamic analysis
Here are some resources which could be considered "fun" (with an emphasis on the quotation marks) ways to learn about a technical subject, just to get a sense of what I'm looking for.
Why's Poignant Guide to Ruby
Try MongoDB (type Help +
Enter)
If you want to learn a lot in a short time, go learn about meta compilers from Val Schorre's 1964 (yes, you read it right) Meta II paper on how to build self-compiling metacompilers. As a freebie, they can compile conventional lanuages, too! The paper is 10 pages, describes meta compilers (as a virtual machine beleive it or not), and contains two complete compilers.
There's a mind-blowing moment you eventually arrive at when you grok how the compiler can compile itself... I learned compilers this way back in the early 70s and it is the most memorable compiler lesson I ever had. This is fun.
There is an online tutorial here which implements all the ideas in JavaScript..
The author of the tutorial is Dr. James Neighbors, the guy who invented the term "domain analysis". He used the MetaII ideas for a spectacular domain-specific code generator named Draco. Draco was a key inspiration to compiler-like tools I've been building for the last 30 years.
How long do you have to prepare? The "best" way to learn compilers is to dig into them and the best way to do that is to use the best book on compilers EVER WRITTEN: The Dragon Book It's old, but awesome. It's not cheap but it is, quite possibly, the most concrete and least mathematical way to learn about the magical compiler.
It doesn't have any flashing lights and it won't be in an awesome font like the Ruby guide, but it's in the top 10 Books Every Programmer Should Read

Good newbie instructions for creating minimal complete bug examples? [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 9 years ago.
So, those of us who've been answering questions and dealing with bug reports for a while are all deeply familiar with the concept of a "complete, minimal example". You start with a gnarly huge pile of code that's got a weird error, and you want to ask someone about it. But you don't want to send them the whole mess, so you start cutting the pile of code down into smaller pieces, until you get this little crystalized 20-line gem that still has the same bug you started with.
(And then, at least half the time, you realize what the bug is because it's staring you in the face like a luna moth, and you don't have to ask after all. But that's a side effect.)
Doing that sort of code-reduction isn't a skill that everyone has -- it takes a bit of practice, beyond the fact that a lot of newbies haven't yet learned that they ought to do it in the first place. There are several excellent sets of instructions for newbies on how to ask good questions (e.g., ESR's classic "How To Ask Questions The Smart Way"). Are there good instructions out there that explain what exactly a minimal complete example is, and how and why to create them?
It's all in the name. A complete minimal example is an example that is complete and minimal. Complete means that it contains all pertinent information, and minimal means it contains no information that is not pertinent. The ability to identify what is an is not relevant is something that only comes with practice - trying to provide instructions for this seems a little like trying to provide instructions on riding a bicycle. You can give the technical explanation and describe the mechanics (and the TeX FAQ you linked to does that very well) but in the end the only way to really learn is by doing.
I'll start this off with the ones I'm familiar with; these both come out of the TeX community, and so are a little oblique for programming. I'm hoping other people have better answers.
The TeX FAQ has an entry on How to make a “minimum example”.
That page points to a somewhat longer article on "What is a minimal working example?". Again, this is for TeX documents; the ideas are the same, but the tools and details a little different.
Edit (2013/01): Another one that I noticed in a StackOverflow comment: The "Short, Self Contained, Correct (Compilable), Example" page. Not perfect, and it suggests 20kb (!) as an upper limit, but a good addition to the list.
Edit (2013/02): Jon Skeet has a blog post about writing good questions, which includes a section on sample code that seems useful.

How can I get better at/learn more about Ruby? [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 9 years ago.
I have recently started learning Ruby, as my first programming language. I feel comfortable with the syntax, and I've done numerous tutorials that just teach the same basics. I have written a few small programs (including my own method for sorting an array that I thought was pretty smart until someone told me to Google 'Bubble Sort'), but I feel I need to attempt something bigger and harder to understand more about Ruby. Any ideas as to how I can do this?
Ruby Resources
http://www.rubyist.net/~slagell/ruby/
http://web.njit.edu/all_topics/Prog_Lang_Docs/html/ruby/syntax.html
http://www.ruby-doc.org/core-1.8.7/index.html
http://en.wikipedia.org/wiki/Ruby_(programming_language)
http://pleac.sourceforge.net/pleac_ruby.html
http://www.zenspider.com/Languages/Ruby/QuickRef.html
http://www.ruby-doc.org/docs/ProgrammingRuby/
The "advanced" Ruby book is The Ruby Way by Hal Fulton. It wouldn't hurt to read some real Ruby code - most gem's will do for this.
Finally, you need a project. You could take a program you have already written and redo it in Ruby, or you could think of something new to write.
Rubylearning Blog is hosting a fortnightly contest. The first contest went live - http://rubylearning.com/blog/2009/09/24/rpcfn-shift-subtitle-1/
That should be a start :)
A few years back I worked through Dave Thomas' Code Kata as part of a similar exercise. Fairly simple, self-contained pieces that let me explore the language at my own speed.
The kata idea seems to be moderately popular with developers, particularly at the Agile end - Googling "code kata" with and without "ruby" ought to throw up some more ideas.
fellow newbie. :) I too have just recently started learning ruby.
Right now, I'm reading The Ruby Way. Although I'm not required to code at work, I try to find practical applications of ruby -- no matter how mundane. For instance, I prepared scripts when I needed to test something that required several files with 0 file size and when i needed to generate an xml file based on another xml file; and since there was a tennis meet at work, i tried to create a script for random pairing or grouping. (Little baby steps, i know)
My colleague has written a post listing out the resources that a Ruby newbie would find useful. It was primarily intended for members of our local Ruby User Group, but it should be useful to you too.
More importantly, a lot has changed in the last couple of years and this post is pretty up-to-date (as of September 2012).
Here's the link: http://www.jasimabasheer.com/posts/meta_introduction_to_ruby.html

What's the best way to learn more advanced Ruby OOP constructs? [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
So I've become a reasonably proficient Rails developer, and I'm finding that my bottleneck is now my lack of understanding of more complex Ruby constructs. I'm trying to build some plugins, and looking at some complex ones out there, their OOP wizardry is Greek to me. (I never had much formal OOP training so that's part of the problem.)
I want to better understand:
Sending methods from one place to another (include, extend, etc...)
Metaprogramming & overriding methods (super)
Class inheritance, modules, etc
Serious Ruby tomes seem like too much. Is there a pragmatic way to learn this stuff that will extend my powers without overwhelming me in the inner workings of the language?
The best way is to use it and learn by looking at code from others.
I don't think that there's a better place to start than the official documentation page.
Sorry if I've disappointed you, but there's no easy way to learn all those constructs.
You can also take a loot at some books, for example, the Pickaxe:
http://whytheluckystiff.net/ruby/pickaxe/
Take a special look at the OOP and metaprogramming sections.
I've found the ruby quiz to be a terrific resource to sharpen your knowledge of ruby. You can buy the book version or just use the entries at the site. Different problems will lend themselves to using different parts of the language.
I found these screencasts by Dave Thomas to be great for that, besides, it has pragmatic in the title so you can't miss :D
This Peepcode plugin patterns pdf actually answered all my questions; what I was trying to do was write a plug-in so it was exactly the information I needed.
the best way to start is understanding how class hirarchies really work internally so you know what gets call when. in otherwords you need to understand metaclasses.
here are the two resources that helped me the most to understand the concept: why´s explenation and another one
you could also try these ruby plus screencasts. there are alot about other topics you seem to be intrested in
You can also try and learn the basics of another langauge (Java or C# for instance).
I think learning a new language can be a very efficient and fun way to familiarize yourself with different approaches to solving problem (in your case object-oriented programming concepts).
Once you know how to code, learning the basics of a new language is both relatively easy and extremely entertaining, so you tend to make progress extremely fast at the beginning
And when you're trying to grasp concepts that are new to you, it might be easier to understand them in a framework that's also new. That way you can focus on the concepts you're trying to learn, and not on the way you could solve this problem differently in your language, etc...

Resources