118 points · by martinlaz · 6y ago · 66 comments
But for some reason, every f* new task is always first solved with some interpreted weakly typed scripting language, shell script or batch file, config file, xml programming, open source tool or web service. Unversioned, and with the weakest tool and team support imaginable. Probably a separate git repository with separate login credentials is created somewhere along the way as well.
Also, junior people will translate "code I will never be able to check in anyway" to "perfect opportunity to play around with that new language I want to learn" and then you've got them making the usual mistakes as noobs in that language.
Assuming you’re a C/Java shop, why not? You get to leverage all of your coworkers code to make that little CLI app. The whole thing will probably be “parse args and then call an existing method.”
Then that little tool is part of your app, callable wherever your app is, stored in Git, testable with your existing tools, etc.
And that's another big issue with Java. If you start out writing plain Java, people feel like they're missing out on all the "help" they'd get from a framework, and pretty soon you can't figure out how to make your code run at all except inside the framework. So you have to either write your scripts using the framework's CLI helper, which is probably some enormous abstract class that has its own argument parser you have to integrate with, or you start reverse engineering the framework's CLI helper to figure out which parts you need and end up running out of time and falling back to Python and swearing to figure it out someday. That's my experience, anyway.
But, Swi has my back on that, too:
https://www.swi-prolog.org/FAQ/PrologLAMP.txt
Can I replace a LAMP stack with SWI-Prolog?
Yes, you can, and you'll be happier for it.
LAMP is short for the following open source components to realise a web
server:
Linux
Apache
MySQL
PHP
In this picture, Linux provides the OS, Apache the web server, MySQL the
database and PHP server-side scripting facilities. In fact, most of these
components can be replaced. One can replace Linux with almost any other OS,
Apache with Nginx, MySQL with PostgreSQL. PHP is similar to ASP.
There are also larger replacements of this stack, such as Tomcat, which
replaces both Apache and PHP. Similar architectures are available for Python
(django), Ruby (Ruby on Rails) etc. As we will see below, this is the picture
into which SWI-Prolog fits.
The SWI-Prolog web framework
The SWI-Prolog web framework (obviously) does not replace the OS. It does
replace Apache, PHP and to some extent MySQL. We could refer to the stack as
LP (Linux Prolog). Below, we point at the various libraries that make up the
stack and relate them to the LAMP components they replace.
You can't quite replace html/css/js of course, since the browsers depend on them- but they can be embedded in Prolog easily. I believe the http library in my other comment here has facilities to do this.Also- if you ever need to write a parser for some topsy-turvy ad-hoc markup language some third-party is using that you are forced to process, Prolog is probably the best language to do this, thanks to its Definite Clause Grammars notation that's basically BNF, except that it's not restricted to context-free grammars:
Folks should not underestimate the benefits of having a single primary common language everywhere.
Indeed, that's why I'm getting past my static HTML comfort zone and trying out the SAFE template for F# development on both client and server via .NET Core. Super new at it, but excited to learn.
Apparently there is this thing out there called Fable that lets you use the same domain types on both client and server, now THAT sounds like fun to me.
Maybe it's a bug on your phone or the HN codebase?
-- Alan Kay
Direct your complaints to the source of your problem, namely the shitty browsers on mobile. Even suggesting to let HN fix their abysmal stylesheet would be wrong. Go to the source -- and if it turns out they don't care about requests to provide actual tools, tell them off.
Also, I hope I'm not rude to point out that I expect people interested in an article on Prolog to have a non-phone computer that they can read this more comfortably on.
Nice pun (not sure if intended).
Yes, you should use a relatively small toolset and use it well. Whether that toolset is prolog or JS or bash or whatever depends entirely on your needs and requirements and will vary from team to team.
If bash scripting meets your needs, then use bash scripting! There's nothing wrong with it. Likewise for clojure or C# or any other tool.
For small one-off tasks or simple services, your company should have a template for writing those in a good scripting language: Python, Ruby .. something you can write tests/specs for if it grows, that has a good amount of programmers you can hire, etc.
Your core service apps might be written in something different, that can scale up, whether that's a JVM lang (Java/Scala/Clojure/Kotlin) or a .NET (C#/VB.Net) or Elixir or Rust or whatever depends on a lot of things. You want to have something your core programmers enjoy writing in, but also something you can find new people for as your company expands. It can be a delicate balance. You can have multiple core languages (my current company is Node/React for most front end, React Native for apps, Clojure for almost all backend, some .NET and Python/Go/Terraform for all devops).
It's best to have a core tech stack with some choice than just let every team do anything in whatever. But of course, it's dependent on your company and market. Your mileage will vary.
I read a wonderful article some time ago (here maybe?) arguing exactly this, and positing that any language unsuitable for replacing every other language in a company is insufficiently powerful. As I recall, by 'language' the author meant every single computer language: shells, interpreted scripting languages, compiled languages, perhaps even markup languages.
IIRC, the author came from a Lisp background, which shouldn't really be surprising: so far as I am aware only Lisp and maybe Forth would do a decent job at all those tasks.
I don't care about extending most of my tooling, I just want it to work. I'm not going to spend years rewriting Terraform in Rust just because I don't use Go in my company.
Their point is software you actually develop in house. So that might be HCL code used by Terraform (in which case you might still need to use another tool or SDK in place of Terraform) but it wouldn't be Terraform itself (ie the Go code used to compile the Terraform executable).
I'm a systems guy in a Java shop. Ignoring obvious nonstarters like trying to shove Java into early Linux boot, this still implies I should be hiring Java programmers for systems engineers. Which, no, not only don't I care, doing that would select for a very small subset of available candidates.
A nice thought experiment, but not practical.
But also, a developer may not even write it if he or she feels pressured to do this.
Here's a thought experiment: say you're seeding data into your local database server using the `mysql` CLI.
- Would you write and check in shell script to do this, so coworkers can use it? Probably yes.
- Would you write a Python script to do this? Probably no.
- Would you write a Java or C program to do this? No way.
But they are time-consuming to write in mainstream languages, so developers often won't do it if that's their only choice.
For some weird value of 'It'. People went way overboard, but early Java really was as expressive as a stone mask.
https://www.swi-prolog.org/pldoc/doc_for?object=section(%27p...
And of course, a lot of support for the semantic web:
https://www.swi-prolog.org/web/index.txt
The entire Swi-Prolog website at https://www.swi-prolog.org/ runs on the Swi-Prolog web libraries - they call it "eating your own dog food":
Swi-Prolog really is an amazing ecosystem.
Michael Hendrick's "Production Prolog" talk gives a demo of this (at 12:17) https://www.youtube.com/watch?v=G_eYTctGZw8
https://en.wikipedia.org/wiki/Eating_your_own_dog_food
The first alternative phrase is hilarious to my German ears.
Seems to be Microsoft internal comms, 1988.
Accept: text/plain
Would be nice if it could provide either based on the Accept header.https://github.com/sumdog/assignments/tree/master/csc4240-pr...