r/AskComputerScience • • Jul 31 '19

What needs to be completely recreated?

If turning a piece of hardware off an on again makes it perform better and swiftlier, wouldn't writing a piece of software from scratch in a higher level language with better lower integration and more robust compilation accomplish the same?

Even if you disagree with the analogy above, what do you think, in the world of computer science, would be vastly improved if were remade?

35 Upvotes

26 comments sorted by

26

u/gibson1027 Jul 31 '19

Medical devices by far. There are a large number of medical devices on the market that could have rewritten or integrated IOT technology for patients/physicians to use that would take the guess work out of alot of parts. Before anyone says anything I know there are a ton of devices like this but I'd love to see more. Good pertinent data,despite there being alot, can help the future of medicine.

Simple example would be a simple chip integration into a hearing aid that detects battery and can run a simple diagnostic of failing parts.

Also the entire pornhub website because running such a useful site with php anywhere near it might as well be a warcrime.

9

u/smm_h Jul 31 '19

Could you elaborate on the shortcomings of PHP?

11

u/oparisy Jul 31 '19

Beating a dead horse here, but... https://whydoesitsuck.com/why-does-php-suck/

6

u/not-just-yeti Jul 31 '19 edited Jul 31 '19

Or, more technically/detailed, phpsadness.com. The original PHP author has some notable quotes about programming.


But in fairness, PHP became successful because it did provide great convenience for two things (both very common, esp. in web):

  1. If you need a program whose output includes huge amounts of static text (w/ bits of computated-results sprinkled in), php is great -- anything not inside <?php…?> is a literal-print.

  2. being able to splice variables into strings easily ("string interpolation").

...Even so, both of these features were implemented poorly. But people have picked up on the good kernels.

  • #1 is done ad hoc by many web frameworks, and in a uniform way by racket's "@-expressions". It is super-useful when part of a decent (non-PHP) language!

  • #2 is also common in web-frameworks, and has been delightfully taken into the language-level by python's f-strings (and, it falls out for free as a special-case of those racket @-expressions).

4

u/oparisy Jul 31 '19

Thanks, interesting site and analysis.

Clickable link: http://phpsadness.com/

0

u/[deleted] Aug 01 '19

[deleted]

1

u/not-just-yeti Aug 01 '19 edited Aug 05 '19

Hadn't seen Razor before, nor looked into React; thanks for those leads.

As far as I can tell, React (well really, JSX) does what I want, but not Razor: in particular, not just escape from html-literal-mode into code-mode ... but inside code-mode I want to be able to escape back into html-literal-mode? That's what PHP lacks (though it lets you include "php fragments", as in example).

  • PHP: This is a <?php if ($isWeekday) ?>busy<?php else {?>nice<?php }?> day. (yuck!)

  • Racket @F{This is a @if[is-weekday? @F{busy} @F{nice}] day.}

^(so long as you also ⟮define F values⟯)

  • python F"This is a {F'busy' if isWeekday else F'nice'} day".

In all cases, the busy and nice can further escape into arbitrary code with nested @ or F" or <?php -- that's the key. [Except python doesn't quite get it right -- you have to switch quote-marks, so with ", ', """, ''' you can only nest 4 levels deep, sigh. I hadn't realized that, before writing this response. I guess you can effectively nest deeper by breaking down your code into smaller parts and using storing them in variables.]

Also, by ad hoc, I meant w/o explaining at all! that this works for C#-when-run-under-.asp. But can you use it when writing non-web-programs, and distribute the compiled executable to others (like python f-strings)? And can you write a file using Razor, and link it with other C# code?

I'd say JSX and racket @-expressions allow this, and f-strings get honorable-mention, since they are fully language-integrated, if frustratingly shy of what we want.

…okay, I'll stop procrastinating and get back to proper work. Thanks for those leads I hadn't known about!

2

u/MrZer Jul 31 '19

Interesting read. So are there new alternatives popping up?

0

u/dr_avenger Jul 31 '19

The article was written in 2014. Around 60% of that article is stale content. And just rants from 2014. Also, consistency. Lo and behold.

For array functions $needle come as first argument. For string functions $haystack come as first argument.

Also try to watch https://youtu.be/wCZ5TJCBWMg

6

u/AaronFriel Jul 31 '19

Here is a long, but technically detailed and very amusing essay, PHP: A Fractal of Bad Design. Here's a quote:

I can’t even say what’s wrong with PHP, because— okay. Imagine you have uh, a toolbox. A set of tools. Looks okay, standard stuff in there.

You pull out a screwdriver, and you see it’s one of those weird tri-headed things. Okay, well, that’s not very useful to you, but you guess it comes in handy sometimes.

You pull out the hammer, but to your dismay, it has the claw part on both sides. Still serviceable though, I mean, you can hit nails with the middle of the head holding it sideways.

You pull out the pliers, but they don’t have those serrated surfaces; it’s flat and smooth. That’s less useful, but it still turns bolts well enough, so whatever.

And on you go. Everything in the box is kind of weird and quirky, but maybe not enough to make it completely worthless. And there’s no clear problem with the set as a whole; it still has all the tools.

Now imagine you meet millions of carpenters using this toolbox who tell you “well hey what’s the problem with these tools? They’re all I’ve ever used and they work fine!” And the carpenters show you the houses they’ve built, where every room is a pentagon and the roof is upside-down. And you knock on the front door and it just collapses inwards and they all yell at you for breaking their door.

That’s what’s wrong with PHP.

4

u/NihilistDandy Jul 31 '19

I worked for a hospital, and holy shit no! At least if the devices I reviewed are what we should expect. A bunch of proprietary code farted into a RPi with somehow less than zero security considerations is not something I want more of.

I highly agree with you that the concept is good, but we need to work out the security horror show that is IoT before I want anyone's lives depending on it.

2

u/zninjamonkey Jul 31 '19

Simple example would be a simple chip integration into a hearing aid that detects battery and can run a simple diagnostic of failing parts.

I think starkey is working on this.

6

u/Matt-ayo Jul 31 '19 edited Jul 31 '19

2

u/smm_h Jul 31 '19

Thank you for this.

4

u/claytonkb Jul 31 '19

Hardware is not deterministic, software (more or less) is.

That aside, as I grow older, the more I see the "QWERTY effect" in everything around us, even "bad" technologies. I hate browsers and I hate phone apps. They're badly architected from top to bottom. But my life really is smoother and easier because of them. So, if I could flip a switch and make them disappear (but not the knowledge of how to re-write them, better this time), I would not flip it.

I am increasingly convinced that Machine Learning is going to help us fix a lot of the boo-boos of history. A bad interface can be fixed with a glue layer consisting of a good interface that is trained using ML to make the appropriate calls to the bad interface. Fixing bad interfaces now becomes a much lower-cost proposition -- it is merely the GPU-hours rented from AWS instead of thousands of hours of human sweat spent toiling over every off-by-one error in a hand-crafted piece of code.

Of course, re-wrapping a library in a new API has a performance cost but this, too, can be remedied with the help of ML. Simply throw the entire library into an ML-based, automatic code-optimization tool (the kind of tool I'm thinking of doesn't exist yet) and let it optimize the original library based on real-world patterns of calls to the new, clean API. Now, imagine wrapping multiple libraries together and repeating this process to create a bundled library with a fresh, clean API. Then bundle this into yet other libraries, and so on and so forth. I believe something like this is the path we will walk as we transition to Software 2.0.

5

u/smm_h Jul 31 '19

I hate browsers and I hate phone apps. They're badly architected from top to bottom.

Could not agree more.

...increasingly convinced that Machine Learning...

Could you point me in the direction of the information you've been reading/hearing that led you to believe in it more? Because so far I have absolutely zero faith in ML. It's just wrong. It's... very very wrong.

A bad interface can be fixed with a glue layer consisting of a good interface that is trained using ML to make the appropriate calls to the bad interface.

Do you realize how many interfaces there are? Probably ten more were born since I started writing this comment. A neural network would require thousands of datapoints to semi-acceptably learn a pattern. This would never fly. Maybe for a few specific, popular interfaces but not more.

a fresh, clean API

This is the dream. I believe this too but you have to realize, not all sw run on API. Many lower level, more fundamental and actually way bigger pieces of sw such as OS kernels, accelerator libraries, hardware layers, etc. use an ABI instead of an API which is not as abstract.

12

u/Steve132 Jul 31 '19

OpenSSL

Email

http

Ip4 (though they tried)

The C++ ABI

5

u/james41235 Aug 01 '19

By Ip4 do you mean IPv4, being replaced by IPv6? Or some language/product I don't know?

1

u/b3nthegod Aug 01 '19

The former.

1

u/james41235 Aug 01 '19

What do you mean "they tried"?

19

u/[deleted] Jul 31 '19

JavaScript. Currently it's the work of the Devil.

7

u/m-chrzan Aug 01 '19

Honestly, the current ECMA standards make it a really nice high level scripting language. Of course, the old cruft has to remain for backwards compatibility reasons, but with a good linter configuration it's actually enjoyable to write in. And gets even better when you use TypeScript.

6

u/HasFiveVowels Aug 01 '19 edited Aug 01 '19

Yea, I've noticed that my brother's peers (college aged) are now using python like crazy. I think this is in no small part due to the javascript hate that's pervaded the internet for these past few years. It's trendy to hate javascript. It's like.. congrats, you know python - you can... run statistical analysis? Javascript is honestly a great language, especially for async programming, with a wide range of potential applications. I've been programming for about 20 years now - 10 professionally - and I've learned tons of languages. Javascript's my favorite (TypeScript, technically). (inb4 someone links the "wat" video)

0

u/[deleted] Aug 01 '19

[deleted]

1

u/HasFiveVowels Aug 02 '19

What exactly would the deployment of that look like, though? They'd include both interpreters in browsers for a while? We'd have to wait until pretty much every browser has the v++ interpreter before starting to use it. I suppose engines like Node could use it ahead of time.

4

u/phyzyk Aug 01 '19

Python documentation == hellscape of half-cocked, incomplete thoughts

And Python standard libraries. I still don't know how a language designer can deprecate half of an existing library and tell people to use the new library for the updated functions, but force them to use the old library for supported functions that they have no intention of migrating.

2

u/beeskness420 Jul 31 '19

Operating Systems like Linux. One of the biggest barriers to adopting new approaches is backwards compatibility with existing systems.

No one will want to use your OS if it can’t compete with modern OSs out the gate.