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

Pages: 1-4041-

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-08 15:12

Enjoy your ENTERPRISE.

Name: Anonymous 2008-01-08 15:17

>>1
He's right. You should concentrate on more high-level languages and study algorithms etc., rather than concentrating on the low-level shit that C makes you do. I mean, it's fun and all, but less useful.

Name: Anonymous 2008-01-08 15:44

Java: useless enterprise object obsessed language made so code monkeys can produce worthless shit that needs a >100MB VM to run slowly.
C: structured portable assembly with a nicer syntax, that trusts the programmer and allows him (her?) to use the full potential of the computer.

You should learn many programming paradigms and languages so you can choose the right method and language for each task. This language will never be Python or Java.

>>3
because of learning C now I understand a lot of concepts that I was left clueless about

Name: Anonymous 2008-01-08 15:51

C is importand to know, but colleges should use scheme to teach computer science concepts. or haskell.

Name: Anonymous 2008-01-08 16:01

>>4
Java: useless enterprise object obsessed language
You forgot ``toy''
Also, Java isn't object oriented

Name: Anonymous 2008-01-08 16:27

>>1
Sounds like he believes college should just be some half-assed voc-ed program. You can't be a good programmer if you've spent nearly all your time learning Java. There's no possible way you can understand the machine or the cost of anything when it's abstracted away under twenty layers of ENTERPRISE OBJECT ORIENTED ABSTRACT CLASS FACTORY PATTERN ARCHITECTURE. And understanding the machine is half of being a good programmer.

The other half of being a good programmer, how to structure programs, would be stupid to teach in C. But it would be pretty dumb to teach it in Java too, unless you just want to teach your students how write object obsessed programs in Java's brand of perverted OO. Use Common Lisp or something.

If I were running a CS program, I'd start students in C both and CL right from the start. Instead of "Intro to Computer Programming", we'd have "Intro to Low-level Programming" and "Intro to High Level Programming". And we wouldn't do that "Here's how to do math, here's how to make a variable, now write a program" bullshit. We'd teach students how to put together a few instructions to solve simple problems (five lines or so), then we'd move on to problems twice that size, and then we'd move to problems that involved defining new functions.

Name: Anonymous 2008-01-08 16:48

GO BACK TO SLASHDOT GARFIELD

Name: Anonymous 2008-01-08 18:06

>>7
The thing is, if you are taught to solve problems using a low-level language like C, you think of problems in terms of the machine architecture. This is not a good thing. You should learn to solve the problem abstractly first, and develop an appreciation for optimisation afterwards.

Name: Anonymous 2008-01-08 18:06

>>9
Indeed, see Project Euler for many comparisons between the two approaches.

Name: Anonymous 2008-01-08 18:19

>>9
That's why we'd teach C and CL at the same time.

Name: Anonymous 2008-01-08 18:20

>>11
Ah, sorry, I misread your post. All agreed then.

Name: Anonymous 2008-01-08 18:22

>>6
It's not properly OO, but it's definitely object-obsessed.

It's like the original designer decided to make a language that was all OO, all the time, and wanted to force a single style of programming on the people who used it, and he didn't let the fact that he'd never actually used an OO language before stop him.

Name: Anonymous 2008-01-08 18:27

>>11
At the same time?

Name: Anonymous 2008-01-08 18:33

University student here. Enrolled in a SepplesBeans 2.0 EnterpriseBeta school. Was in CS, but jumped the boat to math because JAVA SUCKS FOR EDUCATION JAVA SUCKS FOR EDUCATION JAVA SUCKS FOR EDUCATION JAVA SUCKS FOR EDUCATION JAVA SUCKS FOR EDUCATION JAVA SUCKS FOR EDUCATION JAVA SUCKS FOR EDUCATION JAVA SUCKS FOR EDUCATION JAVA SUCKS FOR EDUCATION JAVA SUCKS FOR EDUCATION JAVA SUCKS FOR EDUCATION JAVA SUCKS FOR EDUCATION JAVA SUCKS FOR EDUCATION JAVA SUCKS FOR EDUCATION JAVA SUCKS FOR EDUCATION JAVA SUCKS FOR EDUCATION JAVA SUCKS FOR EDUCATION JAVA SUCKS FOR EDUCATION JAVA SUCKS FOR EDUCATION JAVA SUCKS FOR EDUCATION JAVA SUCKS FOR EDUCATION JAVA SUCKS FOR EDUCATION JAVA SUCKS FOR EDUCATION JAVA SUCKS FOR EDUCATION JAVA SUCKS FOR EDUCATION JAVA SUCKS FOR EDUCATION JAVA SUCKS FOR EDUCATION JAVA SUCKS FOR EDUCATION JAVA SUCKS FOR EDUCATION JAVA SUCKS FOR EDUCATION JAVA SUCKS FOR EDUCATION JAVA SUCKS FOR EDUCATION JAVA SUCKS FOR EDUCATION JAVA SUCKS FOR EDUCATION JAVA SUCKS FOR EDUCATION JAVA SUCKS FOR EDUCATION JAVA SUCKS FOR EDUCATION JAVA SUCKS FOR EDUCATION JAVA SUCKS FOR EDUCATION JAVA SUCKS FOR EDUCATION JAVA SUCKS FOR EDUCATION JAVA SUCKS FOR EDUCATION JAVA SUCKS FOR EDUCATION JAVA SUCKS FOR EDUCATION JAVA SUCKS FOR EDUCATION JAVA SUCKS FOR EDUCATION JAVA SUCKS FOR EDUCATION JAVA SUCKS FOR EDUCATION JAVA SUCKS FOR EDUCATION JAVA SUCKS FOR EDUCATION JAVA SUCKS FOR EDUCATION JAVA SUCKS FOR EDUCATION JAVA SUCKS FOR EDUCATION JAVA SUCKS FOR EDUCATION JAVA SUCKS FOR EDUCATION JAVA SUCKS FOR EDUCATION JAVA SUCKS FOR EDUCATION JAVA SUCKS FOR EDUCATION JAVA SUCKS FOR EDUCATION JAVA SUCKS FOR EDUCATION JAVA SUCKS FOR EDUCATION JAVA SUCKS FOR EDUCATION JAVA SUCKS FOR EDUCATION JAVA SUCKS FOR EDUCATION JAVA SUCKS FOR EDUCATION JAVA SUCKS FOR EDUCATION JAVA SUCKS FOR EDUCATION JAVA SUCKS FOR EDUCATION JAVA SUCKS FOR EDUCATION JAVA SUCKS FOR EDUCATION JAVA SUCKS FOR EDUCATION JAVA SUCKS FOR EDUCATION JAVA SUCKS FOR EDUCATION JAVA SUCKS FOR EDUCATION JAVA SUCKS FOR EDUCATION JAVA SUCKS FOR EDUCATION JAVA SUCKS FOR EDUCATION JAVA SUCKS FOR EDUCATION JAVA SUCKS FOR EDUCATION JAVA SUCKS FOR EDUCATION JAVA SUCKS FOR EDUCATION JAVA SUCKS FOR EDUCATION

Name: Anonymous 2008-01-08 18:42

java doesnt really suck for education ..
It's not that great, I would recommend scheme personally but hey, opinions differ.

Name: Anonymous 2008-01-08 18:58

>>14
Mm hmm. In different classes, but I see no reason that students shouldn't be able to learn both at once, assuming no unreasonable rate of progress is demanded. I think that CS curricula both underestimate students abilities to learn while overestimating what they should be able to figure out for themselves. They decide that concentrating on one fairly odd language (usually Java or C++) is best for learning, teach its syntax along with a few data structures, and then throw students in the water, without even studying well-written programs. So you end up with students trying to parse data files and represent them in memory, without ever having seen a decent parser implementation.

I would do the opposite. Surely students can learn int f (int x) {...} and (defun f (x) ...) at the same time. Students are expected to juggle five or six subjects at once as a matter of course, but somehow we get funny about it if two of those are programming languages. And surely students shouldn't be expected to jump directly from theory to implementation on their own.

Name: Anonymous 2008-01-09 2:40

>>16
Java is almost as bad for education as Cobol was. It cripples students.

Name: Anonymous 2008-01-09 2:47

C:  Spend 3 weeks getting all the shit together just to support the framework for your code.
Java:  Spend 3 weeks getting your code running and tested.

Name: Anonymous 2008-01-09 4:43

>>14
(defun (hello-world) (printf( "hello world" );)

C AND CL AT THE SAME TIME BITCHES

Name: Anonymous 2008-01-09 5:25

>>20
COMPILER ERROR AT THE SAME TIME BITCHES

Name: Anonymous 2008-01-09 7:19

>>21
DON'T YOU USE COMMON CLISP?

Name: Anonymous 2008-01-09 7:31

NO, I USE UNCOMMON SCHEME, TO MAKE THE SUSSMAN HAPPY

Name: Anonymous 2008-01-09 7:50

I actually use Scheme. It has an OpenGL implementation and everything.

Name: Anonymous 2008-01-10 1:02

Name: Anonymous 2008-01-10 13:36

Name: Anonymous 2008-01-10 14:02

yeah well i'm a cfag but i can agree, because students often want results fast, they lose interest if they don't get it, form a TEACHERS perspective i believe java is better, but teachers should also carefully point out what java is, how it differs from c and why it works the way it does

just explain to them that c is more low level and the advantages and disadvantages of that

Name: Anonymous 2008-01-10 14:07

>>26
that was actually sum good reading, but most of it you can figure out on your own if you see through the bullshit and use ur logic

Name: Anonymous 2008-01-10 14:13

>>26
Why C++ Matters

I stopped reading after that.

Name: Anonymous 2008-01-10 14:18


HAHAHAHA YOU TH    INK YOUR        E THOU     GH UH ? I HAVE ON    E WORD FOR YOU     THE FORCED INDEN     TATION OF CODE GET I
T             ?     I     D       O     N     T      THIN     K    S             O    Y      OU D     O    N                  T
K   NOW ABOUT M      Y     O     T     H      E      R  C     A    R   I GUESS ? I    T      S  A     C    CDR AND      IS PRON
O   U                 N     C   E     D       C      UDDE     R    O   K              Y      FUQI     N           A     N
G   ERED AN EXP        E     RT      P        R               O    G   RAMMER THIS    I               S           /     P
R             O         G           /         Y     OU ARE  AL     L             O    W     E      D T            O     P
O   S HERE ONLY         I           F         Y     O              U   HAVE ACHIEV    E     D S    A              T     O
R   I                  P     ROG     R        A     M              M   I              N     G  I    S             A     L
A   BOUT ABSTRA       C     T   B     U       L     L              S   HITE THAT Y    O     U   W    I            L     L
N             E      V     E     R     C      O     M              P             R    E     H    E    N           D     I
HAVE READ SICP      IF ITS        NOT DON     E YOU H              AVE TO TOO BAD     RUBY ON     RAILS           IS SLOW

Name: Anonymous 2008-01-10 15:01

>>29
ur prolly trolling but i just had to comment on that

a real programmer doesn't view languages biased like you, a real programmer views languages as tools, your job and your pay defines if you need a philips screw driver or a fucking hammer

Name: Anonymous 2008-01-10 16:15

>>31
C++ is the spork of programming languages. Hey, wouldn't it be awesome if we had a language that could work either as a fork or a knife? Yeah, in theory. In reality a slotted spoon is fucking useless and a fork with fat little quarter-inch long tines can't stab a damn thing.

Name: Anonymous 2008-01-10 16:54

>>32
*holds up spork*

Name: Anonymous 2008-01-10 17:35

>>33
gb2/bed katy

Name: Anonymous 2008-01-11 0:19

hi every1 im newb!!!!!!! *holds up spork* my name is katy but u can call me t3h PeNgU1N oF d00m!!!!!!!! lol...as u can see im very random!!!! thats why i came here, 2 meet random ppl like me ^_^... im 13 years old (im mature 4 my age tho!!) i like 2 watch invader zim w/ my girlfreind (im bi if u dont like it deal w/it) its our favorite tv show!!! bcuz its SOOOO random!!!! shes random 2 of course but i want 2 meet more random ppl =) like they say the more the merrier!!!! lol...neways i hope 2 make alot of freinds here so give me lots of commentses!!!!

DOOOOOMMMM!!!!!!!!!!!!!!!! <--- me bein random again ^_^ hehe...toodles!!!!!

love and waffles,

Name: Anonymous 2008-01-11 2:52

>>35
We need a /prog/ version of that.

Name: Anonymous 2008-01-11 2:56

>>36
I don't think so.

Name: Anonymous 2008-01-11 3:12

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 ^_^...,,,,,,,,,,,,,,,,,

Not worth it.

Name: Anonymous 2008-01-11 4:38

hi every1 im newb!!!!!!! *holds up refrence manuals* my name is katy but u can call me t3h PeNgU1N oF d00m!!!!!!!! lol...as u can see im very random!!!! thats why i came here, 2 meet random ppl like me ^_^... im 13 years old (im mature 4 my age tho!!) i like 2 learnz c (im procedural if u dont like it deal w/it) its our favorite brain fsck!!! bcuz its SOOOO random!!!! c++ is random 2 of course but i want 2 meet more random memory leaks =) like they say the more the merrier!!!! lol...neways i hope 2 make alot of freinds here so give me lots of commentses!!!!
FENCE POST ERROR!!!!!!!!!!!!!!!! <--- me bein random again ^_^ hehe...toodles!!!!!
nibbles and bytes,
*~t3h PeNgU1N oF d00m~*

Name: Anonymous 2008-01-11 4:55

>>39
No even single mention of SICP?

Fail.

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


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