个人项目——下一个实际的语言/技术学习Personal Project - Next practical language/tech to learn

- 此内容更新于:2014-12-30


I'm working on a personal project doing some finance analysis. It's a totally new field for me, and I'm really having fun with it so far, plus working in the high-level language arena is a great break from my embedded systems daytime work.

I have a MySQL backend on a non-local server with a pile of stock data. My task now is to do some analysis of the stocks and produce something approximating a useful result. There are a couple technical difficulties.

(1) I have a lot of records. To be precise, I believe I'm near 100K records right now, and this number grows by 6.1K each weekday. I need to create a way to rummage through these fields and do data analysis - based on a given computation, go look at this other set. Fine and dandy, nothing too outre. But this means I could really use a straightforward API for talking to MySQL.

(2) Ideally, it runs on OS X 10.4.11. No Windows/Linux machine at home.

(3) I can use PHP, C++, Perl, etc. I even have an R installation. I'm pretty flexible with stuff, so long as it runs on OS X. (Lots of options here, pick water, H20, or dihydrogen monoxide ;-) )

(4)Lack of hassle. While I like clever and fun ways of doing things, I'm trying to get some analysis done, not spend ten hours doing installation work and scratching my head figuring out a theoretical syntax question needed to spout out "hello world".

What's the question?

I'd like to dig into something different than my usual PHP/C++/C toolset. I'm looking for recommendations for languages/technologies that will assist me and meet the above requirements.

In particular, I've heard a lot of buzz about F# and Python on SO. I've used CLISP for small problems before, and kinda liked it. I'm seeking opinions about those in particular.

edit:since I rent the DB server and have a limited amount of CPU time online, I'm trying to do the analysis on a local machine.


The easiest would be Python. it's already installed on mac, and has more than reasonably performance for anything SQL related.

if you liked LISP, there's PLT Scheme for mac; but i don't know how well it interfaces to MySQL. Another interesting LISP is arc, i'm still checking it myself, hope to get it to 'practical' uses.

another not so mainstream option is Lua, which does have a SQL libraries, is by far the fastest scripting language, has a very neat and clean syntax, and stays close to language design principles, almost like Scheme.


(原文:I would also second that Lua would not be a terrible option.)

jonnii的回复:Lua是工厂困境# 39;年代我的名单上的下一个语言学习。

(原文:Lua is fab, it's next on my hit list of languages to learn.)


What about Ruby, Haskell or Erlang?

Paul Nathan的回复:我# 39;对Haskell太糊涂。我看着它一次,也# 39;t站缺乏循环。的好处是什么,具体来说,Ruby,Erlang应用于我的状况吗?

(原文:I'm too loopy for Haskell. I looked into it once and couldn't stand the lack of loops. What, specifically, are the benefits of Ruby & Erlang as applied to my situation?)

jonnii的回复:我爱写在ruby中,变# 39;伟大的语言,为web merb和rails的东西。两个伟大的web框架。

(原文:I love writing in ruby, it's a great language, and for web stuff you have merb and rails. Two great web frameworks.)


How about going with something completely different, free, and interesting? WebObjects, included with Xcode on your Mac. There's an Eclipse plug-in to provide an IDE for WebObjects development, or you can use Xcode/Textmate/etc.

It'll also simplify some of your development tasks, as you mention in your question. From the Wikipedia article: "Given a data model, WebObjects can automatically create a customizable Web application without writing a single line of code."

Paul Nathan的回复:看起来非常重量级的。我# 39;我看着它,它可能是一个非常有用的堆栈的一些知识。

(原文:That looks remarkably heavyweight. I'll look into it, it might be a very useful stack to get some knowledge of.)

Robert S.的回复:它生成纯Java代码,所以不需要运行时,但我猜& # 39;重量级# 39;可能意味着很多东西。:)

(原文:It generates pure Java code, so no runtime is needed, but I guess 'heavyweight' can mean a lot of things. :))


I'd stick with CLISP, frankly. If you don't know it well yet, then learn that. You may end up writing "PHP in Lisp", but that's not so bad, and CLISP has any language feature you can possibly want, being that it's Common Lisp from which all known language features seem to have derived from at some point or another :-).

Play with CLISP, play with your project, learn some macros. You'll have a good time.


I would suggest Python, although in a few months (after some percolation time) F# might be a better choice.

Paul Nathan的回复:你为什么这么说,EBGreen ?

(原文:Why do you say that, EBGreen?)

EBGreen的回复:好吧,我说Python是好的,因为它与大规模数据操作的记录已经证明(见谷歌# 39;使用Python)。它也会让你容易去非常低的水平,容易集成C代码,如果你需要。

(原文:Well, I say Python is good because it has a proven track record with large scale data manipulation (see google's use of python). It would also let you easily go very low level and easily integrate C code if you needed too.)

Paul Nathan的回复:为什么你说f#几个月可能是一个更好的选择吗?

(原文:Why would you say F# might be a better choice in a few months?)


(原文:As for potentially waiting on F#, it is just a matter of waiting for their to be more adopters to just provide examples. Although now that I look at your requirements, the running on a Mac may preclude F#. I don't know where it stands in the Mono environment.)


(原文:F# provides very robust multi-threading abilities, so if your data analysis would lend itself to it, that is where I would see the advantage that F# might give you.)


Many developers in small shops, or that move between startups a lot, end up learning a handful of different types of languages, some are unavoidable (javascript, java, C#), some are fun, some are special purpose and very powerful. i alluded to that here:


You could look at python and ruby with C extensions, scala, clojure, F#, ocaml, haskell, erlang, all the languages that the wide finder submissions are in


如果你考虑Haskell(我不能保证你不会碰到一些理论语法问题),看看这篇文章: 构成合同:金融工程的冒险 http://research.microsoft.com/ simonpj /论文/ papers.html

If you're looking into Haskell (and I can't promise that you won't bump into some "theoretical syntax questions"), check out this paper:

Composing contracts: an adventure in financial engineering


I would recommend to use R for that. It can handle data matrices well (SQL is not suitable for that). I don't have personal experience with it, but I had a colleague who was also dabbling in financial analysis and was very happy with R. But I believe that with other (more general) languages, you would soon run into some library problems, but with R you have everything you need for statistics and large datasets handling. As a next choice, I would use Python, but it's a personal preference and not necessarily better than the others.


Rebol is great for Finance, it's a multi-paradigm (Functional and OOP) language like F# so learning Rebol first could help you tackle F# afterwards.

You can find here a few financial examples:

Derivatives Option Pricer (based on Black & Scholes Formula): http://reboltutorial.com/blog/derivative-options-pricer/

As for data, you can use the free MySQL Driver or even a pure text data file format which can cope with millions of rows: http://reboltutorial.com/blog/mysql/ or http://reboltutorial.com/blog/rebol-sqllinq-like-text-database-engine-blaze-through-millions-of-rows-a-second/

Rebol is also especially great at parsing data see for example parsing google finance csv file http://reboltutorial.com/blog/parse-csv/