Questions tagged [theory]

Theoretical question deal with topics that do not generally have immediate practical uses. Please be careful when using this tag: your question may be more appropriate for the Computer Science Stack Exchange site.

Filter by
Sorted by
Tagged with
131 votes
11 answers
33k views

How has an increase in the complexity of systems affected successive generations of programmers?

As a "new" programmer (I first wrote a line of code in 2009), I've noticed it's relatively easy to create a program that exhibits quite complex elements today with things like .NET framework for ...
Adam 's user avatar
  • 1,387
85 votes
11 answers
8k views

How can I make sure that I'm actually learning how to program rather than simply learning the details of a language? [closed]

I often hear that a real programmer can easily learn any language within a week. Languages are just tools for getting things done, I'm told. Programming is the ultimate skill that must be learned and ...
Ryan's user avatar
  • 1,261
80 votes
4 answers
21k views

What is the purpose of a Code Review

I am in the process of trying to sell my organisation on the value of code reviews. I have worked at several places where they were employed. I have seen them used to nitpick styling choices, and ...
SoylentGray's user avatar
  • 3,063
73 votes
9 answers
33k views

Why not expose a primary key

In my education I have been told that it is a flawed idea to expose actual primary keys (not only DB keys, but all primary accessors) to the user. I always thought it to be a security problem (...
Angelo Fuchs's user avatar
  • 1,096
68 votes
9 answers
23k views

What is the meaning of the 90/10 rule of program optimization?

According to Wikipedia, the 90 / 10 rule of program optimization states that “90% of a program execution time is spent in executing 10% of the code” (see the second paragraph here). I really don't ...
Rakshith Ravi's user avatar
64 votes
22 answers
7k views

Why do some programmers think there is a contrast between theory and practice? [closed]

Comparing software engineering with civil engineering, I was surprised to observe a different way of thinking: any civil engineer knows that if you want to build a small hut in the garden you can just ...
58 votes
8 answers
9k views

Are events only used for GUI programming?

Are events only used for GUI programming? How do you handle in normal backend programming when something happens to this other thing?
user3093620's user avatar
58 votes
8 answers
7k views

How can we be certain that the lower components of computer programming like compilers, assemblers, machine instructions, etc. are flawless?

Since we are becoming more and more reliant on computing, including very critical tasks of day-to-day life, I was just wondering how those vital components are tested. More technically, how are the ...
Sudip Bhandari's user avatar
54 votes
3 answers
17k views

What's the difference between a subclass and a subtype?

The highest rated answer to this question about the Liskov Substitution Principle takes pains to distinguish between the terms subtype and subclass. It also makes the point that some languages ...
tel's user avatar
  • 569
32 votes
11 answers
34k views

How does the "Fourth Dimension" work with arrays?

Abstract: So, as I understand it (although I have a very limited understanding), there are three dimensions that we (usually) work with physically: The 1st would be represented by a line. The 2nd ...
Questionmark's user avatar
29 votes
7 answers
16k views

How can lossless compression ever exist?

If all data is essentially just a bit string, then all data can be represented as a number. Because a compression algorithm, c(x), must reduce or keep the same length of the input, then the compressed ...
Mercury's user avatar
  • 465
28 votes
18 answers
2k views

What is the one bit of computer science theory I should know? [closed]

Speaking as someone with an Electronic Engineering rather than Computer Science degree, what is the one bit of computer science I should know to make me a better real world programmer? (By real world ...
Jon Hopkins's user avatar
  • 22.8k
28 votes
4 answers
16k views

Is colon in python blocks technically necesary?

This is really just a theoretical question by a python newbie who wants to understand more. I keep forgetting the colon after the block initial statements in python. Those are what I mean: for <...
Tomáš Zato's user avatar
28 votes
9 answers
31k views

Color schemes generation - theory and algorithms [closed]

I will be generating charts and diagrams and I am looking for some theory on color schemes and algorithm examples. Example questions: How to generate complementary or analogous colors? How to ...
daniel.sedlacek's user avatar
26 votes
6 answers
17k views

How often do CPUs make calculation errors?

In Dijkstra's Notes on Structured Programming he talks a lot about the provability of computer programs as abstract entities. As a corollary, he remarks how testing isn't enough. E.g., he points out ...
veryfoolish's user avatar
25 votes
7 answers
6k views

Ninety-ninety rule in practice

The first 90 percent of the code accounts for the first 90 percent of the development time. The remaining 10 percent of the code accounts for the other 90 percent of the development time. — ...
Josip Ivic's user avatar
  • 1,637
25 votes
8 answers
6k views

What non-theoretical, practical programming language has no reserved keywords?

I have been searching for a practical programming language that has no reserved keywords but I haven't had any luck finding one. I am working on a programming language for my own edification and ...
user avatar
23 votes
4 answers
5k views

Is a memory of all possible permutations of a kilobyte block and pointers possible?

This is a hard enough idea to wrap my head around and I would greatly appreciate any edits/help to get it more readable for those in-the-know. Is it theoretically possible to have a hard drive that ...
Amagii Discordus Penndragon's user avatar
17 votes
6 answers
3k views

What is an example of a computationally impossible business problem?

I have coworker who refuses to accept the reality that Turing machines (and Von Neuman machines by extension) cannot solve their own halting problem stating: You can do anything with enough time ...
Jesan Fafon's user avatar
16 votes
4 answers
4k views

Why does Cem Kaner consider a test not revealing a bug a waste of time?

What about confirming the functionality in positive tests, proving it is working - should I say it is a waste of time? What kind of concept is behind this quote? Unsuccessful tests, i.e. tests that ...
John V's user avatar
  • 4,928
15 votes
5 answers
6k views

Algorithm refresher. Why is heapsort an insort algorithm?

I can not see why the heapsort is considered an inplace sorting algorithm. I mean an extra data structure populated with the elements of the array to be sorted i.e. a heap, is used to assist in the ...
user10326's user avatar
  • 1,830
14 votes
9 answers
4k views

Theoretically bug-free programs

I have read lot of articles which state that code can't be bug-free, and they are talking about these theorems: Halting problem Gödel's incompleteness theorem Rice's theorem Actually Rice's theorem ...
user2443423's user avatar
14 votes
6 answers
4k views

How to recover from finite-state-machine breakdown?

My question may seems very scientific but I think it's a common problem and seasoned developers and programmers hopefully will have some advice to avoid the problem I mention in title. Btw., what I ...
Earl Grey's user avatar
  • 628
14 votes
5 answers
3k views

Are there any formalized/mathematical theories of software testing?

Googling "software testing theory" only seems to give theories in the soft sense of the word; I have not been able to find anything that would classify as a theory in the mathematical, information ...
Erik Kaplun's user avatar
13 votes
9 answers
3k views

Isn't class scope purely for organization? [duplicate]

Isn't scope just a way to organize classes, preventing outside code from accessing certain things you don't want accessed? More specifically, is there any functional gain to having public, protected, ...
Qix - MONICA WAS MISTREATED's user avatar
11 votes
4 answers
698 views

Should I build a fully featured application or a bare bones one and then slowly add features?

I work in a manufacturing plant that has tasked IT with creating a shop floor scheduling program (that is very badly needed). Based on others experience, would it be better to take less time and build ...
Kyle Vancamp's user avatar
11 votes
2 answers
2k views

Functional programming, compared to the process of a computer [duplicate]

In functional programming, it is considered bad practice (at least from my observations) to use state changes. Since computers operate in an imperative-language-like matter (performing one operation ...
sneelhorses's user avatar
11 votes
2 answers
14k views

Which code is better for branch prediction optimization?

Given branch prediction, and also the effect of compiler optimizations, which code tends to offer superior performance? Note that bRareExceptionPresent represents an uncommon condition. It is not the ...
dyasta's user avatar
  • 213
11 votes
3 answers
2k views

More code = more bugs

Back in college I remember a professor teaching the class one of the laws of computer science. He said something like "More code equals more bugs" and gave it a name (The Law Of Whatchamacallit) and ...
Jeff's user avatar
  • 327
10 votes
9 answers
3k views

What is an immutable object anyway?

The most popular answer is - it is an object whose state does not change after creation. What does it actually mean? My understanding is that any method call on the object should give the same result. ...
kan's user avatar
  • 402
10 votes
8 answers
9k views

Priority list of tasks stored in a database

I am trying to think of the best way to do the following: I have a list of tasks stored in the database. A task has a priority assigned to it. You can change the priority of a task to reorder the ...
Pete's user avatar
  • 109
9 votes
3 answers
2k views

Which aspect of normal forms do entity-attribute-value tables violate, if any?

I'm not asking if EAV tables are good or bad. I'm wondering if they are considered "normalized", and if not, why? If they aren't normalized, which normal form are they violating and why?
Mark Canlas's user avatar
  • 4,014
9 votes
7 answers
3k views

Is verification and validation part of testing process?

Based on many sources I do not believe the simple definition that aim of testing is to find as many bugs as possible - we test to ensure that it works or that it does not. E.g. followint are goals of ...
John V's user avatar
  • 4,928
9 votes
5 answers
3k views

Lexical Analysis without regular expressions

I've been looking at a few lexers in various higher level langauges (Python, PHP, Javascript among others) and they all seem to use regular expressions in one form or another. While I'm sure regex's ...
Blank's user avatar
  • 253
8 votes
9 answers
4k views

What is the aim of software testing? [closed]

Having read many books, there is a basic contradiction: Some say, "the goal of testing is to find bugs" while other say "the goal of the testing is to equalize the quality of the product", meaning ...
John V's user avatar
  • 4,928
8 votes
10 answers
12k views

Negative test cases confusion

In the Software testing book from Koirala, Sheihk, they say: A positive test is when you put in a valid input and expect some action to be completed in accordance with the specification. A ...
John V's user avatar
  • 4,928
8 votes
6 answers
2k views

performance versus reusability

How can I write functions that are reusable without sacrificing performance? I am repeatedly coming up against the situation where I want to write a function in a way that makes it reusable (e.g. it ...
Caltor's user avatar
  • 189
8 votes
1 answer
2k views

Exclusive upper bound in random number range

Why do languages' random number generators tend to return a value exclusive of the upper bound of the range? For example, an implicit range - JavaScript's random() method "Return a random number ...
John K's user avatar
  • 1,406
8 votes
1 answer
1k views

Why is the cyclomatic complexity equal to two for a simple Hello World?

I would have two questions related to cyclomatic complexity: Can I use this metric for a whole app? I guess I cannot, as it would be incredibly large number, considering functions calling functions ...
John V's user avatar
  • 4,928
7 votes
5 answers
15k views

Why does recursion return the first call in the stack and not the last?

I cant for the life of me figure out why this returns 0 rather than 5. i keeps getting incremented before it hits the last return statement, however it always returns 0, from the first call in the ...
NightSkyCode's user avatar
7 votes
2 answers
4k views

Cyclomatic complexity with two IFs - why it is 3?

I have read an article with following example: void func() { if (condition1) a = a + 1; if (condition2) a = a - 1; } It says the CC is 3 as there are three possible paths. How come? Why not 4? I ...
John V's user avatar
  • 4,928
7 votes
2 answers
744 views

How can I make sense of the word "Functor" from a semantic standpoint? [closed]

When facing new programming jargon words, I first try to reason about them from an semantic and etymological standpoint when possible (that is, when they aren't obscure acronyms). For instance, you ...
guillaume31's user avatar
  • 8,573
7 votes
4 answers
1k views

Are a class's methods a type of closure?

Per MDN A closure is a special kind of object that combines two things: a function, and the environment in which that function was created. The environment consists of any local variables that were ...
tt9's user avatar
  • 621
7 votes
1 answer
2k views

Understanding the DIP, DI, IoC theory

For about 2 months I've been reading everything I can find for these 3 topics and I'm not yet sure I got it. Dependency Inversion Principle. Means you should always only rely on interfaces and not on ...
Andrey Agibalov's user avatar
7 votes
7 answers
3k views

I have a hard time explaining what I learn [duplicate]

Possible Duplicates: How do you share your craft with non programmers? https://softwareengineering.stackexchange.com/questions/1985/how-to-explain-programming-to-a-non-programmer https://...
Bean's user avatar
  • 71
7 votes
1 answer
389 views

Mapping multiple differing taxonomies to each other

At work we have a varied number of websites selling second-hand products. The bosses have noticed that there's often some overlap between the products sold on some of the websites and would like to ...
Pseudonymous's user avatar
6 votes
2 answers
1k views

What is the logic in the order of operator precedence? [closed]

Absolutely academic context question- I found countless articles listing the order of operator precedence in all languages, but what is the logical reasoning behind that specific order? For clarity ...
Benson's user avatar
  • 79
6 votes
4 answers
734 views

What is the correct definition of Moore's law

I see different sources that say the number of transistors will double every 24 months or every 18 months. Does anyone have a credible source?
user194076's user avatar
6 votes
3 answers
11k views

Why is the "period of a (pseudo)random number generator" important?

I've been trying to understand (pseudo)random number generator code from various sources and the concept of the period continues to elude me. To satisfy the minimum level of understanding, I've tried ...
Rich Wermske's user avatar
6 votes
5 answers
2k views

What negative consequences can arise from this language design rule?

Clarification: the rule is meant to prevent accessing variables that are not declared yet. Clarification 2: the rule mandates that the compiler follows calls to functions which are defined in the ...
jcora's user avatar
  • 1,481