Catch up on stories from the past week (and beyond) at the Slashdot story archive

 



Forgot your password?
typodupeerror
×

Comment Re:Use C# (Score 1) 709

Why would a programmer keep using a tool if it's much worse for the job? It just doesn't really happen.

You're lucky, then, or exceptional. Or at least, speaking only for myself, I do have to spend years building habits like version control (killing the bad habit of commenting tons of stuff out and in to make it work), automated testing and especially any sort of test-first development, and so on.

Also, I think GOTO's have one advantage for a learning language aimed at small children: It's easier for a child to learn and understand, as a building block / stepping stone toward more complex things. For some reason, I even remember this learning process (using basic, that was popular then) when I was a small child, on our 48K ZX Spectrum ... GOTO's were easy and obvious, but I recall seeing these weird GOSUB things that seemed more abstract somehow.

I remember that, too. But I also remember that when I first saw functions, they made sense. Maybe the GOSUB syntax was just unhelpful?

Finally, any good programmer needs to do significant amounts of assembler at some point in his life, and you're gonna be doing lots of JMP's there anyway, and yet nobody considers that 'learning bad habits',

I would say that's mostly because assembly generally isn't taught as a first programming language. By the time you learn assembly, you already understand structured programming and why it's a good thing, certainly by contrast to assembly.

There are many other bad habits that cause FAR more damage in real-world programming, and yet nobody even cares to teach those in formal Comp Sci or Engineering programs.

I'd certainly like to hear about those. I'm in an odd situation where instructors in my formal Comp Sci program actually listen to me. (Of course, it's academia, so even if they took me as seriously as I'd like them to, it'd still take years to change...)

Comment Re:Use C# (Score 1) 709

Have a look at PowerBASIC [powerbasic.com], for example.

DOS/Windows and proprietary? No thanks.

In my opinion a key point which makes BASIC great as a beginner's language is readability. It's more or less plain english and stays away from all that curley bracket/semicolon stuff.

So does Ruby. More so, I'd argue.

Comment Re:Use C# - GOTO is essential (Score 1) 709

When you're telling the CPU what you want it to do ?

In what sense?

I'm telling the CPU what to do when I type here, but I'm certainly not giving it a jump instruction, or any other instruction, manually. I'd have to be insane to do so just to type up a Slashdot post.

Now, if I needed assembly for some reason, yes, a jump instruction becomes relevant. I can't remember ever needing assembly for anything.

Comment Re:Use C# (Score 1) 709

and how is GOTO different than exception handling?

Exception handling is structured, and it does things GOTO can't, that I know of. For instance:

if (world is ending)
  throw IDontKnowWhatToDoException

This puts the actual error-handling code somewhere up the stack where it's actually relevant.

Its just a more generalized version of using break, continue, etc.

Well, in the same sense, it's also a more generalized version of a loop, but you still use structured loops, don't you?

Break, continue, return, etc, are all limited in scope. They do one thing, and do it well. Aside from being clumsier for the things I'd use a break for, goto can take me anywhere else in the program.

Comment Re:Tail call elimination (Score 1) 709

I'd have to imagine that if your state transition is effectively the end of that function, tail-call optimizations could still be done. For instance:

some
code
if (time for a new state) {
  switch_to_another_state();
  return;
}
more
code

Effectively a goto, but semantically a function call. Why wouldn't that be caught as a tail call?

Comment Re:Use C# (Score 1) 709

Another good reason is to avoid unnecessary indentations. If I had a dime for every time I saw code like

I know return is effectively a goto, but I do prefer it, along with break, continue, and exceptions, as a more structured approach. So I'd do:

if (testopt("-h")) {
  showusage();
  return;
}
rest
of
program
here

Pretty much the same as:

It's also worth noting that "break" is a scope-limited goto, yet few have issues with it.

Well, precisely because it's limited in scope and much better defined. I also have far less of a problem with, for instance, the way Java handles references than with the way C++ has stack objects, references, and pointers, complete with pointer arithmetic. It may be the same thing in some abstract sense, but there's far less opportunity to screw it up.

Comment Re:Use C# (Score 1) 709

One, to avoid repeating cleanup/logging code [c2.com] when an error occurs within a deeply nested conditional. There are many who disagree with the use (or overuse) of exceptions, especially when used to control normal flow rather than catching true errors.

Why is a goto better than an exception in this case? Seems to me that things like break, return, and exceptions are effectively goto, but somewhat more structured and safe.

Two, when you're writing in assembler.

Fair enough.

Comment Re:Use C# (Score 1) 709

Did you reject GOTO as a way to forever avoid writing anything in assembly?

Perhaps. I certainly reject it when I'm not forced to write assembly.

it misrepresents the content of the letter.

I'm not sure how the original title makes it any better.

Good enough for you?

Probably not, but let's see:

they are often more readable than large amounts of indentation.

Solution: Use two spaces to indent.

But I think the most telling bit is this:

That said, I have used exactly two "goto" statements in all the lines of C,
C++, Fortran 95, and (yes) COBOL I've written since leaving BASIC and
Fortran IV behind. In one case, a single "goto" doubled the speed of a
time-critical application; in the other case, "goto" shortens a segment of
code by half and makes the algorithm much clearer. I would not use a goto
willy-nilly for the fun of it -- unless I was entering an obfuscated code
contest ;)

So, I take it back -- there are cases where a goto might be nice. However, they do seem to be about that rare, so I wouldn't want them in an intro to programming any more than I'd want pointers.

Comment Re:Goes both ways... (Score 1) 645

Actually atheism [merriam-webster.com] means that you disbelieve there is a god.

Look at definition 2a. And should I take them seriously when they still list (even as archaic) "wickedness" as a synonym?

Agnosticism [merriam-webster.com] means that you can find no justification for either belief or disbelief in a god.

Look at definition 1 there -- that's the "unknowable" definition I was talking about. Do you actually believe the only rational approach is to say that the question of a god's existence is unknowable? I certainly wouldn't be bold enough to commit to that without at least having a working definition of whichever god we're talking about.

My turn: Check Wikipedia, especially the first four sentences. Or better yet, look at the people who actually define themselves as atheists are saying about it.

By contrast, I know very few who positively assert that there is no God, or there are no gods, and they don't seem to have a problem with the word "atheist" describing those who just don't believe, rather than actively disbelieving. The only people who seem to have a problem are religious people who want to strawman us, or atheists who don't like the negative connotation and want some sort of a middle ground, so they self-identify as agnostics.

Comment Re:Goes both ways... (Score 1) 645

We can't say anything for sure other than "I sense these things."

Which is still more than cogito ergo sum. And we can say more than that -- that they exist.

Of course I try to root out contradictions, mine and other people's. I just don't mock people for them, it's not worth the effort. I prefer good, clear logic rather then getting emotions involved.

Ah, I see. ...whereas I find mocking is sometimes the only appropriate response. Fred Phelps isn't going to respond to good, clear logic. He's not going to respond to mocking, either, but it's a lot more fun than trying to reason with him.

But it looks like we don't actually disagree on much here.

Comment Re:Use C# (Score 2) 709

I actually did think for myself when I rejected GOTO. I actually went back and read the "GOTO considered harmful" essay.

Can you provide an example of when goto is appropriate -- in particular, when it's appropriate to use a goto rather than actually structured programming, or even a safer option like break, return, or throw?

Comment Re:Use C# (Score 1) 709

Ruby is a terrible language to teach programming, there is so much stuff that needs to be used responsibly.

In what way is it different than any other language?

Basic has GOTO. Java has ==. C and C++ have pointers, pointer arithmetic, memory allocation, etc, on top of goto and similar == problems.

monkey patching and other stuff should not be an option for someone learning programming basics.

Practically, it isn't. Someone learning programming basics likely wouldn't run into monkey patching.

Comment Re:Use C# (Score 1) 709

Yes, and that's one of its stronger side. Using whitespace to delimit blocks of code is very natural to someone with no programming background.

...yes and no. Yes, it does help that it visually looks close to what it should...

But a tab is different than a space, and that's going to confuse some newbies.

Comment Re:Goes both ways... (Score 1) 645

You have many points, and I would respond to each one, but for brevity I do want to some I consider more important than others...

I'll try to do the same, but no promises...

If there is a singular example of judging a philosophy by its abuse, this is it. You really don't expect me to defned the Catholic Church's record of dealing with the problems of child abuse by their clergy, do you? Seriously? If that's your example of religion gone bad, it's a good one. If it's your example of Christianity failed, well, you are well off the mark.

Probably, in that it isn't Christianity which told them to do this. For that, the most obvious example is likely the Westboro Baptist Church, or the individual cases of people hearing the Holy Spirit tell them to kill someone.

Well, to expand, legislation is always some expression of someone's intention. And informed by their morality, as all of our actions ultimately are. You seem as if you're assuming 'morality' is always a non-secular thing. It is not.

I'm not, but there is a difference between morality and ethics, and it's hard enough for a society as diverse as ours to agree on ethics, let alone morality.

I may be misusing these terms, so I should be clear: When I say "ethics", I understand this to be a topic which includes ethical systems like Utilitarianism, Divine Command Theory, etc -- basically, ethics is a discussion about what makes something "good" or "bad", "right" or "wrong".

Morality, on the other hand, is more prescriptive -- social mores as the result of ethics.

So, for example, the ethic might tell us that children should be protected. One morality that might come out of this is sex education -- we want children to know what's out there and how to protect themselves. Another morality might be censorship -- we want to prevent children from seeing what's out there. These two moral stances are often opposed, but they have the same basic principle as their base.

I'm a little fuzzy on this distinction, though, so I apologize.

Well, while Atheists would probably have different moral views than Christians (for example), they both do have some sense of morality.

Right.

I don't think there's really much difference between these when it comes to legislation, either -- for instance, an atheist might have a moral view that Catholicism should be banned, but that would also be a church-state issue.

First, if the point is to legislate based on values which are common to all of us, that legislation is doomed to fail, if it is even enacted. We are a diverse society in the U.S. and it is prety much bare majorities that are passing legislation. To ask for even a supermajority is too much.

Not for the truly basic values. For example, the idea that life has some intrinsic value, and that you'd better have a damned good reason to take a life, is nearly universal, and not just in this country.

Many of the disagreements about legislation aren't about the morality of it. They're about how it affects whatever group you care about (usually yourself), and many of them involve fundamental misunderstandings.

For the things we don't necessarily share, such as gay marriage, the pattern is usually an argument between people wanting to impose their morality on others, and people just wanting to do things on their own which don't affect anyone else. I'm not gay, and I'm not going to try (yet) to convince you that there's nothing wrong with homosexuality, or with homosexual married couples. What I don't see is why they shouldn't be allowed to marry.

Second, to 'enforce the bare minimum' is laudable, and used to be a goal of the Conservative movement. We are well past that, sadly. I wish we could have a minimal government, but the Liberal, Progressive, or Leftist movement in the U.S. seems determined to greatly expand government beyond the bare minimum. Not that the Conservatives or Republicans are afraid of spending and expanding in their direction either.

Worse, it's actually backwards. The Republicans, recently, love to paint everything as a big-government issue, even when it's not -- notice especially the hyperbole about Network Neutrality, and how it's actually been twisted around (yet again!) to mean something entirely opposite from what it actually does.

But in practice, historically, the democrats have pretty much always reduced the debt when they were in power, while the republicans have pretty much always increased the debt when they were in power. It's especially funny right now -- we just topped ten trillion dollars in debt, and that was during the Bush years.

But that might be getting a bit offtopic.

You make the point, based on numbers, but in reality the choice is between violence and peace. I'm aware of several violent responses to various insults against Islam.

As am I, but this seems to be the result of people growing up in Sharia, where Islam is not allowed to be questioned, and then being forced into the 21st century and communicating with the rest of the world.

But by the same token, I'm aware of violent responses to various insults against Christianity (though admittedly less so, largely because we're in a more comfortable society) -- and you were criticizing me earlier for judging an entire religion based on a few adherents.

Wow, where does Christianity get to use ' government money'? Are you referring to faith-based charities?

Well, if I wanted to find existing examples, that'd be right up there near the top of the list. Another example would be the tax exemption for churches.

But no, I wasn't actually making that claim. The point was rather that this is one thing separation of church and state is supposed to be about. You seemed to be skeptical that the "Wall of Separation" was a good idea.

Just as an aside, is Christianity in the 20th and 21st centuries marked by violence and intolerance? I know the media have many examples of intolerant Christian thought, but are thye viewed as the mainstream of Christian thought?

Actual violence? No. Intolerance, however, is mainstream enough. Just watch Glenn Beck talk about Liberals and Atheists.

Have you read any of their training materials? Do you know why you haven't?

No, and yes -- I haven't because I haven't really had a motivation -- no reason I should read them, and I'm not curious enough to read them for fun.

But you're right, we should not be teaching specific moralities or beliefs in favor of others. Why do school systems teach sexuality in grade school?

So that students know how to protect themselves. Because the students will be learning about sexuality one way or another, and it's far better if they actually know the truth.

And because it actually decreases teen pregnancies, versus abstinence-only education. That's not a matter of morality or personal opinion, that's what the studies actually show.

Your example is lost on me - I see Christianity being specifically challenged in our schools, at every level. I don't see Christianity getting any protection at all. do you know of some current examples I don't?

Well, aside from "under God"... I hesitate to bring that up, because most people can't see it as a big deal, and it tends to just make me look like an Anrgy Atheist, but it doesn't change the fact that effectively forcing children to recite these words every morning is not OK.

But there are numerous examples. A few come to mind, and I must apologize that these are entirely from (possibly faulty) memory -- when I read about them, the sources were sound, but I don't have them on hand.

Except, maybe, a story from this podcast -- 1:24:00 to 1:28:05 or so.

But there's also the "Intelligent Design" movement, and the textbooks in Texas. And this is not the only example of a teacher who decides to teach what he wants anyway -- a history teacher, for instance, who takes the first week or so of class to talk about creationism instead of history.

what I consider 'cold' isn't what wife considers 'cold'.

I should've seen this coming, and it was a poor choice on my part.

See, at that point, it's not a belief, it's an opinion. You wouldn't say to your wife, "Only one of us can be right, it absolutely is not cold!" while she's shivering.

So you wouldn't say "I believe it's cold." You'd be expressing an opinion that it's cold.

On the other hand, saying it's 277 Kelvin is a statement of fact, not opinion. Whether you believe it or not is largely a result of whether or not you trust the thermometer in question, but generally, you don't have a choice -- it's 277 Kelvin. It's 40 degrees Fahrenheit. Either those are true or they're not, but you don't usually have a choice even about whether or not you believe them.

Opinions can be defining, certainly. But beliefs like the above? The only way that would come to define you is where you start to believe something crazy, like that it's actually 500 Kelvin.

I suppose my point was this: It's not my beliefs that define me, it's how I come to those beliefs.

I appreciate Strobel's work, but admittedly he tries too hard.

It's not just that, it's not just the problems with his work, it's the dishonesty. He claims to have been an atheist. I suppose I couldn't say whether he was or wasn't, but his entire book documenting his search for the truth is not impartial at all. It's him taking his doubts straight to the religious, to the apologist, then accepting the result without even looking for a counterargument.

So when I say that people end up sounding like Strobel, I mean they end up repeating some argument they heard their pastor make once, an argument I can trivially refute.

Here, I have some news for you. That's the human condition. Religion is not even the most prevalent example of this. We are a not very nice race, humans. As a very, very small example, if you have children or have observed others children, tell me - did anyone have to teach them to lie?

They did have to learn. Incidentally, we don't make it easy for them when we lie to them about Santa Clause.

We are inherently sinful, and prone to evil.

And this is one thing I think religion does that's harmful. I don't believe for a minute that we are inherently evil. I'm not sure you do, either -- can you honestly look at a newborn child and say, "What an evil person"?

There are NOT "very few things which can make a good person do truly evil things". We do evil things for the least of reasons, and repeatedly.... And evil is renown even without religious inspiration. Do you need examples of this also?

The point is not that it's hard to make people do evil things. The point is that it's religious belief which can make a good person, acting in what they think is good faith, do something truly evil, and still think they did the right thing.

As an example: Without religious faith, why would a parent refuse to allow their child to be treated for a life-threatening illness? We're talking about a good person, a parent who loves their child, who wants what's best for them, who absolutely believes they're doing the right thing. The only way I can think of this happening without faith is insanity.

I know a few of these people. I believe them. But then again, I know some people that suppress their rage by a concerted act of will all on their own.

We're probably talking about different people, then. The people I usually hear saying this are people who are trying to say that religion is the root of all morality -- that I cannot possibly be good without God. And they are otherwise relatively normal, happy people, aside from their evangelical zeal.

Well, actually, if a woman kills her children in the mistaken effort to ensure they enter Heaven, well, she is indeed misguided. A tragedy. Any less than that of a woman that kills her children to avoid being burdened by them, so that she can lead her life as if they had not existed? Or of a woman that kills her children in the womb rather than be a mother at all?

When we say "children", we're normally talking about children who have been born, who are alive, intelligent, learning, growing, who we want to protect and nurture...

What you are talking about is killing fetuses, which depending on the stage of development, may or may not resemble a human at all.

I oppose late-term abortion, and I generally oppose abortion in the third trimester. Before that, I'm not sure where to draw the line. But at a certain point, it's not even a fetus, it's a zygote. There's a lot of opinion around these, but also a fair amount of fact -- if it doesn't have a nervous system yet, how can it feel pain? How can it suffer? Can it really be considered alive?

while I'm not a woman, I can actually grasp the despair or simple choice to kill a fetus rather than go through having the child. It's an impossible situation, and not answered adequately with the admonition to 'just say no'. It's a question of personal ethics.

It is, but this is why I brought up the woman who killed her two live children -- an act pretty much universally condemned. And she apparently loved them, she cried over them.

So we end up with the same issue: Religion can have people who think they're doing the right thing, acting with the best intentions, their emotions are in the right place, nearly everything about them is admirable, except they're committing atrocities.

The examples you've given are either questionable, or we're talking about, in general, people who knew better. The child who stole the last cookie from the cookie jar knew it was wrong, and did it anyway. The executives who approved sweatshop labor, where the housing for the laborers needs to have giant nets around the buildings to prevent suicides, know what they're doing, and they do it anyway -- and it may be a moral gray area anyway, after all, Foxconn has lower suicide rates than others.

But then, I may be a bit hasty to blame religion rather than this kind of thinking I associate with religion. The Nazi who guards a concentration camp, who marches the Jews into the gas chambers, who drops the pellets of gas in... He may well believe this is the right thing to do for the Fatherland.

Then again, the Nazis had "Gott mit uns" on every belt buckle.

Well, you know of the Gospel then. If you would like, I can tell you what I believe it to be, and offer support from the Bible, but perhaps not in this already too-long response.

I'd like that, actually, but my own response might make that prohibitively long.

Sorry about that. I really should be cutting this down a bit...

Slashdot Top Deals

God doesn't play dice. -- Albert Einstein

Working...