19
hobblin
3y

One of the most infuriating ideas in software development culture is that you can build maintainable applications without a strictly enforced type system and structured data.

Sure, it's more fun to wack around a dynamically typed system until it works or to write a major application with mutable datastructures... It's a least fun until a few years in and you have to debug an unexpected overwrite or a inconsistent use of an object property or whatever.

Anyone who writes maintainable code eventually figures out that you need rules and procedures, the issue with JavaScript, python, ruby, lisp, etc developers is that they think it's us developers that needs to enforce these rules instead of the compiler (which is infinitely better at it).

Comments
  • 5
    This is not a discussion. Any application that is bigger than you and me will fail given time without a rigorous type system.
    The thing I like about Typescript most is that you can opt out. In the case you use that power very wisely you can ignore where the type system causes problems but you know what you are doing.
    If you have some self discipline its the perfect match between a eloquent type system and DX.
    I am freelancing on a fullstack JS project and its like building a house with unprocessed rocks instead of bricks.
  • 4
    @Crismon yeah, self discipline is the lie here. Self discipline doesn't scale.
  • 5
    @hobblin Indeed. Developers should be left with bare minimum number of rules to certainly follow, and leave everything else in care of automated tools.
  • 3
    this is the thing I have been bitching about. A sane type system and functional approach. Watch my other rants, and the plebs coming to protect their jobs.
  • 4
    Yes! Yes, my friend!
  • 3
    @hobblin I think it does. Take a code guideline, peer reviews who give a fuck and a strict TS compiler and you are set.
    Dont leave broken windows and trust your colleagues. Of cause anything that can be automated should be. I just wanted to say that you can get the benefits that JS provides and there are many but still build big stable FE & BE applications with it as TS. You just have to want to leave the type system better than you found it and not throw „any“ or bad type castings on anything red.
  • 4
    @Crismon why yes, I think that's what he meant: don't trust one's self-discipline, it's a trap 🤥
  • 3
    @vintprox don't trust hoomans. It's a trap!
  • 4
    @Crismon i get what you mean, in my experience it does not work out as soon as you have any amount of new developers being on boarded and start loosing the old ones.
  • 1
    Shhhh, let the whole node react cominity think they actually CAN make maintanable apps.

    Spoiler : no, they can't.
  • 1
    @NoToJavaScript Typescript, --strict.
  • 2
    @homo-lorens

    It only fixes a part of the problem. (Using it in a current app and moving to abandon it too)

    First, it’s fucking slow (The compile part, there are solution to make it better tho, like don’t put everything in public).

    Second, the notation obj[“prop”] is still valid, even with strict (never tested my self) I think.

    I’m all team Blazor now. C# with 0 lines of JavaScript. And the ONLY JS in app should be auto generated and not even committed to git.

    I’m pretty sure other frameworks will catch up fast.
  • 2
    @NoToJavaScript obj['prop'] is only valid if 'prop' is a known key of obj.

    const k: string
    obj[k]

    is only valid if obj is defined to be { [P in string]: ... } or synonymously Record<string, ...>
  • 0
    @homo-lorens Ok, good to know, so --strict adds that check.
  • 1
    @NoToJavaScript C# suggests to fall back to dictionaries of preferably simple types if you don't know the exact set. With Typescript's conditionals and property expressions it's much easier to express complex conditions, which would be an uncheckable runtime null reference in C#. Oh, and Typescript is null safe. It forces you to null check if you define the variable to be a type to which you can assign null or undefined.
  • 2
    @homo-lorens

    Not any more.

    We now have switch on types and conditional checkings.

    Like check this line (From current project, wrote like 5 days ago) :

    if (line.FormatParams is {Length: > 0})

    It does not matter what type FormatParams is (line was checked for null before) , as long as it has length property.
  • 1
  • 0
    @NoToJavaScript That's really cool, I should check out C# again. And yeah, TS without --strict is more like a typo detector, with it it's a statically typed null safe language with more powerful type descriptions than I've ever seen.
  • 2
    @homo-lorens

    Oh you should check c# 10 (Coming in about 7 month)

    No more name spaces (well, sotty, no more wasting 1 tab/4space each line for a namespace)
    Global usings
    Properties with auto generated backing field
    And more

    No, I’m not being paied by Microsoft, I just find they will FINALLY get it almost perfect with c# 10. Ok, records are still fuzzy and difficult to use, but it will come
  • 0
    @homo-lorens

    Here, one more example
  • 0
  • 1
    Entire software industry is doing a disservice to itself, by trying to hire low cheap skilled devs to someone who writes maintainable code.

    When everyone creating the mess leaves, they can't replace easily. Nobody wants to maintain your horrible codebase, you fucking company, get over it.
  • 0
    @jassole capitalism
  • 1
    @iiii not really. Just cheap bastards.
    Thankfully capitalism also pushes these companies out of competition in favour of someone more innovative.
  • 1
    @jassole yes actually. Capitalism (as is practiced) thrive on those willing to make short term profit and then pivot. Long term investments and/or companies that are profitable over long time (>15 years) are the exceptions, not the norm. A majority of business focus on becoming profitable year by year.

    This is the process that makes the cyberpunk dystopic mega corps way too likely btw 🤷‍♂️
  • 0
    And logically, if you need to make a profit this year you can't really focus too much on building something to be maintainable in 10 years.
  • 0
    @jassole they will be alive as long as they do a cheap and "good enough" appearance for the customer. That's how capitalism works nowadays.
  • 0
    @hobblin we are already in cyberpunk, dude 😄
  • 0
    @iiii cyberpunk-adjecent more like it 😜 i think there are still ways for the situation to become worse...
  • 0
    @hobblin it can be worse, but cuberpunk was not about "the worst case" as well
  • 1
    You are not telling me communism, socialism is the solution?

    Companies need to focus on both long term and short term.

    Middle managers are the problem as their incentive structures are focused on short term gains.
  • 1
    @jassole I don't think anyone is suggesting a solution. If we go with the capitalist ideal of governing by incentive rather than enforcing a mindset then what we need is to reward long term success or make short term cashgrabs unprofitable. This is inherently difficult because users and investors will flock to anything new and shiny and you don't need anything besides users and investors to make profit.
  • 1
    @homo-lorens and that is fine. What we need is companies to be allowed to fail. Be bankrupt. Do shit work = bankrupt
  • 1
    @jassole Are we really going to allow a decade to filter out unsustainable companies for each individual market?
  • 1
    @homo-lorens I am libertarian believing in free markets. As you soon as you start to dictate how you reward others, and police it you become the new asshole
  • 0
    @jassole libertarianism actually results in rich becoming richer and owning everything.
  • 1
    @iiii Not true. Some rich people become richer, and then they start influencing the government and bend the rules to their favour, lobbying (Corporate capitalism, this is the problem).

    Don't confuse the idea of libertarianism. It is simple at its core. Free markets, free society, government functions to only provide judiciary, uphold rights. Not influence markets, capital flows.
  • 0
    @jassole free market is exactly what causes rich to get richer while robbing everyone else.
  • 1
    @iiii no you are convoluting different things. Free markets simply means ability to fulfil a demand with supply without restrictions in exchange for something. You have the freedom not to buy if you don't like what someone else is selling.

    Simple market dynamics.
  • 1
    @jassole So your flavor of libertarianism considers consumers supporting small businesses despite subideal deals an appropriate strategy to put an end to the wealth accumulation that is a natural property of all free markets?
  • 0
    @jassole and that free and unrestricted dynamics devolves into rich being the sole owners of everything. It's fancy and rainbowy only verbally but further analysis and empirical simulations show that it's not a utopia but quite an opposite.

    In a free market strong eats weak. Regulations of the market are there exactly to prevent that.

    And if you wanna have a live example: USA. The most free market in the world. Dominated by big corps.
  • 1
    @homo-lorens only if they make good product. If they make shitty product for high price, no use to me.
  • 1
    @iiii Whatever, nobody is forcing nobody to buy their goods. If they won fairly, they won. You need brains and efficiency to be better than them. You can't blame the game.
  • 1
    The moment you force me to use a shitty product just for the sake of business alive, thats no different than communism to me. I don't want to live that country.
  • 2
    @jassole "you are a slave fair and square. Just deal with it"
  • 1
    @jassole libertarianism always means the person with the, proverbial, biggest gun owning the land you stand on. It's fundamentally a pay to play game and if you can't pay you don't deserve to participate.

    Late game libertarianism means that it's either taken over by fascists who use the ideals to avoid being criticized or that it's taken over by feudal lord's who in everything but name owns their workers.

    Please look at your political view from a historical view and rethink it!
  • 1
    @iiii Thats you small mind, producing useless thing nobody wants. And then bitching and moaning about not a fair game and a handout.
  • 1
    @hobblin I take it you are probably from US. US is not a centre of the world. Whatever shit US produces or associates it with, its not the truth.
  • 1
    @jassole that's how your anarchy market works and how it will end. Society has laws exactly because anarchy does not fucking work. And economy is not different.
  • 1
    @iiii Imagine using a product of free market, and complaining about it. Your example of government controlled market:
    Housing subsidies -> Biggest financial crisis in 2008
    Federally backed student loans -> More indebted students now crying out to cancel out loans lol.

    If it were competitive from the start, you would never had this problem. Government distorts market.
  • 0
    @jassole if you were competitive everything would have been even worse.
  • 0
    @jassole what do you base that assumption on? (It's very wrong but it would be interesting to know why you would think it would work to dismiss my perspective)
  • 1
    @jassole the free market only works if you fully incorporate the fact that people who can't afford something has no right to it. That's why libertarianism is fundamentally opposed to human rights 🤷‍♂️

    Personally I believe that every human being should have the right to housing, sustenance and education. That is the only way for humans to be actually free.
  • 1
    @hobblin under a capitalistic and competitive market, You would have contractors trying to provide the best service for a cheaper price.

    What is currently happening right now, is government thinks it knows market best and is giving handouts to construction industry, which is one reason you have high property prices in the western world.

    Same with telecommunications industry, their lobbying of government barricades other competition from participating in the market. You have associated entirety of free market to be bad, because you associate the monopolistic behaviour with capitalism.

    Think of Elon musk. If he didn't receive any money, he would have not done SpaceX and let alone make Tesla cars. The vehicle/oil industry was very much against him, that is monopolistic behaviour not true capitalism.

    Mandating market policies never works and any such society has ended badly and favoured capitalism. Hong kong, Russia, Korea to name a few.
  • 1
    I have lived through half my life in the third world under different government (king monarchy, communism, but never a capitalist society), and migrated to a western country about 15 years ago now and there are endless opportunities for me.

    But some reasons locals always complain about not having opportunity in the land of opportunity, whereas I pretty much started from scratch, supported myself through uni working different odd jobs.

    Trust me neither you or I would want to go back, lol. If you want to know what slavery really means you should probably. Your hard work is meaningless there. You will enjoy it because "Kumbaya" and everybody is so much nicer outside US.
  • 1
    But spare me the bullshit about capitalism resulting in slavery.
  • 1
    @jassole it's funny how you don't realize that capitalism is creating its own nobility and a pseudo-feudal society even as you claim that is not what you want to get back to.

    The important thing to remember when defending "free markets" is that musk didn't do shit, he got colonial blood money from his family that he invested in others businesses, and in some cases he bought him self a "founder" status but he isn't the brain behind neither Tesla nor space x. His contributions is mostly money and PR. If anything he did was about creating a superior product he would be out on the streets.
  • 1
    @hobblin Oh, CEO is so easy just throw just "colonial" money at random engineers and it works viola. This is the most retarded comment I have seen here. Bahahaha, lol. I am outta here. Got a startup to build, so I can create slaves ofcourse according to you.
  • 3
    @jassole wielding a title and actually performing valuable work isn't necessarily correlated and if you can't figure that out I'm sure people will just love working for your enterprise 👌
    Have fun and just ping me whenever you're interested in talking about all the topics in this discussion that you just ignored... Those where actually the important ones 😉
Add Comment