“On undoing, fixing, or removing commits in git” is a web page which guides you when Git doesn’t do as you want to.
An app which outlines a friend in a crowd (restaurant, concert) plus giving directions if he’s too far away when we want to meet.
When confronted with surveillance the usual reply is “nothing to hide.”
This answer is wrong. Let me tell you a story.
For over one hundred years, the city of Amsterdam had a census. They know your gender, relation ship status, number of children, parents, where you lived. All this information was used to make life better for everyone. And it worked. People were happy. The city government was efficient. It could base decisions on statistics and data instead of gut feelings. They were the first ones to use computers to efficiently store and handle the data.
May 10, 1940, the Nazis took the city. Suddenly, one bit of information – faith – decided over life and death. The Nazis took the data which had been collected and efficiently rounded up all the people they wanted to murder.
Surveillance is not about what you have to hide, it’s about how you can be hurt. It’s the question how much someone hiding in a faceless organization wants to ruin with your life.
Characters that you need to be able to distinguish clearly:
0O – Zero and upper case o
l1I – Lower case L, one, upper case i
Z2 – Upper case z and two
S5 – Upper case s and five
G6 – Upper case g and six
B8 – Upper case b and eight
71 – seven and one
lI – Lower case L, upper case i
vy – lower case v and lower case y
Just copy and paste into your favorite code editor.
Fonts you should try:
A man stumbles our of a bar with his friend. They are both very drunk. Laughing, they cross the street and approach a long row of cars parked on the curb. In the next scene, one of them is talking to two police officers.
«Had a lot?»
The man fumbles with his car keys. «Yup. Stay away from me, no alcohol on shift!»
The police officers laugh and watch the man crawl into his car which is parked on a long row of cars at the side of the street. The man starts to sing “Home sweet home, take me home.”
Further down the street, his friend tries to get into another car. The police officers look at each other.
«Had a lot?» they ask the second man.
«What? Oh, well, no … not … that … mush.»
The police officers arrest him. He struggles: «Leave me alone! What are you doing? Why arrest me and let my friend go?» While they put handcuffs on him, the first car moves silently out on the street.
Just as it vanished behind a truck, the police offers drag the struggling man along the front of the track.
For a long moment, the truck blocks the view.
The camera slowly moves along the truck until you can see along its front.
The light of the car on the street illuminate the legs of the men. The light is moving and so is the car.
The driver can be seen laughing and dancing in his car, apparently neither of his hands is on the wheel.
His car is slowly stopping. The police drag the man over the street. The car moves on, takes a turn.
Black screen with message: Driver-less cars makes drinking more fun for you and everyone.
From my series “The Next Best Thing“:
Often, you will find yourself in a debugger, trying to follow some insanely complicated code to find the root cause of a bug.
I would like to see a button in my IDE which reads “New Test Case”. It should example the current program state, determine (with my help) what part of the code I want to test and then copy the current state into a unit test. In a second step, I could then trim down the unit tests but I would have all the input, all necessary dependencies would be there, correctly initialized.
It would also be great if the IDE would track the state of the code from which the unit test was generated. If the code changes too much (indicating that the unit test might become outdated), I’d like to see that. Or maybe the IDE could figure out by itself when code tested in such a way deviates “too much.”
Along the same lines, the IDE should be able to inject probes into the product code. As I click buttons and enter data in the UI, the IDE should generate a series of unit tests under the hood as described here. If you’re using frameworks like Spring, the tests should come with minimal (or mocked) dependencies.
Google asks to “Just Say No to More End-to-End Tests” – just go and read it.
The suggestion in the document is to have a testing pyramid. A few (slow, expensive, dangerous) End-to-End (E2E) tests, more integration tests (IT) and a whole lot of unit tests.
My approach is to aim for 100% unit tests by breaking down the E2E and integration tests into chains of unit tests.
Example: You want to test whether you can save a UI field in a database.
The naive approach would be to create the UI, create a DB, simulate user input, click the save button, check the data in the database, update the UI afterwards.
My approach is to cut this into individual steps and use the output of test X as input for X+1. For unit tests, output is always a constant, so this doesn’t create dependencies between the tests except for the fact that some are the logical next steps. Tests can still be executed in any order.
But back to the example. The first set of tests would put various values in the UI, simulating user input. The tests would just read the values from the fields and compare them against expected values.
The next set of tests would be for the input validation. These tests would reuse some of the “expected output” values from the previous tests. No UI would be necessary (the code to test the display of validation messages would be in another set). We’re only interested in “do we get the correct error for input value FOO” where FOO is a constant.
The input validation tests can be grouped into two sets: One where the input value passes the validation and another (probably a much bigger) where the validation fails.
For all the inputs where the validation succeeds, we write a test that writes this value (again taken from a constant) into the database.
Lastly, to update the UI, we write a set of tests which examine the state of the database. And another set which tests that a certain state appears correctly in the UI.
As you can see, at no time we have a runtime dependency of tests. Tests work in any order. If the output of one test changes, only a small number of tests need to be updated (if at all). The IDE will help you locate all tests which are connected.
Instead of using the constant directly in an assert inside of a test, you can refer to it from an annotation. Now you can write tests that make sure that an output value is also used as an input somewhere.
If a test fails, only a single test fails. If the validation changes and a value isn’t valid anymore, the DB test might still pass. This is good: We don’t want code to fail unless it’s really broken. The DB interface might be able to write “illegal” values into the database but the validation layer is responsible to catch them. Don’t mix responsibilities.
In E2E or integration tests, a single failure somewhere in the whole chain of operations breaks the whole test. With the approach outlined above, a single failure just breaks very few tests. Each test still runs only a small number of code lines, making it easier to locate the cause of the problem. Tests are fast, you can run tests for a subset of the chain – why test the database when you’re improving validation? Or start the whole UI? You can run fast tests all the time and mark slow ones (UI, DB) for “run only on CI server“.