theory

How would you access Object properties from within an object method?

What is the "purist" or "correct" way to access an object's properties from within an object method that is not a getter/setter method? I know that from outside of the object you should use a getter/setter, but from within would you just do: Java: String property = this.property; PHP: $property = $this->property; or would you do:...

Storing Images in DB - Yea or Nay?

So I'm using an app that stores images heavily in the DB. What's your outlook on this? I'm more of a type to store the location in the filesystem, than store it directly in the DB. What do you think are the pros/cons? ...

What is Turing Complete?

What does the expression Turing Complete means? Can you give a simple explanation, without going into too much theoretical details? ...

What is a lambda (function)?

Hey guys, I see this term being used a bit, and a Google search didn't quite yield the most clarity, so help me out: for a person without a comp-sci background, what is a lambda in the world of Computer Science? UPDATE: marxidad, thanks for the reply--it seems to be climbing up in everyone's favor, so I'll likely accept it soon. Do you...

What is the point of interfaces in PHP?

Interfaces allow you to create code which defines the methods of classes that implement it. You cannot however add any code to those methods. Abstract classes allow you to do the same thing, along with adding code to the method. Now if you can achieve the same goal with abstract classes, why do we even need the concept of interfaces?...

canonical problems list

Does anyone known of a a good reference for canonical CS problems? I'm thinking of things like "the sorting problem", "the bin packing problem", "the travailing salesman problem" and what not. edit: websites preferred ...

Coupling and cohesion

I'm trying to boil down the concepts of coupling and cohesion to a concise definition. Can someone give me a short and understandable explanation (shorter than the definitions on Wikipedia here and here)? How do they interact? Thanks. Anybody have a good, short example? ...

What is a DSL and where should I use it?

I'm hearing more and more about domain specific languages being thrown about and how they change the way you treat business logic, and I've seen Ayende's blog posts and things, but I've never really gotten exactly why I would take my business logic away from the methods and situations I'm using in my provider. If you've got some backgro...

Recommended resources for computer science theory.

When I return to university in December (I'm on an internship now), I'll be taking a course in Computer Science theory. However, I'm not a very theoretical person, and abstract concepts have been difficult. This course will cover topics such as regular, context-free and computable (recursive) languages with finite state machines, pushdo...

How to test randomness (case in point - Shuffling)

First off, this question is ripped out from this question. I did it because I think this part is bigger than a sub-part of a longer question. If it offends, please pardon me. Assume that you have a algorithm that generates randomness. Now how do you test it? Or to be more direct - Assume you have an algorithm that shuffles a deck of car...

Proving correctness of multithread algorithms

Multithread algorithms are notably hard to design/debug/prove. Dekker's algorithm is a prime example of how hard it can be to design a correct synchronized algorithm. Tanenbaum's Modern operating systems is filled with examples in its IPC section. Does anyone have a good reference (books, articles) for this? Thanks! ...

Hierarchical Group Permissions Theory/Resources?

Does anyone know of some good resources related to setting up heirarchical user account systems? I'm currently setting one up and am struggling with some of the more complex logic (especially with determining permissions). I was hoping I might be able to find some resources to help me along. Some Background: I'm building a user account ...

How/When to abandon the use of Arrays in c#.net?

I've always been told that adding an element to an array happens like this: An empty copy of the array+1element is created and then the data from the original array is copied into it then the new data for the new element is then loaded If this is true, then using an array within a scenario that requires a lot of element act...

What is a y-combinator?

A y-combinator is a comp-sci concept from the "functional" side of things. Most programmers don't know much at all about them, if they've even heard about them. What is a y-combinator? How do they work? What are they good for? Are they useful in procedural languages? ...

Big-O for Eight Year Olds?

I'm asking more about what this means to my code. I understand the concepts mathematically, I just have a hard time wrapping my head around what they mean conceptually. For example, if one were to perform an O(1) operation on a data structure, I understand that the amount of operations it has to perform won't grow because there are mor...

How does Jan Willem Klop's "(L L L...)" Y combinator work?

I understand what a Y Combinator is (those who don't should go here), but I don't understand this example of a "novel" YC, from the Wikipedia page: Yk = (L L L L L L L L L L L L L L L L L L L L L L L L L L) where: L = λabcdefghijklmnopqstuvwxyzr. (r (t h i s i s a f i x e d p o i n t c o m b i n a t o r)) How does this work? ...

What's "P=NP?", and why is it such a famous question?

The question of whether P=NP is perhaps the most famous in all of Computer Science. What does it mean? And why is it so interesting? Oh, and for extra credit, please post a proof of the statement's truth or falsehood. :) ...

Did you apply computational complexity theory in real life?

I'm taking a course in computational complexity and have so far had an impression that it won't be of much help to a developer. I might be wrong but if you have gone down this path before, could you please provide an example of how the complexity theory helped you in your work? Tons of thanks. ...

"const correctness" in C#

I'm a heavy C++ user who dabbles in C# in his spare time. I'm also one of those const-correctness nazis and so not being able to do this easily in C# grates a little. The point of const-correctness is to be able to provide a view of an instance that can't be altered or deleted by the user. The compiler supports this by pointing out wh...

How to determine differences in two lists of data

This is an exercise for the CS guys to shine with the theory. Imagine you have 2 containers with elements. Folders, URLs, Files, Strings, it really doesn't matter. What is AN algorithm to calculate the added and the removed? Notice: If there are many ways to solve this problem, please post one per answer so it can be analysed and vote...