Follow Slashdot blog updates by subscribing to our blog RSS feed

 



Forgot your password?
typodupeerror

Comment: Re:That again? (Score 1) 382

by swilver (#49754847) Attached to: How Java Changed Programming Forever

That's because "import wheel" in Python means something different than the similarly written statement in Java.

In Java an import written like that imports only one specific class. In Python it means import everything defined in the wheel "package". You can do the same in Java: import wheel.*

That syntax however is frowned upon, as it makes it less explicit about what you are actually using, and more assumptions must be made to understand the code. Did that class come from "wheel" or did it come from "stoneage", "car", "steam" or "yarn" ?

Anyway, contact me again when a Python snippet can actually survive being send by email.

Comment: Re:It's not that great (Score 1) 414

by swilver (#49754627) Attached to: The Reason For Java's Staying Power: It's Easy To Read

The semi-colon's mean I can split up a long line of code in nicely lined up parts with just the enter key. Without them, I might be changing what the code does, or I'd need to fix all the parts and add somekind of continue operator.

The fact that those semi-colon's are there is one of those things that makes Java more readable. I don't have to guess that a line will be continued or not (see Javascript). Making it optional just serves to confuse future readers of the code - that's why Java makes these mandatory. You can leave them out, but then you're code means something else.

This and the fact that Java often only gives you one option to write something is exactly what makes the language so readable. Try explaining that though to the Scala / Groovy / Clojure / Hip++ crowd however... they seem convinced that the number of keystrokes it what dictates development speed... perhaps I should sell them Dvorak keyboards...

Comment: Re:must fail (Score 2) 298

by swilver (#49357693) Attached to: Ask Slashdot: What Makes Some Code Particularly Good?

It is good practice to throw exceptions for even fatal errors. What they've missed however is to add information to the exception about the error (the stuff you propose they should log).

Somewhere way up the call stack you have a catch all exception handler, which is responsible for logging the exception -- so it is not necesarilly the caller who logs this. If the caller cannot handle the exception, it should just leave it and let it bubble up.

This way there's no need to duplicate logging code in every small little function that can't handle certain inputs.

Comment: Re:It depends (Score 1) 486

by swilver (#49337435) Attached to: No, It's Not Always Quicker To Do Things In Memory

So will the os fragment the string, when it comes up to an other systems reserved memory spot. Will it overwrite it (Buffer overflow), will it find a contiguous larger memory block and copy the data there

Wow, this may have been the case eons ago when MMU's didn't exist, but in a modern day OS, you get an address space that's all your own. Nobody else is using it, and real memory is simply mapped (usually in chunks of 4k or 8k) into your address space -- it can be fragmented all over the place, it will still look like one nice big chunk to your program.

OS Disk management: A lot of the same concerns that memory management has. However a bunch of small request is easier to find free space, then asking for a larger spot. So they may be more seek time

Most filesystems already work with a minimum of 4k chunks. I cast serious doubts on your claim that smaller chunks are easier to find, it would depend on the data structure used for tracking free space and whether the filesystem is reserving space for you by leaving gaps at your last write location.

Comment: Re:Java is not written like other languages (Score 1) 411

by swilver (#49042359) Attached to: Your Java Code Is Mostly Fluff, New Research Finds

No, they don't.

The program language has to be suited for such tools. The better you can reason about a language the better these tools can be, and Java really nailed that one. That's why you can refactor large code bases with it and have some level of confidence that you didn't break something.

Comment: Re:How parallel does a Word Processor need to be? (Score 1) 449

by swilver (#48715883) Attached to: How We'll Program 1000 Cores - and Get Linus Ranting, Again

Yes, and it re-rerenders all the pages as bitmaps at 400% zoom, scales them back down to get proper anti-aliased results, then compresses them with JPEG and stores them into main memory... ...or how about just recalculating the page that you need to display?

Parallel processing is not gonna solve stupidity.

What sin has not been committed in the name of efficiency?

Working...