
Scipy - the embarrassing way to code - dood
http://www.vetta.org/2008/05/scipy-the-embarrassing-way-to-code/
======
ivankirigin
I've done lots of Matlab development, and this is too true.

Python is going to replace Matlab, but the pattern in the same.

People aren't really used to thinking about matrices and vectors as primitive
types and operations.

By the way, this is an excellent resource for learning Matlab.
<http://www.andrew.cmu.edu/course/16-720/handouts.html>

Look at the "working with images" section. If you manually touch every pixel
in an image, you're doing something wrong. You code will be 5X as long, and
100X as slow.

------
scott_s
_The bottleneck in writing code isn’t in the writing of the code, it’s in
understanding and conceptualising what needs to be done._

Good observation, succinctly stated. Most of my days are spent trying to
figure out what I need to do, not how to do it.

~~~
noahlt
Exception: interfacing with 3rd-party libraries.

------
brent
This is exactly why I have urged people to learn Matlab (on this forum and
others). Specifically, I'm sick of seeing hundreds of lines of code written in
Java that are essentially a poor (slow) implementation of a one liner in
Matlab that uses a 20 year old fortran library. I have to go back all of 8
days to find the following quote in response to my plea:

"...and I question the usefulness of learning MATLAB unless you actually need
it."

The problem is, most people don't realize they need it and just plod along
writing hundreds of lines of python, perl, ruby, java, etc. implementing a
decade old numerical computation.

~~~
ejs
When you write a lot of matlab it becomes a different way of thinking. Instead
of the for loops multiple levels deep you can write it all as operations to
multi-dimensional matrices.

I would agree that many problems people spend time on can be found as single
commands in matlab.

------
gruseom
The comments here on Matlab have me intrigued. I'm ignorant and have a few
newb questions. How does it compare to the APL family of vector languages
(J/K/Q)? How does it compare to Mathematica? What roughly are the licensing
terms for commercial use (i.e. if you want to build a product with it)?

~~~
randomhack
I would suggest looking into NumPy/SciPy instead of Matlab. Matlab has a very
good library for numerical computation but in my experience, Matlab is
absolutely terrible as a language for anything except matrix stuff.

NumPy gives you a good matrix syntax while building on an excellent general
purpose language. Personally I felt NumPy is a lot cleaner and Python a lot
more fun than Matlab though Matlab has many many "toolboxes"/libraries not in
NumPy.

~~~
carterschonwald
I second this sentiment. The difference in natural expressiveness is almost
painful

------
carterschonwald
I think the deeper idea to take away from this is that knowing more theory is
always a good thing

~~~
brent
What does this have to do with theory?

~~~
carterschonwald
if you don't know any of the theory behind a problem, you don't even
necessarily know if theres a solution thats useful in practice.

A good example in Computer Science is the various reductions (efficient or not
)between different problems, where you relate the difficulty of the problem to
any other computational problem which you find you're able to encode within
the structure of the orginal problem.

------
ola
The article seems to have two messages: one that it's better to fully
comprehend the problem before you start coding; the other that learning a
powerful library will save you pages of code. Both well rehearsed truths of
computer programming.

As for myself I often find that I have to fully explore the problem on my own
terms before I can maturely optimize my source.

~~~
mhartl
_it's better to fully comprehend the problem before you start coding_

Often the best way to understand a problem is to try to implement a solution.

~~~
ola
That's a very true observation mhartl and I try to touch on it in my last
sentence although it is enigmatically worded as I was trying to sneak a
"Premature optimization is the root of all evil" reference into it. Alas not
all wordplay is destined for upmods!

------
tokipin
give J (an APL descendant) a try, it has some good tutorial thingies that
appear right in the console thingie:

<http://www.jsoftware.com/stable.htm>

and here's a post about it:

<http://www.squidoo.com/jprogramming>

~~~
plinkplonk
> give J (an APL descendant) a try,

J is not open source. Might be a factor to consider.

From the J site,

"Jsoftware licenses source for all the Jsoftware binaries. There are several
factors in determining the cost of source licenses. Primary is the source
itself: J Engine (portable C); Windows GUI support (C++); and Unix GUI support
(Java). Secondary is the scope of use: internal; distributed products; and
competitive (to Jsoftware) products. And finally the platforms: Windows; Unix;
PocketPC; etc. The price range is from $10,000 to $400,000. Regular updates to
our current source levels are available for separate update fees."

------
JulianMorrison
I can't believe nobody has mentioned Sage Math (<http://www.sagemath.org/>).

It's sort of a set union of every good free math program.

------
bsaunder
I've noticed a similar conceptual pattern while investigating meta-
programming. I think there's something fundamental going on here. Something
that conventional programming constantly misses. Something remarkably simple,
consistent and powerful. It's where code is data along a continuous path of
transformations.

~~~
ambition
Read Godel Escher Bach. Given the comment above, you'll like it.

------
rapind
Great article. Learn the hard way and it'll stick. Plus it's fun.

------
edw519
This is a familiar story, regardless of technology.

The more you work, the less you appear to have.

The efficiency paradox.

~~~
bridgetroll
"Perfection is achieved, not when there is nothing more to add, but when there
is nothing left to take away." -Antoine de Saint Exupéry

~~~
edw519
Bulletin board material.

~~~
bridgetroll
I have it posted at my desk in a nameplate frame. I try to adhere to it. I
often fail.

