Page 2 of 7

Re: Choosing a Programming Language

Posted: Fri Nov 12, 2010 9:41 am
by phrax
The choice is obvious, Go http://golang.org/ :)

If you're primarily focusing on Windows, C# is nice to work with. There is also limited portability using Mono for other platforms. Disclaimer: I have no Mono experience, so I don't know how well this actually works.

It might not be the best choice for this particular project, but I'd be remiss if I didn't at least mention Perl :) It already has decent sgf libraries, and is cross-platform.

Re: Choosing a Programming Language

Posted: Fri Nov 12, 2010 10:03 am
by Harleqin
I use Common Lisp for almost everything I program. If you want to go that route, which I recommend, you should read "Practical Common Lisp" by Peter Seibel.

Re: Choosing a Programming Language

Posted: Fri Nov 12, 2010 10:36 am
by daniel_the_smith
I was going to advocate golang as it is easy to learn, compiled and statically typed, however you are on windows and want a gui, the two things golang does not do well yet. Otherwise I would recommend it. (I did my website backend in go, my website does some similar things to what you're talking about.)

I'll +1 python. C++ is great for what it's great for, and an ambitious first project ain't it. (I can say this, I do C++ for my day job.) Don't write something in C++ because you want it to be fast. Premature optimization is the root of all evil. You don't even know what will be slow until you write it, so write it in something easy to begin with. It's much easier to optimize correct code than it is to correct optimized code and all that.

Re: Choosing a Programming Language

Posted: Fri Nov 12, 2010 12:07 pm
by Bill Spight
Forth language perfect, it is. Programmer excellent, I am.

-- Yoda

:)

Re: Choosing a Programming Language

Posted: Fri Nov 12, 2010 12:08 pm
by Suji
fwiffo wrote:Python isn't web based in the way that PHP or something is. There are web frameworks for it, of course.
Interesting.
nagano wrote:
schilds wrote:What platform are you targeting? I assume it'll have a GUI?

The latter 2 issues you listed (databases, networking) will have similar library support whichever language you choose as long as it's reasonably mainstream. I think platform and tools/libraries are the first things you need to consider.
I am mostly focused on windows, though I would like it to have as wide a compatibility as possible. Of course it will have a GUI! :shock: I'm aware that most languages can support those features, but I read that languages such as Java or Python are slower than C++ and not necessarily as good with data intensive applications. I don't know if its just because many of those applications haven't been coded well, but I've noticed Java applications tend to run slower than most other programs on my computer. I'm talking about very large databases here, think Chessbase (>1 million games). As for the libraries, I don't know enough about the differences to really say. I guess that's one of the areas I could use some help. Question: what was Chessbase written in?
I'd be willing to bet it's written in either C or C++.
nagano wrote:
Suji wrote: Nagano: You might want to consider PHP, too.
I want the program to be accessible offline. Is that possible with PHP?
Not stock, no. So PHP might not be the best choice. If at some point you want it to be web-based, PHP is really the way to go (or perl).

I'm personally not acquainted with Python so I can't vouch either for or against it, but from what I've seen it's pretty friendly. I've also had a bad experience with Java, so I'm biased against it. Java would be fine as a first language and it has it's uses. C++ isn't a bad choice either, but make sure that the tutorials you go through are really, really good. Also, whatever language you do it in, stick with code you understand and don't try anything fancy.

"Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it."
- Brian W. Kernighan

Re: Choosing a Programming Language

Posted: Fri Nov 12, 2010 12:16 pm
by fwiffo
I have an anecdote relating to this subject...

At a previous job, I was involved in maintaining a big inventory management, CRM, order processing thing. It was mostly written in PHP with a web interface, with a PostgreSQL back-end, and also interacted with some legacy AS/400 systems. It was pretty terrible, but typical for the kind of code you see in the wild, written by incompetent programmers for an ossified, disorganized company.

There were certain reports generated by the system that would sometimes take hours to complete. Some very clever programmer in the distant past thought to themselves "Ah, well, this is written in PHP, and everyone knows C is much faster, so I'll rewrite this part in C and bolt it on." Sadly it didn't get any faster at all, and we were all left with some really crappy C code to maintain in addition to everything else.

The problem wasn't the choice of language. The problem was that the programmers didn't understand SQL at all, and SQL joins and subqueries specifically, and didn't know how to design a database schema that makes any kind of sense. Instead of using joins, they issued thousands of queries inside nested loops. It was something like:

Code: Select all

query list of customers
for each customer {
    query list of orders
    for each order {
        query list of parts in order
        for each part {
            query part information
            if order was in the last week and customer is a distributor {
                total_distributor_sales += whatever
            }
        }
    }
}
Once we rewrote it to just issue one query with joins, it took like 100ms to run instead of an hour, with 1/5 the number of lines of code.

Re: Choosing a Programming Language

Posted: Fri Nov 12, 2010 1:08 pm
by nagano
Thanks, everyone. Not sure I've made a decision yet, but you've definitely given me some thing to think about.

Re: Choosing a Programming Language

Posted: Fri Nov 12, 2010 1:12 pm
by daniel_the_smith
fwiffo wrote:I have an anecdote relating to this subject...
I'm surprised that anyone smart enough to figure out how to connect to a database could do that so incredibly badly... have you posted that to daily wtf?

Re: Choosing a Programming Language

Posted: Fri Nov 12, 2010 1:13 pm
by amnal
nagano wrote:Thanks, everyone. Not sure I've made a decision yet, but you've definitely given me some thing to think about.
If you haven't programmed before (which it sounds like you haven't), your time will be better spent downloading a language - any language - and getting going! You simply can't embark properly upon a large project as soon as you set out; even if you manage to focus on it, the early work will almost certainly be terrible and you'll have to rewrite it anyway. The most important thing is to get a general idea of what's going on, then you can choose a language whilst properly understanding why you're making the choice.

FWIW, I recommend getting started with python. If you can't learn how python works and then transfer this knowledge easily to C or whatever, you wouldn't have managed to learn C in the first place anyway.

Re: Choosing a Programming Language

Posted: Fri Nov 12, 2010 1:27 pm
by fwiffo
daniel_the_smith wrote:I'm surprised that anyone smart enough to figure out how to connect to a database could do that so incredibly badly... have you posted that to daily wtf?
I would submit it to daily WTF if I still had a copy of the code.

The biggest problem is that it was something developed over a period of time, by multiple different people, with limited experience in a place with high turnover. It had all the horrors you'd expect in a system without any kind of version control too. A typical chunk of the directory structure might look something like

Code: Select all

potemplate6.php
potemplate6a.php
potemplate7.php
potemplate8.php
potemplate8-delme.php
potemplate8-new.php
potemplate8-version2.php
potemplate8-version2new.php
potemplate8-version2real.php
potemplate8-version2real-2004-02-01.php
potemplate8-version2real-2004-02-01_SPECIAL.php
potemplate8-version2real-2004-04-09XXBUGGEDXX.php
potemplate8-version2real-2004-04-09XXBUGGEDXX-fixed.php
potemplate8-version2real-2004-04-09XXBUGGEDXX-fixed-dontuse.php
potemplate9.php
potemplate9-2001-11-14.php
Other files in use pointed to different versions and it was all just horrible. Not to mention, copious use of the worst two variable names in the world and similar face-palm moments.

Re: Choosing a Programming Language

Posted: Fri Nov 12, 2010 1:36 pm
by daniel_the_smith
Image

Re: Choosing a Programming Language

Posted: Sat Nov 13, 2010 1:30 am
by Harleqin
Suji wrote:If at some point you want it to be web-based, PHP is really the way to go (or Perl).
This seems to be conventional wisdom, but I do not think it is true. Web pages can be generated in any language. For example, I use Common Lisp, Hunchentoot (a webserver in Common Lisp), and CL-WHO (HTML output library).

Re: Choosing a Programming Language

Posted: Sat Nov 13, 2010 10:55 am
by nagano
Harleqin wrote:
Suji wrote:If at some point you want it to be web-based, PHP is really the way to go (or Perl).
This seems to be conventional wisdom, but I do not think it is true. Web pages can be generated in any language. For example, I use Common Lisp, Hunchentoot (a webserver in Common Lisp), and CL-WHO (HTML output library).
What is it about Lisp that you like so much?

Re: Choosing a Programming Language

Posted: Sat Nov 13, 2010 11:41 am
by Li Kao
nagano wrote:
Harleqin wrote:
Suji wrote:If at some point you want it to be web-based, PHP is really the way to go (or Perl).
This seems to be conventional wisdom, but I do not think it is true. Web pages can be generated in any language. For example, I use Common Lisp, Hunchentoot (a webserver in Common Lisp), and CL-WHO (HTML output library).
What is it about Lisp that you like so much?
Lisp is very elegant and has powerful meta-programming features. But I don't think it is the right language for a beginner. I'd start with a more conventional language.

Re: Choosing a Programming Language

Posted: Sat Nov 13, 2010 11:52 am
by Mike Novack
Lots of Irritating Silly Parentheses (sorry, that's a LISP joke)