re: The Maybe data type in JavaScript VIEW POST

Sloan, the sloth mascot Comment marked as low quality/non-constructive by the community View code of conduct

Oh man... When I see something like this... It really knocks out all of the fuses...
This is how you create a solution for a non-existent problem and over-complicate things without good reason. This is the typical abuse of OOP and shows what is the main problem with this paradigm. This is what happens when beginners totally misunderstand what is OOP for. This is the exact case of over-engineering. The kind of problem you try to solve was solved even 30-40 years ago inlanguages like Fortran, so I advise you to look into what those people did back in time and what they are doing since then instead of re-inventing the wheel especially this way that is worse than possible. There is nothing wrong to look into the history of this industry and learn from that like what happens in any other profession. Do not think that Javascript is the language that has the solution that people before never were able to solve. It is actually quite the opposite. If you want to solve in a "programming language" like Javascript if I can even call it like that then try to look into something more serious to understand the solution. I advise you to look into for example how this is handled in C, javascript actually mostly implemented in C and guess what they handle the division of zero situation somehow without even having OOP support, so look into that. I tell you a big secret the solution is not in creating a hierarchy of un-needed classes and object and then think oh what I nice OOP program, this is how you do things... In real life large systems actually it is a problem when you have a lot of un-needed code and classes plus objects and garbage like that especially just to handle what can be handled without them. People who create code like this need to spend a few years working on large real-life systems written in a serious compiled program language most preferably without OOP support and then they might start to understand the basics of real-life software development with a real use case. Other than that I can't argue that this is a working solution but there is a huge difference between the value of different solutions. I think 20 years ago, when program languages did not even have construct to create this kind of "solution" was a better era to learn somebody to think logically. What makes me particularly mad when I see something like this is that the industry nowadays are full of beginners who create code like this especially using "programming languages" like javascript. My advise is that if you want any reliable math in your code then start to use a program language... /and not a script language built-in a browser/ Or if you use this kind of embededd script language then try to think in terms of memory usage if you know how to do that, and then people might save re-booting their machine after opening a webpage full of javascript like the above as it eats up their 12 GB ram in a second... /also even if you do node then think about the memory in your server eaten up by your un-needed classes and objects../ It is true that the division by zero can not really handled in javascript nicely but this is the fault of the language itself, and you still have to handle it the way it is supported instead of creating these class hierarchy, It does not make anything better only worse... The big secret here is that division by zero must be handled by the language level using only what is supported by basic language constructs built-in into the language. Creating a hierarchy of classes to handle whatever is supported by the language differently is never a solution, you need to live with the fact that javascript is like this and instead of re-inventing the wheel and filling up the computer memory of the user's machine, start to look into other program languages and start to understand and gain experience in this industry and then one day you might be able to just go into the javascript interpreter's source code and build something nice into the language that handle problems in a better and resource efficient way and then if you have done that you might start to call yourself a developer.

code of conduct - report abuse