Want to read Slashdot from your mobile device? Point it at m.slashdot.org and keep reading!


Forgot your password?

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.

Don't hit the keys so hard, it hurts.