Subscribe to MentalFloss Minutes

## Blind Trust of Test Cases

There may come a point in your programming adventures where you are forced to write code against a set of tests which cannot be seen by you. This is most likely in an academic setting, since they don't want students coding to tests.

There may also come a point where you are shown to be passing all test cases of some particular tested feature,...

## Complex Logic And Matrices

So, let's say that you have some problem that involves pretty complex logic, and only two parameters. Instead of writing a bunch of if statements, you can construct an output matrix, and fetch the values that way. For an example, let's mix some paint.

We have our colors: Red, Yellow, Blue.
Red + Yellow = Orange
Red + Blue = Purple
Yellow...

## C++ Enum Flip Flop OR Junk Fields?

Disclaimer: This is probably bad code, but I came across this in trying to solve a problem, and I want to share. Feel free to offer suggestions for improvement.

`...`

## Logic Exploration

I want to talk a bit about the various ways of manipulating logic for potentially more readable code.

Let's consider a problem:

You are to test two fruits (APPLE, BANANA, LEMON, LIME) to report on them. There are two conditions:

• ...

## Big IF Or List?

Let's create a contrived example where the user has selected from an assortment of food. If the user selects a fruit, we want to say "Don't forget to eat your vegetables.", and if they select a vegetable, we'll say "Remember, an apple a day keeps the doctor away."

We might have some such enumeration:

`...`

## Know Your Requirements

From my experience in an academic setting, project requirements can often be poorly defined. It is up to you to take the initiative, and clarify every vague notion about the project. It's best to get it in writing via email (just like in the workplace), so that you can reference it in the event of miscommunication.

I recently had to implement...

## Loops

For this post we shall consider Java, but it will apply equally well to C++.

Knowing what loop to use for a given situation is an important skill. There are many options, and picking the right one can be confusing at first.

for(type var_name = value; condition; increment)...

## I/O Redirect Tutorial

You might be interested in reading https://www.dreaminc...75-io-redirect/ which explains the I/O redirect option available in developing text-based software (command line).

## Source Control

If you're developing projects, you should be using source control.

Now, people really push github, but I am a much bigger fan of bitbucket because you can have private repos for free. This isn't something github offers.

Plus, bitbucket (technically Atlassian) has a pretty awesome GUI for git called SoureTree. The OAuth is a little wacky,...

## C++ Set Exploration

This entry is just a slow walk through getting familiar with sets.

Compile:
`g++ -std=c++11 program.cc -o demo`

References:
http://www.cplusplus...erence/set/set/
http://www.cplusplus...ce/set/set/set/
http://www.cplusplus...ence/algorithm/

Getting Started

Let's just get started with some boilerplate:

`...`

• (3 Pages)
• 1
• 2
• 3

S M T W T F S
1
234567 8
9101112131415
16171819202122
23242526272829
3031