Hot answers tagged

174

it just isn't necessary because of the increased amount of processing power and memory available. Having cheap memory, enormous disks and fast processors isn't the only thing that has freed people from the need to obsess over every byte and cycle. Compilers are now far, far better than humans at producing highly optimized code when it matters. Moreover, ...


106

Nope. They're really handy for implementing Observers and making sure that classes are closed to modification. Let's say we have a method that registers new users. public void Register(user) { db.Save(user); } Then someone decides that an email should be sent. We could do this: public void Register(user) { db.Save(user); emailClient.Send(...


105

You can't be certain, but you just assume they are, until you discover they are not. There have been plenty of bugs in compilers and hardware over the years. The way these are tested, for example a compiler, is that they are very narrowly and rigidly defined, carefully written, then tested with an enormous test suite to verify correctness. Add to that the ...


96

Don't worry about meeting some ridiculous concept of "skill" so commonly heard in such statements like: All programming languages are basically the same. Once you pick up one language well you can pick up any other language quickly and easily. Languages are just tools, there's some overarching brain-magic that actually makes the software. These statements ...


91

There are 28192 possible different 1K blocks. Storing them all would take 28202 bits of storage. Since the universe contains only about 1080 (or ~2266) particles, it's a safe bet that it isn't possible to store them all, and you don't have to wonder about whether it would save time or not. But there is, in fact a more interesting way of answering this. You ...


77

Fortunately, programs aren't limited by the physical constraints of the real world. Arrays aren't stored in physical space, so the number of dimensions of the array doesn't matter. They are flattened out into linear memory. For example, a single dimensional array with two elements might be laid out as: (0) (1) A 2x2 dimensional array might then be: (0,0) (...


76

There are multiple reasons why you would want to conduct a code review: Education of other developers. Ensure that everyone sees the modification associated with a defect fix or enhancement so that they can understand the rest of the software. This is especially useful when people are working on components that need to be integrated or on complex systems ...


61

I think the main difference is that with civil engineering, real world physics act as a constant, powerful reality check that keeps theory sane and also limits bad practices, whereas in software engineering there is no equally strong force to keep impractical ivory tower concepts as well as shoddy workmanship in check. Many programmers have had bad ...


53

Nope. A classic example of events being used in non-GUI logic are database triggers. Triggers are code that gets executed when a given event happen (INSERT,DELETE, etc). Seems like an event to me. This is the Wikipedia definition of event: In computing, an event is an action or occurrence recognized by software that may be handled by the software. ...


53

Subtyping is a form of type polymorphism in which a subtype is a datatype that is related to another datatype (the supertype) by some notion of substitutability, meaning that program elements, typically subroutines or functions, written to operate on elements of the supertype can also operate on elements of the subtype. If S is a subtype of T, the ...


51

Code Reviews are a tool for knowledge transfer. When developers review each other's code, they gain familiarity across all areas of the system. This reduces a project's bus factor, and makes developers more efficient when having to do maintenance on a part of the system they didn't write. When a junior programmer reviews a senior's code, the junior ...


50

I had ideas on this subject, and I put them into a book 20 years ago. It's long out of print, but you can still get used copies on Amazon. One simple answer to your question is as old as Aristotle: Nature abhors a vacuum. As much as machines have gotten faster and bigger, software has gotten slower and bigger. To be more constructive, what I proposed was ...


49

You don't need to imagine in high spatial dimensions, just think of it as a fern leaf. The main stalk is your first array, with each branch being an item that it is storing. If we look at a branch this is your second dimension. It has a similar structure of smaller branches coming of it representing its data. These in turn have their own small branches ...


46

The dimensions are whatever you want to be, the 4th dimension doesn't necessarily have to be time. If you think of three dimensions as a cube, you can think of 4 dimensions as a row of cubes. 5 dimensions, a grid of cubes, and so on. You could also have a 3d collection of voxels, with a 4th dimension being color, or density, or some other property. When ...


46

In layman's terms: You cannot. Compilers and interpreters are unit-tested as any other (professional) software. A sucessful test doesn't mean a program is bug-free, it only means no bugs were detected. A wide user base using the compiler during a long time is a pretty indicator of it having very few bugs, because users usually test cases the designers didn'...


40

Imagine it like this: When you start working on software you can write huge amounts of code in relatively short time. This new code can add huge amount of new functionality. The problem is that, often, that functionality is far from "done", there might be bugs, small changes (small in business small) and so on. So the software might feel like it is almost ...


37

I wrote most of Testing Computer Software over 25 years ago. I've since pointed to several parts of the book that I consider outdated, or simply wrong. See http://www.kaner.com/pdfs/TheOngoingRevolution.pdf You can see more (current views, but without explicit pointers back to TCS) at my site for the Black Box Software Testing Course (videos and slides ...


36

Also, as my users have to access the data anyway I will need to have a public key for the outside world somewhere in between. Exactly. Take the stateless HTTP, who would otherwise not know what resource it should request: it exposes your question's ID 218306 in the URL. Perhaps you're actually wondering whether an exposed identifier may be predictable? ...


35

High-level abstraction is essential to achieving ongoing progress in computing. Why? Because humans can only hold so much knowledge in their heads at any given moment. Modern, large scale systems are only possible today because you can leverage such abstractions. Without those abstractions, software systems would simply collapse under their own weight. ...


29

Software engineering and civil engineering have little in common. Civil engineering efforts are limited by the physical properties of their materials and the environment. Civil engineers spend a lot of time learning about soil properties and material characteristics. Software development is physically limited only by the speed of the processors and the ...


29

You shouldn't expose it because people who see it will start to use it as their 'account number' which it is NOT. For example, for my bank account I know what my account number is. I've memorized it, I use it on the phone with customer service, I use it when filling out forms for other banks to do transfers, for legal documents, for my auto-pay service, ...


29

Experience definitely leads toward building something small and simple, and getting it to the users as early as possible. Add features and capabilities as they're requested by the users. Chances are very good (bordering on certain) that what they want/ask for won't resemble what you would have built on your own very much (if at all). As far as things ...


28

Event-based programming is actually also used for highly performant server programming. At a typical server workload, much of the time processing a result actually comes from I/O. For example, pulling data off a (7200 RPM) hard disk drive can take up to 8.3 ms. For a modern GHz processor, that would equate to ~1 million clock cycles. If a CPU were ...


27

A type, in the context that we are talking about here, is essentially a set of behavioral guarantees. A contract, if you will. Or, borrowing terminology from Smalltalk, a protocol. A class is a bundle of methods. It is a set of behavior implementations. Subtyping is a means of refining the protocol. Subclassing is a means of differential code re-use, i.e. ...


26

Because Primary Keys are an implementation detail. If you migrate databases, your primary keys might change due to order of insertion, removal of old records... a few different reasons. If you migrate database platforms you may no longer have an actual primary key at all. Exposing the PK above the data access layer is a leaky abstraction, with all of the ...


26

Imagine doing R&D on some new medical device, a series of sensors that you put along a patient's arms. You have seven volunteers lined up for testing. Each sensor reports low-frequency, mid-frequency, and high-frequency readings, which you take once every 100ms for about a minute. How to store all that data in memory for analysis and plotting? ...


24

Algorithms are a very central part of any kind of computation or computer program. In fact, computer programs are only a bunch of algorithms slapped together with some fancy structured data. That's it. Algorithms + Data Structures = Programs. A computer program consists of logical rules which it follows. Such rules are structured as algorithms. Rules alone ...


24

It's turtles all the way down. Nothing is certain. You have no choice but to settle on confidence ratings. You can think of it as a stack: Math > Physics > Hardware > Firmware > Operating System > Assembler/Compiler/etc At each level you have tests that you can perform to improve your confidence ratings. Some of these tests have the quality of formal ...


Only top voted, non community-wiki answers of a minimum length are eligible