DaemonForums  

Go Back   DaemonForums > Miscellaneous > Programming

Programming C, bash, Python, Perl, PHP, Java, you name it.

Reply
 
Thread Tools Display Modes
Old 13th February 2012
Carpetsmoker's Avatar
Carpetsmoker Carpetsmoker is offline
Real Name: Martin
Old man from scene 24
 
Join Date: Apr 2008
Location: Eindhoven, Netherlands
Posts: 2,075
Thanked 198 Times in 156 Posts
Default

The "I want to learn how to program, which language do I choose"-question is common. Many programmers-to-be and new programmers think this actually matters a great deal, in my opinion, it doesn't really matter that much.

My advice: Just pick something well supported and start hacking. I always found it very useful to have some project to work towards, for example, I first started programming with BASIC because I wanted to sort a list of games I had on the MSX. I didn't really want to learn BASIC as such, I just wanted to sort the list. I *still* don't really want to learn any computer language as such, I just want to solve my problems. Programming just happens to be the quickest method.

If you don't like the language you chose, try something else. Picking up the second language should be easier because you're already familiar with many concepts. If you do like the language you chose, get better at it, and then try $something_else. You may prefer $something_else, and even if you don't it should at least give you new ideas and insights in your first language.
Rinse, repeat.

Quote:
will learning python be as beneficial to the BSD community as learning C for instance ? isn't C the gateway to porting ? ..
By "porting" you mean the ports collection?

There are many Python ports, there are also many C ports. Personally, I wouldn't care about this, do what *you* like, not what you think may be better for *someone else* Especially as hobby programmer, having fun is very important because it'll keep you motivated to keep going.

Personally, I feel that C is somewhat overrated. It certainly has a place in today's & tomorrow's world, but the reason for much of its current usage is historical, not technical.
Even for experienced programmers, C will take longer to write, and will have more bugs than Python/Ruby/Perl/etc.

I would also recommend you don't start with PHP, for the simple reason that many tutorials and books range from less-than-optimal to really bad. The language also misses some key concept present in almost every other language (most notably like threads or a sane standard library).
__________________
UNIX was not designed to stop you from doing stupid things, because that would also stop you from doing clever things.
Reply With Quote
Old 13th February 2012
ocicat ocicat is offline
Administrator
 
Join Date: Apr 2008
Posts: 2,888
Thanked 190 Times in 160 Posts
Default

Quote:
Originally Posted by daemonfowl View Post
will learning python be as beneficial to the BSD community as learning C for instance ?
It appears that you are fixated on some perceived fame & glory of the end result. This is analogous to saying you really want to be a rock god, but you have never touched a guitar nor have ever tried to sing.

Given that you haven't any programming experience to this point, what you should be determining now is whether you really have an aptitude for the craft. Some do, most don't. So pick a language, read everything you can find, & write as much code as possible. And by all means, learn how to critique your own work so you become better, not perpetuate bad & ineffective practices.

You may also want to look into what courses are available at local colleges and/or universities. While there are professionals who have self-taught, most have taken the traditional route of going through four-year degree programs.
Reply With Quote
Old 13th February 2012
daemonfowl daemonfowl is offline
bsdstudent
 
Join Date: Jan 2012
Location: DaemonLand
Posts: 834
Thanked 0 Times in 0 Posts
Default

Thanks Jgimmi ! Thanks CarpetSmoker ! Thanks helpful companions !
Quote:
This is analogous to saying you really want to be a rock god, but you have never touched a guitar nor have ever tried to sing.
how does Ocicat describe someone who daydreams of becoming a better yngwie malmsteem and starts learning PinkFloyd psychedelic machine ?
Maybe language deceives me here or there but my case applies to million anthropoi who are non-programmers and when they befriended Daemons start thinking of a *most correct way to deserve being part of daemons community .. how so ? with least false steps ..
Quote:
Some do, most don't
a lot of time and effort spent on the wrong prog-lge has been a common complaint .. I believe this is part and parcel of the secretbox why many falls into inertia and say die ..
if I focus on the right thing and advance in it and see it blossoming .. this will be an elan vital for more effort .. effort now seen as fun and +contrib ..
..talking from a purely hobbyist stance ..
Reply With Quote
Old 13th February 2012
daemonfowl daemonfowl is offline
bsdstudent
 
Join Date: Jan 2012
Location: DaemonLand
Posts: 834
Thanked 0 Times in 0 Posts
Default

Reconsidering this statement:
Quote:
It appears that you are fixated on some perceived fame & glory of the end result
it is a simple thing above stereotypy : fun is a process , contribution is , too .. Ocicat is not to blame if he doesn't see BSD as a cult .. I see it as such like I saw gnu* ..
Reply With Quote
Old 14th February 2012
thirdm thirdm is offline
Package Pilot
 
Join Date: May 2009
Posts: 207
Thanked 3 Times in 3 Posts
Default

Quote:
Originally Posted by daemonfowl View Post
a lot of time and effort spent on the wrong prog-lge has been a common complaint .. I believe this is part and parcel of the secretbox why many falls into inertia and say die ..
if I focus on the right thing and advance in it and see it blossoming .. this will be an elan vital for more effort .. effort now seen as fun and +contrib ..
..talking from a purely hobbyist stance ..
It's hard for me to see how any of C, Python, Perl, Ruby, C++, or shell script (was anything else mentioned here?) would set you on a bad path. Shell scripting won't take up a huge amount of your life, most likely, and you can launch into a more general purpose language soon enough after you start accomplishing things with it. Each of the others has large vibrant development communities, all kinds of libraries and is either very general purpose (C and C++) or quite flexible but less laborious to code in (the scripting languages).

Hmmm, are you thinking the problem will be one of motivation or one of learning things without a lot of payoff other than this general fuzzy make you a better programmer idea you've plainly heard somewhere, perhaps from Eric Raymond's writing (personally, I believe there's something to that so I don't sweat my missteps)? Shell or scripting language will help with the motivation if you want quick gratification. If you don't see that as a problem and want the shortest path to some particular kind of programming, there may be better choices. E.g. if you want the shortest path to Unix kernel programming, and are steadfast and driven, the language you want is C (which is not to say you can't write kernels in C++, but, unless you want to count L4 as vaguely unix related, no one you could join in with right now is doing that that I know of -- there's Haiku, but that's not Unix).

OTOH, if you see yourself doing more application level programming, I'd start somewhere else (then again, isn't C still most popular in free software projects even in userland?). Not much objective advice can be given here. People are writing nice (and not so nice) applications in many languages.

Personal preference? There are some general themes where people will sound in with their language preferences. e.g. compile time (static) type checking vs. runtime; languages that provide you with a lot of facilities (e.g. C++, Common Lisp, Perl) and leave it to you to combine them tastefully vs. smaller tidier languages (C, Scheme, Python). It was probably pointless for me to even bring this up, though. There's no honest way to find your preferences other than through experience. It's too early to pick based on any of these themes.

Not sure anyone can (or should?) tell you definitively where to start, so you'll need to risk a choice you might regret later (though, I don't see it as that likely) and hope for the best.
Reply With Quote
Old 14th February 2012
drhowarddrfine drhowarddrfine is offline
VPN Cryptographer
 
Join Date: May 2008
Posts: 358
Thanked 9 Times in 8 Posts
Default

Quote:
Originally Posted by thirdm View Post
then again, isn't C still most popular in free software projects even in userland?
Popularity based on questions on StackOverflow vs projects on GitHub.
Reply With Quote
Old 14th February 2012
ocicat ocicat is offline
Administrator
 
Join Date: Apr 2008
Posts: 2,888
Thanked 190 Times in 160 Posts
Default

Quote:
Originally Posted by drhowarddrfine View Post
Popularity based on questions...
Thanks, drhowarddrfine! Something similar had been referenced on Slashdot a few weeks back:

http://www.tiobe.com/index.php/conte...pci/index.html
Reply With Quote
Old 15th February 2012
daemonfowl daemonfowl is offline
bsdstudent
 
Join Date: Jan 2012
Location: DaemonLand
Posts: 834
Thanked 0 Times in 0 Posts
Default

thank you so much Thirdm !
a reply to your q , the more the lge helps me understand , better use- the OS allowing you to contribute, the more it is welcome .. I'll stick to OpenBSD/NetBSD ..
An interesting thought-provoking web page on the subject :
http://c2.com/cgi/wiki?FreshmansFirstLanguage

Last edited by daemonfowl; 19th February 2012 at 01:22 AM.
Reply With Quote
Old 27th March 2012
iostreamer iostreamer is offline
New User
 
Join Date: Mar 2012
Posts: 7
Thanked 0 Times in 0 Posts
Default

I was trained in CS 10 years ago.
I must say at the time I hated C but now that I have so many options I really like the fact that I had the opportunity to learn C first.
Reply With Quote
Old 7th May 2012
WClark2 WClark2 is offline
New User
 
Join Date: May 2012
Posts: 3
Thanked 0 Times in 0 Posts
Default

My first language was perl. And I am glad I picked that because now I can understand C and PHP and even code a little bit in it.

Take on perl.
Reply With Quote
Old 7th May 2012
vermaden's Avatar
vermaden vermaden is offline
Administrator
 
Join Date: Apr 2008
Location: pl_PL.lodz
Posts: 1,052
Thanked 118 Times in 93 Posts
Default

Quote:
What should be my first language?
English.
__________________
religions, worst damnation of mankind
"If 386BSD had been available when I started on Linux, Linux would probably never had happened." Linus Torvalds

Linux is not UNIX! Face it! It is not an insult. It is fact: GNU is a recursive acronym for “GNU's Not UNIX”.
vermaden's: links resources deviantart spreadbsd
Reply With Quote
Old 20th June 2012
liquidshane's Avatar
liquidshane liquidshane is offline
New User
 
Join Date: Jun 2012
Posts: 7
Thanked 0 Times in 0 Posts
Default

I started in bash/sh and still use it to this day. #2cents
Reply With Quote
Old 7th July 2012
daemonfowl daemonfowl is offline
bsdstudent
 
Join Date: Jan 2012
Location: DaemonLand
Posts: 834
Thanked 0 Times in 0 Posts
Default

Quote:
My first language was perl. And I am glad I picked that because now I can understand C and PHP and even code a little bit in it.

Take on perl.
Thanks WClark2 , I'll try !
Are you familiar with psh & zoid ?
Reply With Quote
Old 24th August 2012
LeFrettchen's Avatar
LeFrettchen LeFrettchen is offline
Marveled user
 
Join Date: Aug 2012
Location: Bronvaux, France
Posts: 108
Thanked 0 Times in 0 Posts
Default

Quote:
Originally Posted by vermaden View Post
Quote:
What should be my first language?
English.
Non, le français !
Reply With Quote
Old 24th August 2012
daemonfowl daemonfowl is offline
bsdstudent
 
Join Date: Jan 2012
Location: DaemonLand
Posts: 834
Thanked 0 Times in 0 Posts
Default

..

Last edited by daemonfowl; 21st September 2012 at 11:09 AM. Reason: apologies ..
Reply With Quote
Old 24th August 2012
ocicat ocicat is offline
Administrator
 
Join Date: Apr 2008
Posts: 2,888
Thanked 190 Times in 160 Posts
Default

If you wish to converse in a language other than English, please converse by PM's. As clearly stated in the forum rules, this is an English-only site.
Reply With Quote
Old 20th September 2012
xmorg xmorg is offline
Real Name: Tim Cooper
Fdisk Soldier
 
Join Date: Sep 2010
Location: San Diego
Posts: 56
Thanked 0 Times in 0 Posts
Default

I think a basic understanding of C will take you far.

- a lot of languages share "C-like" syntax, c++, java, C#, etc.
- a lot of fs/oss libraries/frameworks/engines/etc have "C" documentation.
- if you were trying to figure out something in the kernel code, C would be handy.
- you can also dive right in and start creating apps. (and not just command line)
- lots of great ide's also support C, netbeans, emacs, etc to name a few.
- oop is confusing as hell!
Reply With Quote
Old 20th October 2012
KS KS is offline
New User
 
Join Date: Oct 2012
Posts: 2
Thanked 0 Times in 0 Posts
Default

Personally, I think a self-respecting programmer should know C. That's my (maybe a bit old-fashioned) opinion, of course, and today there are many higher-level programmers who don't have experience with it, such as some of my university colleagues who jumped into Java right away (while I stay away from it). C gives you another perspective, it puts you closer to the machine and the OS, especially if you want to write your own executables, patch existing ones or maybe go deeper into the system. (At some point later, some basic understanding of Assembly could be nice, too.)

I don't particularly hold the popular opinion that people should not start with C. It's a tight and concise language, which sometimes makes it cut both ways, and at the beginning you may have some problems with more complex or "cryptic" expressions, situations involving pointers, strings and reading from the stdin, but these will go. You should also know your operators precedence and associativity to avoid much convulsions over more complicated things, even such as: char *(*(*func[5])())(char **);
(don't get scaried, you'd very rarely encounter something like this, if ever).

To me, personally, C and its syntax came more naturally than, say, Pascal, of which I don't remember much - when I was at uni, we started with Pascal, and at the same time I started learning C. Before that, I had some limited experience with BASIC, some 6502 Assembly and DOS batch files. But in terms of seriousness, I consider C to be my first language. Maybe I am a bit biased since I already know it or since I had done _some_ programming in another language before starting with C, but still - I don't hold that popular opinion.
Maybe it's a bit easier to say what to avoid. I'd say: Don't start with BASIC or Pascal; ain't worth it, IMHO.

But since you're a into Unix, maybe start with shell scripting first, it's going to be really rewarding and give you more flexibility in the system - after all, first know your system and how to perform various automated tasks before programming under it. As for myself, before knowing anything about Bourne Shell scripting, those scripts looked like illogical, cluttered and inconsistent garbage compared to C.

Last edited by KS; 20th October 2012 at 11:58 AM.
Reply With Quote
Old 20th October 2012
KS KS is offline
New User
 
Join Date: Oct 2012
Posts: 2
Thanked 0 Times in 0 Posts
Default

Oh, of course, the programming language isn't the most important thing, as some have already mentioned. You should be interested in solving various problems and doing creative work with the machine in the first place, which will lead you to programming. Also, as soon as you get into a programming language, pay attention to data structures and algorithms, and how they relate to your language of choice. There are various very good resources (books) on that subject, too.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
TIOBE language index: Python is the programming language of 2010 J65nko News 5 12th January 2011 05:33 PM
Why I can't select language from gdm? fender0107401 OpenBSD General 6 11th May 2010 11:09 PM
C language inventor spurns Google's language exam J65nko News 4 22nd April 2010 09:07 AM
Best Web Application Language JMJ_coder Programming 24 25th November 2008 12:25 PM
The language here scottro Feedback and Suggestions 11 19th May 2008 11:54 PM


All times are GMT. The time now is 05:20 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content copyright © 2007-2010, the authors
Daemon image copyright ©1988, Marshall Kirk McKusick