Please create an account to participate in the Slashdot moderation system

 



Forgot your password?
typodupeerror
×

Comment Re: Swift (Score 1) 365

I think I'm going to have to disagree with you here.

The ternary operator is just syntactic sugar for an if..else statement, I don't see how this is any different except for prettier (subjective!) syntax. Also ternary is best used with caution. Complex ternary expressions are the embodyment of "Well, that escalated quickly". Also, you seem to be describing MVVM, which still uses all the conditionals, it's just hiding it from you at the expense of flexibility.

I don't like replacing states with arbitrary ranges of a number. In your example you assume some way of knowing in advance the length or duration of something. This is simply not true in many cases and would give a false indication of knowledge. In your example set [not started, arrived] you imply only being able to know the initial and final state, yet the 0.75 seems to indicate a high level of accuracy. These are not comparable situations. If you had only had knowledge of initial and final state, the number would essentially be treated exactly the same, using conditionals. If you had the accurate information to indicate progress, you wouldn't use states in your model anyway because you'd lose information.

All I'm seeing is some rules of thumb and low-level optimalization strategies --examples where a good solution doesn't need to use conditionals-- but no solid argument against the use of conditional expressions in general. I'm not disagreeing with most of the examples you give, but they are very specific and do not seem to support eskewing conditionals in general.

Comment Re:Here's a thought... (Score 1) 318

Don't [...] put yourself in a position where others can post embarrassing photos or videos of you online

Seriously... were you ever a kid or a teen yourself, or were you born a boring old grampa?
Doing embarrassing things is what kids do; it's how they learn what not to do.
The problem is hypocritical people who like to pretend they never did anything embarrassing when they were kids.

Comment Re: Swift (Score 1) 365

Do you have an example of code without "if" (or similar) statements that is more easily readable than the equivalent with "if" statements would be?

It seems to me the only way would be to either use numerical tricks, which you say you like even less. And to which I would agree (though I've used them on DSP's because true branching would be dramatically slower). Or to abuse loops (which are essentialy "if" statements with "goto"s) or things like the Strategy design pattern.

Comment Re: Swift (Score 1) 365

Despite your coworkers being stupid, ignorant or both stupid and ignorant, you still have to write code those coworkers they are able to maintain.

Your code none of your coworkers understand might be "good" on some subjective level, but it's not good in the real world.

Unless you have a guarentee that nobody will ever see your code, you are writing code for other people to read. Ignoring this simple reality is... well... it's ignorant.

Comment Re:Swift (Score 1) 365

I'm guessing the language you propose is able to magically assume what the developer wants without the developer having to put it in unambiguous statements?
Programming languages are "obnoxious" because they require absolute 100% precision, and people generally don't like to be anywhere near that precise.
Saying "I want a program that adds up numbers" can have literally millions of completely different implementations.
You could make one that fits the ambiguous specifications perfectly, yet is the polar opposite of what you intended.

But please give a small example of your preferred language syntax.

Comment Re: Swift (Score 1) 365

If you think other programmers are dumb because they don't understand your code, then you are the one being dumb by writing that code knowing your collegues won't be able to work with it.
I'm sure they understand XOR and the ternary operator just fine.
A bunch of if statements are a lot faster to read, though, and allow for easier debugging and changing.
Remember that most time spent with code is reading it, and mostly by people who did not write the code.

Comment Re:What benefit to announcing it? (Score 2) 203

I don't see any apparent upside to the public good.

If vulnerabilities would never be publically exposed, it would remove incentive to fix the vulnerabilities.
Companies generally don't like to spend money fixing problems that they could far more cheaply deny.
The public good of "public disclosure" is that it makes companies accountable for their (in)actions.

Slashdot Top Deals

It's a naive, domestic operating system without any breeding, but I think you'll be amused by its presumption.

Working...