19
crafter
5y

Why do people like non typed languages like php or javascript? Besides from a giant pile of possible security problems what do you get out of it?

Comments
  • 13
    A giant pile of runtime-errors?!
  • 2
    @metamourge haha good point.
  • 6
    They're purpose-built for web development, and extremely well supported by the largest development community in the history of computing.
  • 3
    @bahua well in my opinion a giant community doesn't have to be a good thing.
    And also especially in Web development hard types would extremely help the security cause since its really easy to make a small mistake that can open your code to remote code execution and such fun.
  • 5
    With great power comes great responsibility.
  • 5
    Because that shit originated in the 90s when some undisciplined language cowboys thought they were much smarter hotshots than they really were so that they ditched types in favour of alleged write-time convenience.

    The result was tons of difficult to find bugs when people used that mistakenly, and performance degradation when they did it on purpose - looking at you, jQuery.
  • 1
    @vane thats very true but types errors are avoidable and especially for beginners its allot easyer not to have this traps to fall in.
  • 1
    @Fast-Nop That is a really god point. But why are people still defending this languages insted of building better solutions?

    I know backwards compatibility but the ie8 users will never change if everybody still wastes a shit tonne of work/time to support this crap.
  • 6
    @crafter New languages are invented and forgotten all the time. The problem is that "cool-language-of-the-day" doesn't cut it if there's no massive ecosystem AND libraries AND applications AND tools and a lot of other shit.

    In short, because the overall cost of switching to a "better" language would be much higher than the existing pain.

    Also, rewrite from scratch is a bad idea in most cases anyway. Devs like to think that this time, everything will be clean - yeah, but that's what people also thought when they created the shit we have now.
  • 2
    At first, ignorance. Then they cook up Typescript and suddenly, Javascript is like c++ again.
  • 1
    @crafter
    I can’t play music so should I be a musician and start playing in orchestra first day of my job or go to hospital and transplant heart first day of my job ? Let’s create 2 weeks boot camps for this shit, why not ?

    So tell me what’s wrong, learning system and greedy people or language I can personally use and like ?
  • 1
    @vane i dont say that you cant learn what you whant im just trying to understand why almost every modern programm is build on top of languages that have problems that can easily be avoided.

    For beginners its allot easyer to understand why a string cant be added to a number in a language that tells you whats wrong and doesent try to comply to everything you put in.
  • 1
    @crafter because it’s easier to teach someone who was raised with scrolling deviation who is constantly looking and laughing to small screen that he call “my precious”, teach someone with build in inability to focus on samples that show something instantly ( javascript and browsers ).

    Like it’s easier for people to watch video or listen to audiobook instead of read a book.

    If you need more people you need to lower your bar or pay more then others and that’s not infinite. Currently there is never ending demand for someone to write some shit so in my opinion world just lowered bar.

    If you want to digitize every interaction on this shitty planet you need loads of dumb fucks who will write dumb things and small group of smart ass who will provide them tools to do it.

    Here you have cloud, browsers etc.
  • 0
    Let’s go with my response further.

    You got bunch of highly specialized idiots who are pushing this shit hole further into the rabbit hole that someone named scientists and you need to somehow digitize their knowledge for future generations.

    They don’t like to write much and if they write something ( sometimes once in their lifetime) there are not much people who understand this. You can teach them what pseudocode is and they will use python just fine.

    If you’re not rich, healthy and young it’s not an easy place to live so get used to it.

    Peace.
  • 3
    Tbh I find OOP php with typehints and a nice framework/composer setup tolerable
  • 2
    There is a push for type safety though. Php7 can have a strict mode, though you have to enable it for each of your file. And typescript became as popular as it currently is by virtue of being typesafe (on runtime) superset of Javascript, that still produces valid Javascript.

    Was lack of typesafety ever a good thing? Oh hell no!
  • 2
    Your mom likes non typed languages.
  • 1
    nontyped is really useful for a lot of framework behavior like rails and Django. they have their uses, but type hints are a necessity in my opinion
  • 2
    @crafter Unless you start using one fully with that I do not think you might fully understand.

    Now don't get me wrong. I like type safety, but a LOT of time it equates to VERY VERY verbose code (think Java level verbosity).

    Is that a bad thing? Yes it is. Why? Because it makes it hard to comprehend for new guys on the project and other people which will work with your code which is the people for which you should be writing the code for.

    Here is an example:
    Lets say you have a function which handles events and event handler can be a string (which means some global handler from a list), a function from other class and an anonymous function, or a class handler.

    In strongly typed languages you need to write 4 overloaded functions possibly copying the same parts of the code, in weak typed this can be just one function where you check the type and do the thing to it.

    Now try to think other uses with this approach and then how hard it would be to use strong typed language for it.
  • 2
    IMHO the thing that made PHP and js so popular was their dynamic nature, which is very convenient for web dev.
    In the 90s you didn't have so much choice in terms of dynamic languages to choose from, in fact js was invented to run in the browser (Netscape). PHP (Personal Home Page) was also invented as a quick way to make html pages.
    From there I then agree with the comments that point to the large echosystem. It's true that in the meanwhile many options have emerged, but at the same time those two languages have had time to mature and now you have a very live echosystem that can support you.
    Then I totally agree that for any large project a lack of types is seriously inconvenient. And so we have typescript and php 7 (see 7.4!) which combine the benefitd of dynamic languages with types.
    In my code (nowadays 99.9% TS) I don't have any 'any' type whatsoever and honestly I don't feel I am writing anything less curated than what I'd be doing in C#
  • 1
    @vane so in essence your point is that all those apps running on JS are trivial to do? Interesting, I will apply to Google then, I'd love to be one of the dummies working on their web stack.
  • 1
    @josap no that’s what you understood from it.
  • 0
    @josap In a typed language, you wouldn't design such a function to take tons of different types. Instead, you would do the only sane thing and design stuff properly so that it is always the same type!
  • 1
    Way faster development times.
    Also, if you're not absolutely dumb, it's easy to avoid security and type issues that come with PHP. That requires that you properly learn it though, which many don't seem to do.
    Also, PHP7. Use it.
  • 1
    @PrivateGER Faster only initially and for the original dev. Once someone else comes in later, as is common in non-hobbyist dev, he has to pay back twice.

    That leaves quick&dirty throw-away code, which was exactly what PHP was meant to be when Lerdorf stitched that together without much thought.
  • 1
    Php 7 has types and php 7.4 basically turns it onto C#. ECMA has (AFAIK) confirmed that they want to incorporate TypeScript into vanilla.js at some point. So, what?
  • 1
    @arekxv Type safety doesn't have to be verbose. Java is very verbose and I hate it for it, yet as soon as type inference is a language feature, it becomes a blessing. Then they are as verbose as other languages are due to type hints.
Add Comment