4 ms·
I admit that I struggled with regular languages, I didn't fail the class or anything, but as soon as I was done with it, never looked back. I thought about doi
by atum47 6y ago
I admit that I struggled with regular languages, I didn't fail the class or anything, but as soon as I was done with it, never looked back.
I thought about doing a Turing machine in JavaScript but I never actually did it.
I wonder if people that retains all that information use it everyday, that's why they retain it. Thing I don't use in real life, like propositional logic, regular languages, automatas... I can barely remember. It's kinda sad thought, but I fill I cannot dedicate time and resources to keep this things fresh in my head.
- gnusty_gnurc 6y agothis is my major complaint with interviewing "it's so easy, you just have to study it"
- kevmo314 6y agoBut despite not using it every day, you'd probably be able to refresh on it pretty quickly. I've found that to be the real value for a lot of the courses I took. Sure, I don't actively remember the content or use it daily, but occasionally something reminds me of something I learned. Then, it's a quick wiki page away from me understanding and using it. Contrast that with some devs I've worked with who haven't seen such things before and end up reinventing a less elegant solution to the problem.
- atum47 6y agoon the interview for the job I have right now, they asked me a lot about design patterns. I took a class on that and implemented a lot of them in Java. Factory, Facade, Visitor, Singleton... Never used them again after college, ask me about it, I think I would be able to explain Factory and Singleton from the top of my head, the rest... gone!!! I guess what I'm trying to say is that I would love to be that guy with a lot of information in the head, that can casually drop statics formulas and math concepts in a conversation, but that's not the case for my. At least for a lot of topics. Watching the videos made me think about that. Starting a live video and answering 240 questions on several topics likes it's no big deal. Haha
- valuearb 6y agoYou never use a Factory or Singleton? That’s weird to me cause I use them daily. But certainly Singletons can also be problematic, especially if you do automated testing, which I do not.
- zelphirkalt 6y agoThat's probably because of the use of different paradigms. If you write typical so called OOP code all the time, sure, you'll hit many instances of this or that pattern coming in handy. If you write FP and only occasionally strew in some OOP, well, many of the patterns fly out of the window, as you do not really need then any longer, because the building block is a function and you solve most of the stuff using closures and higher order functions. Also you usually do not mutate state, so that is another load of patterns out of the window. Surely however, it is good to know the patterns approximately well, so that you can quickly understand the meaning of code, which makes use of them. If only all people used design patterns always in a correct way, instead of implementing them half-way correct and then using them in a weird way ... Never hurts too look up the details again, before introducing a pattern into the code!
- chopin 6y agoIf I can, I never use the classical singleton pattern because of testability. On the other hand I use one single instance of a class if I can make use of a dependency injection framework. I prefer that over static classes which have the bad habit of getting in the way of testing.
- btilly 6y agoThe use case for a Singleton is that you want to use a global variable but don't want to admit that you are using a global variable.
- AnimalMuppet 6y agoHere's an embedded system. It has a hardware resource. There's only one such hardware resource. A singleton to manage it is a natural. I suppose you could argue that it's still a global variable, but I think it's more fundamental than that. You use a singleton when there should be exactly one of something. Why is there exactly one? "Because there's only one in the hardware" is a fundamentally different answer than "because it's a global variable".
- bo1024 6y agoTeaching a course on it regularly would really help keep it fresh.
- atum47 6y agoI guess. I took a look at a test we have to take here in Brazil, if I want to get a master's degree. no way I can score high enough without studying for a few weeks. Calculus, statics, propositional logic... When looking at the test I thought "man, I learned this in college, I should know that" but my brain was like "forget that, let's watch something funny on youtube"
- tzs 6y agoI actually ended up spending some time thinking about Turing machines when trying to solve a LeetCode problem. I like to have a handful of problems that (1) have known solutions, (2) that I should be able to figure out in a reasonable time, (3) and that I should be able to make significant progress on entirely in my head. I then work on these when lying in bed trying to fall asleep, or when exercising, and similar times, and LeetCode is a good source for such problems. The problem was given an array of integers find the smallest positive integer that is not in the array, and do it in O(N) time and O(1) space. The O(1) space part was killing me. I just could not do it in less than O(N). I decided to spend a while trying to prove that it could not be done in O(1) space. Presumably that would fail, but maybe if I could figure out why it failed that would also suggest how to do it in O(1) space. And thus I ended up thinking about Turing machines and other models of computation. Except my attempts to prove it cannot be done on O(1) space seemed to succeed, so I was stumped. I spent a couple months on this stupid problem, before finally giving in and peeking at a solution. It turns out that on LeetCode you can modify input arrays. I'm not a barbarian so I had assumed that inputs were supposed to be immutable.