GSoC'17 Participation - Algorithms teaching examples

edited March 2017 in Summer of Code 2017

Hi there!

I'm Rafael, a second-year Biomedical Engineering student from Instituto Superior Técnico in Lisbon.

Motivation: I, as many more people, am just a self-thought coder that tries to take the most fun out of it! I still remember the first steps I took towards the great adventure that is coding almost eight years ago! A small chat with a cousin woke my interest and on that same day I installed PascalZim and started trying out things. It wasn’t easy at the beginning. But I know for a fact that without all the examples that came with the IDE I would have just surrendered and had never known this amazing world! That’s why I don’t think Examples are less valuable than Tools or Libraries! They're as important! Because of that, I wanted to create some example set as my first GSoC participation. Two years ago I was a participant at IOI'15 so I had to learn a bunch of new efficient algorithms. I spent 2/3 months learning them and I want to share the fun I felt while doing so.

Project idea: After some thought, I came up with the idea of creating a set of Examples explaining, in a fun way, some of the most fundamental and interesting algorithms that exist and that rule the virtual world nowadays, from game development to social networks analysis.

Algorithms such as: Graph related algorithms (BFS, DFS, radius calculus, ...); Sorting algorithms (the main ones); Pattern searching (text patterns, ...); Geometry algorithms (graham scan for convex hull, sweep line for lines intersection, ...); And so on... there are plenty of exciting algorithms to teach!

Extra touch: Besides writing well documented, light and clean examples about very specific algorithms I also had the idea of creating animations as part of the examples. Sometimes people that are new to coding feel demotivated because they can't see the product of what they've been doing. The code is somehow working under a giant black veil. Other times people just need to visualize what's happening to fully understand the concept of the algorithm. Quick example: John is a new adept of coding and after some weeks he's trying to learn how Depth First Search works. After learning the concepts related to the algorithm (graphs, queues, ...) wouldn't it be great to see a graph being traversed? Certainly! I'll apply this concept to every example created!

Please, could someone give me feedback about the idea! How could I improve it? What could I add? Thx in advance :D


P.S.: Hi @shiffman, not sure you're going to read this but since you've been answering to some other people I don't mind taking a chance. Just wanted to thank you for your extraordinary work! I've been using Processing (initially as a complement to Arduino) for probably 2/3 years now. Although only recently I've come to know who "Daniel Shiffman" is (through The Coding Train youtube channel), I've been using stuff that you created to expand my knowledge ever since I started programming on Processing as many of your Examples or your book Code of Nature (this one was really amazing)! Also, your online tutorials are awesome, really! Continue the great work and keep inspiring more people!


  • Hello! Thanks for your nice messages. Examples and documentation are indeed a fundamental to Processing. Two thoughts I have:

    1) Read the GSOC documentation carefully. There are certain "code" requirements to projects and you'll want to make sure that writing examples qualifies for a GSOC project.

    2) I wonder if there might be an opportunity for a library here. I think it would be helpful to consider what applications and projects users could make with the algorithms. Does it make sense to have the algorithms as examples or examples that make use of the algorithms for creative output?

    I go back and forth on this question all the time and am not confident in an answer. But an important question to consider for a proposal I think. Why should Processing users learn the algorithms, what will it enable?

  • edited March 2017

    Hi @shiffman!

    Thanks a lot for the feedback! I was indeed forgetting that maybe an Example would not fit into the GSoC projects' requirements...

    I followed your tip and made a brainstorm of possible ideas for libraries:

    1) I think one of the most important/interesting topics to the Processing Community (from the generic algorithmic list I suggested) could have to do with Geometry Algorithms. There are already some interesting libraries about this topic (Ex: Computational Geometry by Mark Collins & Toru Hasegawa and Geomerative by Ricard Marxer). Any idea about something that has yet not been implemented?

    2) I am currently having classes of Probability and Statistics and I was curious to try out and model some situations that occur in some homework problems. I searched but there's no library regarding such topic. It would be nice to have such a library where we could easily model discrete/continuous random variables such as Bernoulli distribution, Binomial distr., Geometric distr., Uniform distr., Hypergeometric distr., Poisson distr., Gaussian distr. (despite being already implemented as randomGaussian() the function doesn't allow mean and standard deviation to be given as input and although we can externally "set" these values it is better to have a compact way of doing this, aka, defining them as parameters), exponential distribution, among others, all controlled by its specific parameters... Obviously, there are other tools to implement such as distribution mean, variation, the probability with which a value can occur (discrete case), the probability of the variable assuming a range of values, etc. The library would also need a set of examples to explain in detail when and why to apply a certain model to those who are less familiarized with the subject.

    3) I also think there is some lack of support when it comes to mathematical functions. It would be nice to define these functions as strings f=function("2cos(x)+x^3", x) (as implemented by many languages, eg, Matlab) and then be able to perform operations with them: a) Determination of the function's zeros (fixed point method, Newton method, bisection method), b) integration, etc. One other thing that I consider to be very useful is given a set of data points generate its best approximation function (by polynomial interpolation or by the least squares method applied to any set of base functions, not only polynomial).

    I'm just a little lost on where to turn as I don't know the specific needs of Processing's software and community. Is any one of these topics relevant (mainly 2 and 3 as they don't have any library concerning them)?


  • edited March 2017

    The Jasmine library can interpret strings as functions but does not go anyway near to the capabilities of Matlab. Also JavaScript also has the eval() function, although I am not a fan of JS I thought I should mention it.

    Option 2 sounds interesting but I suspect of little use to anyone but mathematicians and statisticians.

    I like the idea of visualising algorithms because what is a sketch but one big algorithm comprising of a hierarchy of smaller algorithms. I could see a visual code tool with dragable 'blocks' for conditional statements, assignment, function calls etc and arrows to show program flow, bit like a flowchart but more feature rich. For instance a conditional block could have comments which are displayed when clicked on. Function blocks could be collapsed/expanded when clicked on. Predefined blocks for settings, size and draw etc. The visualisation might be used for part or the whole of the sketch, so a sketch might have several visualisations each for a different part. Then code generation from the visualisation.

    I could see a distinct benefit for newbies but it could also be a bit of fun.

  • Indeed, those who would use the result of option 2 probably have many other tools anyway.

  • edited March 2017

    Thanks for your suggestion @quark! I think a Scratch (or Blockly)-like tool would be an interesting project!

    What about adding some functionality to Peter Lager's Jasmine library? (find functions' roots, integration in some given range, maximum/minimum in some given range, derivation and others that may occur).

    @Lord_of_the_Galaxy and @quark, about option 2: I think Maths hides many beautiful secrets that change our understanding of the world. Statistics being one of its branches give us powerful tools to model the world around us. Random numbers, Perlin noise and Gaussian distribution (included in Processing) might be very useful but limit the way we think. For example, the time intervals with which new customers arrive at a store is not completely random. It is modeled by a Poisson distribution. This can be applied to many fields: physics (radioactive decay), electronics (components failure), astronomy (meteors seen at a meteor shower), biology (genetic mutations), etc. Many people use Processing to create simulations and to do so Statistical and Probability tools are very useful. Obviously, there are many other tools outside Processing but our goal here is to allow users to have a good set of tools/libraries with which they can be creative in one place only.

    Can I add images to the draft/final proposal?

  • edited March 2017

    The one way by which you can make people like your project is if you provide a proper tutorial for it. Do that, people will like it and use it.

  • edited March 2017

    @Lord_of_the_Galaxy, that is what I plan on doing. ;)

  • Good. Best of luck!

  • I agree that Computational Geometry algorithms is an area of interest to the community. There are some libraries out there that cover some aspects of this, but I haven't done a recent accounting to see what's missing. If you could do this research as part of your proposal that would be helpful. An application that I typically see students struggle with is the workflow from 3D geometry in Processing --> 3D Printing. This could be an area of exploration. See Marius Watz's Modelbuilder as a reference.

Sign In or Register to comment.