Re: OT: C or C++?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 15 Oct 2010 09:13:05 +0200, Philipp Überbacher wrote
> 
> Using eclipse from the start might be a questionable choice, but for 
> the rest there's no best answer. Either take the 'take it as a 
> given' approach or start with explaining objects and classes and and 
> and...

But what's the teaching goal? Packages /what's in a name), classes (how
do we model the real world?) et al. are programming fundamentals.
 
> About half of my fellow students are total beginners who've never
> written or even read a single line of code. To them everything is 
> new, and they need to filter the essentials from the distractions, 
> so less distractions is a real help.

Fellow students of what? Computer science (Informatik)? What a scarry
idea. Now, don't get me wrong - I presonally would choose a rather
different approach to programming intro: until recently often CS was
taught with using Scheme. No objects or packages (at least not in the
old standard).  Wonderful literature [1][2]. But a lot of students
complained about using an 'ivory tower' language instead of something
they could use later on in their career ... go figure :-(
   

> > $ cat > Foo.ava 
> > class Foo
> > {
> >   static { System.out.println( 1.2+3+"||"+3+2.1 ); System.exit( 0 ); }
> > }
> > ^D
> > $ javac Foo.java
> > $ java Foo
> > 
> > C'm on, that's not really that hard, no Eclipse, no packages, no real object.
> 
> Is this using some implicit main() or something?

No, it's using a static code block that gets executed after loading the class.
Nice
concept if you think of it (and it would be cool iff C/C++ had something
similar in
a portable way).
 
> I wouldn't expect 4.2||32.1 as a result. Either interpret the whole
> thing as a string, or the number parts as float or don't do this 
> kind of automagic conversion at all. Interpreting numbers as numbers 
> and interpreting numbers as string in the same statement is 
> something I wouldn't expect.

Evaluation order, another basic topic of programming, sigh :-/
Remember, there's no such thing as "the whole thing" here. Just a crude mixture
of chained method invocations and special operator calls. 
Yes, there's a definite price for cute infix notation and overloading. That's
why we
lispers prefer unambiguous prefix notation (hypotetical code):

(strange-+ (+ 1.2 3)
           "||"
           (+ 3 2.1))

> > has to take. Are you criticising the choices the Java team made? Do you prefer
> > the Ocaml way?
> > So "1 + 2", or "3.0 +. 2.1"  - and then the horrible "add_int_to_float 1 +
> > 2.0" ????
> > That for shure will be less confusing to beginners :-/
> 
> I don't know Ocaml, so no idea what the above means.

You need a dedicated operator for every type of argument, so + only works
for integer, +. only works for floats, and if you want to add one to the
other you need to provide your own function (with exactly the semantics you
need).

> > P.S.: if possible i try to avoid programming in Java, but for totally
> > different reasons.
> 
> Which are?
> 

rather off-topic in this list :-) 
But it's more the "culture" and comunity arround a language that seems
to be important. At least for me.

 Cheers, RalfD

[1] Structure and Interpretation of Computer Programs
[2] Exploring Computer Science with Scheme 
 
> _______________________________________________
> Linux-audio-user mailing list
> Linux-audio-user@xxxxxxxxxxxxxxxxxxxx
> http://lists.linuxaudio.org/listinfo/linux-audio-user


--
R. Mattes -- Systemeinheitsstreichler
Hochschule fuer Musik Freiburg
rm@xxxxxxxxxxxxxxxxxx

_______________________________________________
Linux-audio-user mailing list
Linux-audio-user@xxxxxxxxxxxxxxxxxxxx
http://lists.linuxaudio.org/listinfo/linux-audio-user



[Index of Archives]     [Linux Sound]     [ALSA Users]     [Pulse Audio]     [ALSA Devel]     [Sox Users]     [Linux Media]     [Kernel]     [Photo Sharing]     [Gimp]     [Yosemite News]     [Linux Media]

  Powered by Linux