notmatt: (Default)
[personal profile] notmatt
A while ago I decided to teach myself C properly rather than the mess I'd picked up on the streets. I got the O'Reilly book and went through that, coding up all the assignments and such. I'm pretty sure my technique's still sloppy and inefficient, but I at least know what's going on now. For example I actually understand how pointers work and why you want to use them, rather than just figuring out how. I now understand a lot of the design decisions that went into Citcom/CitcomS. Even if I don't agree with them, I can at least see a reason behind it and that helps. It's largely thanks to this, that I was able to write my tidal dissipation code as easily as I did, although that would still benefit from a revision to make the grid-spacing and layers easier to work with. The way for me to improve from now on is probably just more practice which I'll be getting anyway.

I've also gotten a lot better about documentation and backups. I'm not using Subversion or anything, since I'm the only one messing with my code, but I've been preserving old versions a lot better now and that's come in useful. And unlike most code I inherit from others, roughly half of what I write is comments, so when I come back to it months later, I can figure out what I did. I prefer long-winded and easy-to-follow than clever one-liners.

Now I need a new project to improve my computing skills. I finished the whole learning C thing some time ago, but I've been so busy with actual research and writing lately that I haven't started anything else. I'd like to have a computing skill to learn in downtimes when I'm waiting for a calculation to run, and don't have a lot else to deal with, or when I want to procrastinate while still doing something useful. Now is a great time for me to start, as there's a bit of a lull at the moment. I just got back from a meeting. I submitted one paper a couple weeks ago. I have a second mostly written; I'm just waiting on some calculations to get the last of the results. I'm thinking of learning one of the following next, but I welcome other suggestions.

1. Python
2. Perl
3. Java
4. HTML / CSS in a way that sucks less than my current stuff
5. Something else?

Date: 2007-08-20 10:35 pm (UTC)
From: [identity profile] mikailborg.livejournal.com
Objective C? I could use more quality software for my platform :)

Date: 2007-08-20 11:55 pm (UTC)
From: [identity profile] mackys.livejournal.com
Any of your top three would be great. I like Java for a nice compromise language when you want to do something OO but don't want to take the full performance hit for an interpreted language. Python goes the other way - better OO but slower. Perl will be nice if you end up writing a lot of shell scripts or doing a lot of text manipulation for some reason.

Date: 2007-08-21 12:26 am (UTC)
jazzfish: Windows error message "Error 255: Too many errors." (Too many errors)
From: [personal profile] jazzfish
The only one of those I've used has been Perl. It's been a lifesaver for just about anything involving manipulating text in any way.

I'm told that Python is like Perl but cleaner. Zarf, who I admire a lot, prefers Python to Perl.

Learning more/better HTML/CSS is always a good plan.

Date: 2007-08-21 02:50 pm (UTC)
From: [identity profile] willow-red.livejournal.com
I learned Perl via the O'Reilly book, and was pretty happy with what it taught me. Of course, it's the only useful programming language I know *cough*FORTRAN*cough*, so I can't judge it versus the others.

As for version control, we started using a simple method at work. At the end of every filename, append today's date and your initials. For example, if today I modified the file FooBar.txt, I would rename it to FooBar20070821_SP.txt. Feel free to borrow this method or not, whatever works best for you.

Date: 2007-08-22 01:13 am (UTC)
From: [identity profile] jameshroberts.livejournal.com
My method now is to backup the entire code (all the source code, header files, Makefile, executable) in a subdirectory marked with the date of the last modification before making any changes. Then I add a line to a readme file in which I track the changes made in each version. Additionally, whenever I run a model now, I tar the version of the code used to run it and copy that into the data directory. The size of the source code is dwarfed by the volume data, so I don't worry too much about wasting space.

Date: 2007-08-21 11:33 pm (UTC)
rbandrews: (Default)
From: [personal profile] rbandrews
Hmm. For the most useful in general, Perl. Perl is ugly and badly-designed but very very useful. Python is a lot like Perl, but more readable.

Date: 2007-08-21 11:34 pm (UTC)
rbandrews: (Default)
From: [personal profile] rbandrews
And how do you do anything in C without pointers? I mean, you had arrays of stuff, right?

Date: 2007-08-22 01:07 am (UTC)
From: [identity profile] jameshroberts.livejournal.com
Oh, I've used pointers before, I just didn't really understand them. I got them to do what I needed, but I never truly got why until I did this.

It's also possible to just do everything with arrays, but that gets tedious and requires you to lock in one size for all possible cases. That's how I used to do things back in the day. I never took a C class. I took C++ from the VT CS department. That's a bad language (for me anyway) and it was badly taught (though I didn't know that at the time). Pointers were not part of the curriculum; we used arrays for everything. Also filestreams. Using 'printf' in that class was punishable by crucifixion.

I'll say that my undergraduate education gave me a sufficient mathematical and scientific background, but was woefully inadequate on the computing end. When I got to grad school, the convection models I was using were written in C, so I picked up the language from there to a sufficient degree to mess with the code; outputting different data, adding new physics, eventually adding completely new modules. And switching to C for any postprocessing routines I wrote. But it was very much learning by example, and looking up actual references as needed. When I started my postdoc and needed to develop new models entirely from scratch, I decided it was time to learn to do this properly.

Date: 2007-08-22 01:31 am (UTC)
rbandrews: (Default)
From: [personal profile] rbandrews
I find I must agree. C++ is a terrible language, and although I'm not sure how I would have done differently, I don't think it was taught very well at VT. Also, you probably took the "C++ for people who we don't care about" course, 2534 or something like that.

Just whatever you do don't bother with Java. It has no redeeming qualities for you: it's complicated where it should be simple, simplified where it needs complexity, verbose, and slow.

I don't know if you already do this or not, but one thing you might do is learn MPI or OpenMP. They are C libraries that let you write parallel programs to run on cluster computers, which lends itself nicely to big complicated physical simulations.

Date: 2007-08-26 06:42 pm (UTC)
From: [identity profile] desfido.livejournal.com
C++ is a language one should probably learn, because when it is needed, one probably has no other choice. One should then promptly learn as many other languages as possible, so that when one has no other choice, one is pretty darn sure that one really doesn't have another choice.

Date: 2007-08-27 05:37 am (UTC)
From: [identity profile] jameshroberts.livejournal.com
I've yet to encounter a situation in which I had no other choice. Other than the C++ class of course.

I've selected Python as my current learning project. It can be integrated with C (or C++ if necessary), and the CIG version of CitcomS (originally C) uses this feature. I've discovered I can get the full text of the O'Reilly book series online through the UCSC library, so that will be helpful.

Profile

notmatt: (Default)
notmatt

September 2010

S M T W T F S
   1234
567891011
12131415161718
19202122232425
2627282930  

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Jul. 22nd, 2025 12:13 am
Powered by Dreamwidth Studios