New Member
Join Date: Nov 2005
|
Hands up who has never had a desktop application fatally crash, temporarily freeze or permanently hang on them? Apart from the abacus users over there we've all had it happen to us. But why?
Is it just sloppy programming or is there something fundamentally broken with the way applications and operating systems are coded? After upgrading to OS X 10.4.3, Mail started consistently crashing a few seconds after launching. After digging around the forums I got a possible fix: remove all stored email messages and configuration/preference files. It worked, I'm happy to say. I got a virgin Mail application that was seemingly stable. Luckily, I use IMAP email - all my mail is stored on my server. So, after setting up the account details in Mail - yet again - I just synced Mail with the IMAP server and I had all my email local again - nice. Now then, this debacle isn't new. I've had to do this all before. There's a pattern here perhaps. When the chips are down or when configuration files are corrupted or not understood by the new version of the software why does the application have to crash on me? Why is this such a fragile world? What's the basis for my thinking that our software could be build to not crash, freeze or hang? I'll tell you... Take the scenario where you're browsing the Web, hopping from one website to another - and then you click on a link to a website that doesn't exist. How do you know? Well, the browser says "can't find website" or some such thing. It doesn't crash, freeze or throw a wobbly - hopefully. Now, what's special about the browser is that it is generally robust enough not to crash when it comes across websites that don't exist or don't adhere to 100% HTML standard specifications - hopefully. In fact there's a lot of expectation that websites wont exist or wont conform to web standards built into the browser. Now, what would happen if Mail found that it's configuration files where corrupt or formatted wrong or of an old version? Could it just say "can't read configuration files - shall I try to repair or just set up a brand new one?" rather than just crashing all forlorn like? Flump! I know Mail is currently capable of setting up a new configuration file because that's what it did when I removed them. What would happen if Mail was to pretty much expect configuration files not to conform to standard (like the web browser and its websites)? If rather than crashing Mail just asked politely "old preference files not readable - would you like to start afresh?" Wouldn't that be much nicer? And another thing... What about that spinning coloured ball or watch (for pre OS X users) or sand timer (for Windows users), eh? That long pause. Why is my interface frozen when the application is waiting for data or running a calculation? That just seems archaic. A good (or bad) case in point is spotlight searches. Why does Finder freeze with that spinning ball when it does a spotlight search? And why can't I open any other Finder windows when it freezes? So, something seems wrong at the core here. Spinning balls shouldn't exist. So, what we could be talking here is decoupling the desktop interface from the collection and management of the data. So that the interface never crashes or stalls but could report if it's not finding the data where or in the form it thinks it should find it. And the interface never momentarily freezes when accessing information or performing a calculation, it just displays a time line bar and lets you get on with other stuff. Wouldn't this be much better - much more robust? Applications would be built to handle corrupt, malformed or missing data gracefully and also handle waiting for data to sync up by showing the user what's going on. And never crash or hang the user interface. Developers could split the interface from the data processing part of their applications and enable these two components to message each other. Or an application could be split into many more components all messaging each other. The contents of each message would be checked before ingesting so that it couldn't hang or crash the recipient component. I must admit that sometimes applications seem to cope well but there just seems to be far too many times when they don't. Now, am I dreaming or is there fundamentally something amiss in the way applications and operating systems are built today? Couldn't all this be much better? What do you reckon, eh? Cheers Daniel |
quote |
Veteran Member
Join Date: Jun 2004
Location: Portlandia
|
It's a nice dream, but I think there will always be bugs in software; especially as we keep asking more and more of our computers. We are imperfect beings and it shows up in our creations. Considering the fact that my *laptop* operates regularly as a audio production facility, video editing station and print graphics center, I'm amazed that it's able to do all of that as well as it does.
It doesn't make me any happier though when the bugs show up, but luckily Apple handles the problem better than most other platforms. edit: oh, and welcome to AppleNova. "What a computer is to me is it's the most remarkable tool that we've ever come up with, and it's the equivalent of a bicycle for our minds." - Steve Jobs Last edited by sunrain : 2005-11-09 at 08:23. |
quote |
Veteran Member
|
Quote:
Quote:
|
||
quote |
Selfish Heathen
Join Date: May 2004
Location: Zone of Pain
|
As sunrain said, it's a nice dream you have, but it's based on some misunderstandings about how software fundamentally works.
Quote:
Quote:
Quote:
Ever notice how Firefox, Internet Explorer, and Safari almost never display a site pixel-perfect the same as each other? What makes web browsers special is that that's okay! "If the input is broken," the programmer says, "it's okay to ignore part of it." This is a perfectly accepted practice with web browsers when not in strict mode. This is relatively easy for a web browser to do because it's just parsing text files with tags that describe content layout. The programmer just has to write the parser so that it requires certain conditions for a tag (like a matching closing tag) for that tag to affect the layout at all. If the tag doesn't fit that condition, it treats it as plain text for output and moves on to the next. This is different from other productivity software on many different levels. Most important is the aforementioned factor that web pages don't have to produce perfect output. Compare this to any other application; most other applications (and especially the operating system itself) cannot simply "throw away" input or malformed commands as easily as this. Think of a bookkeeping application like Quicken. Which would be better, for it to die on a damaged file or to display the file with incorrect output? When you consider that thousands of dollars and my employees' welfare could be at stake, I'd rather it die and report a "bad file" error than try to "fudge it" and incorrectly calculate my business ledger, thereby allowing me to make some terrible decisions based on that incorrect output. And that's just the simple case! It gets much more complicated when you consider tasks that do more than just parsing a file. Illegal memory access is a huge source of crashes and hangs and are 100% the developer's fault. When an application is running, the operating system tells it that it has access to specific regions of memory. If the application tries to access memory outside of it's space, it is far worse than some missing text in an HTML file. Whole functions will fail, invalid commands will be queued up, and the application could literally start to behave completely randomly. So, again, it would be better for the application to crash than to continue in this unrecoverable state of disrepair. Quote:
An application is simply a long step-by-step list on instructions that run in what's called a thread. A thread must perform operations in order; that's simply how computers work. They don't arbitrarily skip around things. Programs generally go like this: 1. Set up some initial values and run any setup methods. 2. Listen for user to press a key or click a button. 3. Check through a list of actions and execute the method that matches the input. 4. Go to 2. The wait cursor that you experience is when an application's main thread is stuck at 3. Remember, these steps must be followed to the letter. You cannot arbitrarily throw input to an application when it's not listening for it (at step 3). The operating system knows when an application can accept input; so, when it sees that the application cannot, it gives you that wait cursor. There are two solutions for this:
The first simply isn't practical for any moderately sized application. The second is very common. However, when creating multiple threads, you introduce all sorts of new problems that you need to watch as a developer. Threads run whenever the operating system gives them time to run; you cannot guarantee that a thread will complete by a certain time or even before another thread that is started after it. One very serious problem occurs when two threads access a shared piece of memory. Say you have two a method that looks like this: 1. Set shared variable X equal to 0. 2. Print "hello world!" 3. Increment X. 4. If X is less than to 2, go to step 2. Else, go to step 5. 5. Set X equal to 0 and exit this method. Can you guess how this becomes problematic if multiple copies of this are running? Lets call the threads A and B. You would expect them to output "hello world!" four times, right? No? Lets look at a few test runs: A1: Set shared variable X equal to 0. B1: Set shared variable X equal to 0. A2. Print "hello world!" B2. Print "hello world!" A3. Increment X. (X now equals 1) B3. Increment X. (X now equals 2) A4. X is not less than 2; so, go to step 5. A5. Set X equal to 0 and exit this method. B4. X is less than 2; so, go to step 2. B2. Print "hello world!" B3. Increment X. (X now equals 1) B4. X is less than 2; so, go to step 2. B2. Print "hello world!" B3. Increment X. (X now equals 2) B4. X is not less than 2; so, go to step 5. B5. Set X equal to 0 and exit this method. Okay, that was four "hello world" prints. Try a different order because (remember!) we we cannot guarantee that threaded commands will execute in a specific order relative to each other: A1: Set shared variable X equal to 0. B1: Set shared variable X equal to 0. A2. Print "hello world!" A3. Increment X. (X now equals 1) B2. Print "hello world!" B3. Increment X. (X now equals 2) A4. X is not less than 2; so, go to step 5. B4. X is not less than 2; so, go to step 5. A5. Set X equal to 0 and exit this method. B5. Set X equal to 0 and exit this method. Ruh roh! Now we only get two "hello world" prints. Now, that is an EXTREMELY simplified example and is only the tip of a very, very large iceberg. Can you imagine the havoc that can be wrought with more complicated matters? An even worse problem than that is when two threads get stuck in a loop just resetting a value over and over. Also, what if a later thread needs to use a previous thread's output? The latter has to wait for the former to complete, just as in a single-threaded application. Fortunately, there are programming conventions that developers can use to try to avoid such conditions. However, developers are only human! Threading is very complex and takes a lot of work to safeguard and get to work correctly. Quote:
These things are all great in theory, but in practice it takes a lot of work to implement. Sure, it's possible, but is it worth it? Is it worth spending another hundred thousand dollars and thousands of hours for MyGreatProgram.app to achieve this when the benefits are so relatively small? Industry-wide, this would easily take trillions of dollars and decades of programming and testing. Quote:
The quality of this board depends on the quality of the posts. The only way to guarantee thoughtful, informative discussion is to write thoughtful, informative posts. AppleNova is not a real-time chat forum. You have time to compose messages and edit them before and after posting. |
||||||
quote |
Selfish Heathen
Join Date: May 2004
Location: Zone of Pain
|
Oh, and welcome to AppleNova!
The previous post was hastily typed while waiting in the noisy service area of the local Saturn dealership. So, I hope I did a sufficient job responding and that it makes some sense... The quality of this board depends on the quality of the posts. The only way to guarantee thoughtful, informative discussion is to write thoughtful, informative posts. AppleNova is not a real-time chat forum. You have time to compose messages and edit them before and after posting. |
quote |
Veteran Member
Join Date: May 2004
Location: Chicago
|
Only Brad could type something like that in a Saturn dealership. Geez.
It's nice to have him around, isn't it? |
quote |
New Member
Join Date: Nov 2005
|
Quote:
Quote:
Quote:
Quote:
Quote:
Quote:
Crashing and hanging applications is one of the biggest turn offs to people that work with computers. Having apps crash and loosing all one's data is just not on. It costs trillions to people and companies. There's your financial incentive! That's why I want to see some work done to eradicate the problem. And I reckon the idea of splitting the functionality into discrete independent modules is the way to go. Quote:
Cheers Daniel |
|||||||
quote |
Selfish Heathen
Join Date: May 2004
Location: Zone of Pain
|
Quote:
Just look at Safari as an example. The actual binary weighs in at 1 MB. One megabyte! Surely an application as fully-featured as Safari can't fit into 1 MB. So, where does everything go? It's broken up into components. The interface, for example, is stored in various NIB bundles. There are at least 22 NIBs in just the English localization for different parts of the interface. Then there's the WebKit framework, the "rendering engine" that is completely separate from the application. Of course, there are lots of other frameworks that Safari uses, including Cocoa, Carbon, AddressBook, ApplicationServices, Security, SystemConfiguration, SecurityFoundation, SecurityInterface, and SyndicationUI. Each of those may reference others too. Carbon alone is also composed of the ImageCapture, CommonPanels, OpenScripting, HTMLRendering, SpeechRecognition, SecurityHI, CarbonSound, Ink, HIToolbox, NavigationServices, Print, and Help frameworks. How about something different like a chat client? Adium is an open-sourced multi-protocol chat program written in Objective-C. Internally, it has at least four custom frameworks, five plugins, sixty NIBs, and four scripts, not to mention any of the system-level frameworks that are linked. It's been a while since I looked through the SVN, but as I last recall there was a whole page-full list of separate classes. A developer can work on one class (framework, library, etc) and have absolutely no idea how other classes work or even how his class is being used, as long as he produces the right interface and expected output. Separating and referencing components of an application like this is nothing new in the world of computer science. Quote:
Quote:
There absolutely is an incentive to what I mentioned about alternative fuels, both financial and environmental. Do you seriously think people don't want to save money on their gas and electricity bills? And that there would be no benefits (to the environment and personal health) to reducing the burning of fossil fuels and nuclear fission? There may be a greater upfront cost, but the long term savings would quickly compensate. As you later said yourself, though, there's not enough incentive to the consumer. Consumers as a whole don't see the long term, only the short-term. If the consumer is satisfied enough with the status quo, he'll keep buying gas-guzzling SUVs and topping off his tank with $50 of fuel every week. The same goes for this type of software. Until a threshold is reached where the consequences of bugs outweigh the current benefit and usability of the software, there's not going to be a serious incentive for anyone to change. I don't like that either, but it's just how the market works. Quote:
Software costs could easily double, triple, or quadruple and upgrade cycles could be delayed for months (with innovation stifled in the mean time) as more time and energy are spent encapsulating and checking values and QAing. Heck, just look at the classic Mac OS for a prime example. It had virtually no memory protection and used to crash at the drop of a hat. It grew for ten years before someone decided it needed an serious overhaul to introduce fail-safes and improve stability. That overhaul was called Copland and it was a spectacular failure that cost two years of development and untold millions of dollars. In the end, it was easier for Apple to spend half a billion dollars to buy a whole separate company and its operating system and another five years in modification than to fix its own. That should give you some idea of the scale of "cost" involved with fixing problems like this. I have a personal question for you: Have you ever written any software? Had to debug and fix someone else's code? Studied data structures, abstraction, inheritance, polymorphism, and object oriented design? Software economics? If so, I hate guys like you. (kidding ) I've had more than a few philosophical "how technology should be" discussions among colleagues and they always get drawn out for-ev-er. If not, I hope I've served to help clarify things a bit. The quality of this board depends on the quality of the posts. The only way to guarantee thoughtful, informative discussion is to write thoughtful, informative posts. AppleNova is not a real-time chat forum. You have time to compose messages and edit them before and after posting. |
||||
quote |
Selfish Heathen
Join Date: May 2004
Location: Zone of Pain
|
Also, since this is more of a general software topic rather than a call for a specific tech support issue, I'm moving this thread to General Discussion.
|
quote |
Veteran Member
|
Brad... You're posts are so long they are crashing Safari.. Jesus who coded this forum.. I mean come on guys can't you keep track of a few variables and stuff....
Only kidding.. They didn't really crash Safari.. Pleeeze don't go pulling stuff apart! 'Remember, measure life by the moments that take your breath away, not by how many breaths you take' Extreme Sports Cafe | ESC's blog | scratt's blog | @thescratt |
quote |
Selfish Heathen
Join Date: May 2004
Location: Zone of Pain
|
Hey, if you want me to crash Safari, I'll just go stroll through the OpenDarwin Bugzilla reports for WebKit...
|
quote |
Veteran Member
|
|
quote |
Selfish Heathen
Join Date: May 2004
Location: Zone of Pain
|
Okay, try this in the "official" Safari 2.0.2, not the nightly builds:
http://www.project-think.com/crash/ Click the link on that page. Sometimes it works on the first try; sometimes it takes ten or twenty tries. Just be glad I'm in a good mood and am not integrating that into AppleNova's templates just to spite you, scratt. The quality of this board depends on the quality of the posts. The only way to guarantee thoughtful, informative discussion is to write thoughtful, informative posts. AppleNova is not a real-time chat forum. You have time to compose messages and edit them before and after posting. |
quote |
Veteran Member
|
I cannot believe I am sitting here trying to crash Safari, and what's more not being able to!
I have clicked on that 100 times now and it won't crash.. Just pops the window up and it dissapears again.. over and over.. Is this a wind-up? Or should it really crash. (Yes I am using the "official' Safari 2.0.2" ) 'Remember, measure life by the moments that take your breath away, not by how many breaths you take' Extreme Sports Cafe | ESC's blog | scratt's blog | @thescratt |
quote |
Selfish Heathen
Join Date: May 2004
Location: Zone of Pain
|
Well, it worked on both my Macs.
|
quote |
Veteran Member
|
Quote:
EDIT: I tell you what though (and everyone please take note of this) if I suddenly dissapear from applenova someone get Brad for me, because it just occurred to me this could be selectively attached to applenova based on the user....... It would be quite a good way to passively ban someone! Just make their browser crash (if it worked - Brad!) each time they log in! 'Remember, measure life by the moments that take your breath away, not by how many breaths you take' Extreme Sports Cafe | ESC's blog | scratt's blog | @thescratt |
|
quote |
Selfish Heathen
Join Date: May 2004
Location: Zone of Pain
|
Rather, my Macs are more reliable and predicable than yours.
|
quote |
Veteran Member
|
Quote:
'Remember, measure life by the moments that take your breath away, not by how many breaths you take' Extreme Sports Cafe | ESC's blog | scratt's blog | @thescratt |
|
quote |
Less than Stellar Member
|
This thread wins the award for Most Words Ever Written. My head hurts (and I didn't even read all of it).
|
quote |
Veteran Member
Join Date: May 2004
|
Y'know, I'm not even going to get into this one.
dahacouk, I think you have an excellent future in software project management. "Sloppy programmers!" |
quote |
New Member
Join Date: Nov 2005
|
Quote:
And, by the way, I do "have excellent future in software project management", thanks! ;-) Cheers Daniel Last edited by dahacouk : 2005-11-10 at 03:50. Reason: Putting in quote marks! ;-) |
|
quote |
25 chars of wasted space.
|
Brad...has it ever occurred to you that your gf f——ks you for your mind?
Also dahacouk, like Brad said, programs are already broken into components (classes) most of the time. There are even ways to test these classes (UnitTesting is one method I believe...but I could be wrong, I'm not exactly a hard core programmer—I don't even use memory management) but it seems that even to peoples best efforts, the more complex something gets, inherently it will have more variables that you can't account for. |
quote |
Veteran Member
Join Date: Jun 2004
|
Quote:
|
|
quote |
Member
Join Date: Oct 2005
|
Occasionally crashing software is not neccessarily a result of bad programming--I'll randomly have my laptop violently crash on me; it's not as a result of bad programming but instead bad ram :P
|
quote |
Selfish Heathen
Join Date: May 2004
Location: Zone of Pain
|
Quote:
Quote:
Quote:
The quality of this board depends on the quality of the posts. The only way to guarantee thoughtful, informative discussion is to write thoughtful, informative posts. AppleNova is not a real-time chat forum. You have time to compose messages and edit them before and after posting. |
|||
quote |
Member
Join Date: Feb 2005
|
So anyone know what made BEOS so specail?
|
quote |
New Member
Join Date: Nov 2005
|
Quote:
|
|
quote |
Veteran Member
Join Date: May 2004
|
Quote:
Quote:
(And yes, I have a solution, it looks like.) |
||
quote |
New Member
Join Date: Nov 2005
|
Quote:
|
|
quote |
Veteran Member
Join Date: May 2004
|
BeOS was a from-scratch rethink of how an OS should work, and it was a beautiful product. It was pervasively multi-threaded, the filesystem was metadata aware and *rich* from Day 1, and it was basically the geek's wet dream when it came to the underlying technologies.
The frameworks were even pretty good, which for the day was surprising. But then, at some level, they dropped the ball and didn't offer much compelling for end-users. Rather like if Linux had been coded by design instead of grown. Too bad, really, it was a great system. NeXT was a much better choice for Apple though. |
quote |
Posting Rules | Navigation |
|
Thread Tools | |