Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

C vs. Java

Name: Anonymous 2008-01-08 15:09

A couple of days ago, I had a conversation with one of my dad's friends that I know who, like my dad, is an Electrical Engineer (E11 for those of you who know what that means).

We were talking about programming and Linux, since I've been trying to figure out what I should learn so I can know everything that I'd ever need to use when operating Linux (i.e. bash scripting, sockets, autoconf, etc). I'm still trying to figure out what I need to learn and what I don't. We were also talking about what languages were important to know.

What surprised me was, even though he's a double E, writing in C for a lot of his coding work, he believe Java is actually better for teaching in colleges and the like than C is.

I have posted before that I believe I have been lucky to be learning C as my core curriculum at my college instead of the other Java schools, so when he said that i was stunned to say the least. He believes that Java is better because C is outdated, and many of the concepts in it aren't really necessary these days. Pointers and memory are difficult to deal with, mostly due to having to learn how to not mess them up rather than how to use them. But it could also be said that they aren't used as often these days, considering the languages more commonly used and the power and speed of hardware these days. Also, C isn't used as often these days, and most jobs will probably be using other languages (he, like I, also loves Python). I plan on becoming a DBA, for instance, so it is unlikely I will need C (feel free to try and convince me out of going in that direction, though many may try anyways, I doubt it's possible considering the security, pay, and overall lack of stress involved in the job [despite the copious amounts of blandness I've come to accept, considering the rest of the job market these days]).

Personally, I have learned both (Java first for 2 years in HS, got a 5 on the AP exam, and now have been learning C in uni), and somehow I can't agree with him, and side more with C. First, I find it fascinating (the whole theory behind pointers and memory usage and the like seems really interesting to me, at least thusfar), and because of learning C now I understand a lot of concepts that I was left clueless about learning Java for 2 years (such as, I never understood wtf the purpose of LinkedLists were in Java, or why we used them over ArrayLists). Just a single semester cleared a lot of things up for me, and I also believe the coding being more difficult forces me to become a better programmer, generating more competent code before I even write it down and compile it. If this is true, it will help me code in whatever other languages I learn in the future. I'm mostly trying to get a good base for Computer Science, but is it worth the difficulty of what many may consider a "legacy" language? Am I wasting my time on something I may never use?

I know how much you guys tend to love C, so I was wondering what arguments you might give in response to something like this.

Name: Anonymous 2008-01-11 20:15

this topic sure as hell got off topic...

Name: Anonymous 2008-01-11 20:28

hi every1 im newb!!!!!!! *holds up keyboard* my name is harold but u can call me t3h AnTiCdR oF d00m!!!!!!!! lol...as u can see im very expert!!!! thats why i came here, 2 meet /prog/ ppl like me ^_^... im 13 years old (im mature 4 my age tho!!) i like 2 read sicp w/ my bff sussman (im bi if u dont like it deal w/it) its our favorite beginners' book!!! bcuz its SOOOO expert!!!! hes /prog/ 2 of course but i want 2 meet more /prog/ ppl =) like they say the more the merrier!!!! lol...neways i hope 2 make alot of freinds here so give me lots of commentses!!!!

(define (fact n)
    (if (= n 0)
        1
        (* n (fact (- n 1)))))
<--- me bein expert again ^_^ hehe...toodles!!!!!

love and cudders,

Name: Anonymous 2008-01-11 21:00

>>42
slow fact is slow

Name: Anonymous 2008-01-11 21:12

>>43
Scheme interpreters are required to deal with tail-end recursion iteratively. It's almost the fastest fact you can write without relying on prime factorisation, which is slower for small n anyway.

Name: Anonymous 2008-01-11 21:37

>>44
facepalm

Name: Anonymous 2008-01-12 1:44

>>44
That code is not tail call. That is a recursive process, not an iterative process.

One word: [b]read SICP[b].

Name: Anonymous 2008-01-12 2:44

>>44
>>42's fact is not tail recursive.
here's a much better one in perl6:
sub fact(Int $num) returns Int {
 return [*] 2 .. $num;
}

Name: Anonymous 2008-01-12 10:31

not looking forward to typing "returns" on my subs. Someone get Larry Wall to shorten it to ret or similare.

Name: Anonymous 2008-01-12 10:32

Shorten it to \\!

Name: Anonymous 2008-01-12 10:56

Shorten it to ‽

Name: Anonymous 2008-01-12 11:44

Shorten it to ⏎

Name: Anonymous 2008-01-12 12:13

Shorten it.

Name: Anonymous 2008-01-12 12:24

Shorten it to the null string, and add the keyword `dontreturn' to negate it.

Name: Anonymous 2008-01-12 12:45

>>53
Man that's deep.

Name: Anonymous 2008-01-12 14:44

>>48
it can also be written any of these ways:
sub fact(Int $num) as Int {
sub fact(Int $num) of Int {
our Int sub fact(Int $num) {

Name: Anonymous 2008-01-15 6:56

>>5
you [s][code]can[/s] if you areEXPERT enough[/code]

Name: Anonymous 2008-01-15 6:57

>>5
you[can if you areEXPERT enough[/code]

Name: Anonymous 2008-01-15 7:00

>>5
you
can
if
you
are
EXPERT enough

Name: Anonymous 2008-01-15 7:01

>>5
you
can
if
you
are
EXPERT enough

Name: Anonymous 2008-01-15 7:04

>>5
you
can
if
you
are
EXPERT enough

Name: Anonymous 2008-01-15 7:05

>>5
you can if you are EXPERT enough

Name: Anonymous 2009-03-18 3:21

Don't call me gay, but I need some mary jay!

Marijuana MUST be legalized.

Name: Anonymous 2010-12-20 21:11

Name: Anonymous 2011-02-04 19:51


Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List