11 karma · joined June 8, 2015
Regarding your other questions: Humans will build the machines that build the machines. In fact they do it now. Then we will build machines that can build machines based only on a design. That's the future.
The thing with the machines is a little bit different, but essentially it is much better to work from an office 2-4 hours a day, controlling a mining machine compared to actually mining.
Once a person can read there is almost no need for anyone else to teach him anything. I never listened in class, didn't have a notebook and got A's when I wanted to. I was reading the books that we were supposed to, but I prefered to explore them my way and I usually read them before it was needed. I know other people like me. I also know that people are curious in general and like to explore if given the opportunity.
And here comes my last answer - these people will do that because they want to see the result. Because they will enjoy doing it. And when they no longer find it interesting they will move on to something else. Because not doing anything is depressing. Doing it against your will - even more.
In the context of the article I/O is someone else's code. If it were my code it should be tested elsewhere, as if someone else wrote it. Not in every place that my application uses it.
In the particular case with writing the actual I/O code - I don't have enough experience, so I can't tell you. Maybe tests are absolutely necessary. Maybe mocks are the only way. I don't know.
What I do know is that programs transform input to output - input -> transformations -> output. You never care where the input comes from nor where the result of your transformations go. All you care is if your transformations are correct.
Your program may be very complex, with many inputs that you don't control, scattered around your logic. So prior to writing tests you have to decouple those dependencies from your logic and only then proceed with writing tests. If you are using functional language you may reduce every piece of logic to the simplest, smallest function possible, test it in the REPL, document it and move on without actually writing tests.
When things are decoupled refactoring is not that dangerous. If all pieces of your program are small, intelligible functions you can always just refactor a single, simple function and you should not need tests to rely on - all you have to do is make sure that this function is working like it worked before the refactoring (or better).
In OOP everything happens somewhere else because anything can hold a reference to the variable and change its value right under your nose.
To me at least these are two different concepts.
Then: Granted, proper factoring of your functions in the first place is going to help a lot. hence -> Once a function is ready you are not supposed to change it much. much not= at all.
And you are absolutely correct - eventually you will have to change some of your functions. And when you need to do so you should focus on the logic and take your time until you understand it completely. Only then refactor the funciton. So the emphasis should be on the developer completely understanding the task and not on the developer finding a cheap way to change the code and rely on tests to catch his errors.
Furthermore if you change the signature of a function, tests are just another place where you need to change the function as well. In practice the tests that you wrote are not doing you any good because you cannot test the reinvented function with the old set of tests.
Sure, tests might catch a few errors here and there at some point. But after all what is more time consuming - maintaining hundreds of thousands of tests or focusing on your single, small, composable function and your problem?
I am part of a team that develops a very large .NET (with C#) product with hundreds of projects in the solution. So far the primary use of tests is to be maintained. They caught a few bugs, true, but nothing that our QAs were not going to see anyway. In imperative OOP land tests are a necessary evil, but with time I started doubting even that thesis.
Btw in functional languages catching exceptions is not idiomatic, it breaks the functional approach.
In this example you are not supposed to test undoing the file. Undoing (deleting) is what I/O does and this part is tested by someone else, somewhere else. You only need to test the arguments that are passed to that specific I/O function. If they are correct your program is correct. If they are hardcoded you shouldn't be testing them at all.
You may want to write a log. Again, test what you are about to pass to an I/O function. Don't test if the file is actually written. If you supply the I/O function with the correct arguments and the function fails to write the file, the issue is not in your code - search for it elsewhere.
I suppose you will be migrating to Haskell because it is a PF language. What would you miss most from Clojure once you migrate?
With that said I will root for Clojure + ClojureScript. One could theoretically build a framework much more advanced than Meteor, on the same code-sharing principles.
Furthermore side effects have nothing to do with testing one's code. Why? Because you have to test your own logic, not I/O or something else. I/O is already tested by someone else. So you actually don't care where the data comes from - the filesystem or a hardcoded string - you care if the output is correct after the respective transformations are applied to the input.
And when you think about it testing shouldn't be that needed at all. In the OOP world, where state and identity are helplessly tied together and we are not working with values, but with references to values, tests might be a necessary evil.
In the land of Functional however writing tests shouldn't be needed, at least in theory. Why? Because if you write small composable functions you should be able to test them right in the REPL. Corner cases? You have to think about them right from the start. TDD forces you to do so - then why shouldn't you when you have the immense power of a REPL? Once a function is ready you are not supposed to change it much. If you do you should change the inner workings and not the input/output. If you need to change the i/o most probably you need a different function. But what is more important is that if you needed to change the i/o and had tests for this function you would actually need to change the tests as well, which is more work (double? triple?) and no added value.
That being said I have found a few people that may be ready to walk with me. Since I am very grateful I am willing to wait for them and help them whenever they need it.
I really didn't understand how this works. I know that now I work a lot. But I wasn't like that when I was younger. Nevertheless it was always me that had to keep a relationship going. If I didn't do anything things faded away pretty quickly. If I did the relationship agonized for a while before ceasing.
I know that I am not unpleasant - people don't talk with someone for hours just to be polite. And only one person has ever told me that she always hated me because of how annoyingly smart I was. But then again I went to university where one of my fears was that someone is smarter than I am (and probably a lot of folks actually were).
When not at work most people relax with a game of cards, small talk about repairing the car, the new update for the phone, etc. What I do for fun when I am not programming is read about consciousness studies, biology and nutrition, philosophy, physics. If the person is up for it we can talk for hours on such a topic. But most people most of the time are not. I have two kids and I like talking about them - kids are fascinating and incredibly funny at the same time. However people who don't have kids don't have a clue what I am talking about (I was the same when I didn't have kids). People who have kids usually just want a beer. I like running, hiking, riding a bike - good topics for a conversation. Until I say that it's fun to ride a bike at night, while it's raining.
So I was at lunch with my colleagues one day and it suddenly hit me - the problem is not that I am smarter or a genius or the like. It would be nice, but actually most of my colleagues are as smart as I am and some of them are smarter. The problem is that I cope with pain and hurdles differently. When people stop to rest I usually push some more. When they seek a shelter from the rain I want to ride more. When they need to chat with someone I need to read a book. I am a hyperactive introvert with a strange set of interests. I am a little different and because of that it's much harder for me to make friends.
You say that you have started so many projects. To me this means that you have a lot of energy and it's quite possible that people just don't want to play catch up with you – it’s tiring for them and they may actually prefer to just relax.