ponylang / ponylang-website

The ponylang.io website
http://www.ponylang.io
BSD 2-Clause "Simplified" License
66 stars 50 forks source link

Illustrate features of Pony with Code Samples #292

Open mfelsche opened 6 years ago

mfelsche commented 6 years ago

In this hackernews conversation: https://news.ycombinator.com/item?id=17195580 , lots of people demanded code examples on the website. They couldn't find any, even after clicking around.

I think it makes sense to give shallow first impression with some code example that highlights some of the strengths of pony and to provide some more examples on a separate page, centered around how to do common things in pony, people might be used to from other languages.

SeanTAllen commented 6 years ago

I disagree.

Is anyone going to use Pony because of those examples? Probably not. Will people decide not to use Pony because of those examples? Quite possibly.

People want many things. Whether those things are valuable or useful or not is a different story. If we have a valid reason for providing examples of how you do X in Pony then ok, but "people want to see code examples when briefly doing a pass by on HN" is not a good reason to me. There should be a reason for those example.

SeanTAllen commented 6 years ago

@mfelsche and I chatted a bit. I'm quite good with approaching this as "impression should someone have after a quick visit to the homepage" and working from there to figure out what in terms of text, code, images, videos etc should be there.

The key for me is having a goal besides "put some code on there". We should have a defined goal and figure out how to meet that goal via whatever means (including code).

mfelsche commented 6 years ago

The main goal i would like to pursue is to have the visitor of the website, especially newcomers to pony, be able to get a good first impression of the language and if they want lead them to other sites for further information (like the tutorial or the stdlib docs). Seeing the actual language as code example is not necessarily part of such a first expression, but it is something people are interested in, in general. And this desire is understandable as we are exhibiting a programming language here. The main interface to the language is writing it, so people have a legitimate interest in seeing what they might have to write to make certain things work or leverage certain properties of the Pony runtime...

So, to clarify, i don't want code examples for the sake of having them, but for the following reasons:

plietar commented 6 years ago

A central aspect that the front page should show off is actors. Most readers coming from other languages will not have used them before, and even people coming from eg Erlang have used a very different style. This is IMO what really differentiates Pony from other languages (maybe I'm biased, coming from Rust/C++).

But just having text explaining what actors are is not going to grab attention.

If we had a simple example (like two actors, just doing ping pong) that demonstrates how easy and intuitive actors are in Pony I think it would help a lot.

SeanTAllen commented 6 years ago

I agree with @plietar re: actors. I think something that shows actors is certainly part of it. Hello world while there is more than 1 actor is very non-obvious and wouldn't be a good idea in my mind. Ping/Pong might be good.

Ref caps are an integral part of Pony as well but, do we show them that early on? I think not. Or rather, we don't highlight them.

I think something like Ping/Pong with an explanation of what is going on could be good.

Showing code for the sake of syntax is in my mind, unimportant. If you are coming for to see the syntax, you aren't getting over the hump of reference capabilities. That's the wrong audience for us.

So, if you want things to highlight I think it should be:

safe concurrency via actors. that's the hard problem that pony is solving. its what needs to be emphasized. I'm not against code samples but they should be specifically to demonstrate what makes Pony different.

Its a serious investment in time to learn Pony. People need to be presented with a case for why they should do that.

SeanTAllen commented 6 years ago

One additional note, I'm worried that Ping/Pong wouldnt end up demonstrating enough. We might need something a bit more interesting. Find a good example that is accesible in terms of problem domain yet also demonstrates what we want could be hard.

It might require more than 1 example but a single example would be best in my mind. Perhaps something from examples in the repo.

thomastay commented 4 years ago

Reviving this old issue as I've been thinking about this too. I also disagree that code samples are that important, especially since syntax isn't Pony's strength.

I think it's most insightful to take a leaf from other languages' websites. Below, I will analyze some of the top rising languages in 2020:

Rust

https://www.rust-lang.org/

  1. Performance - Rust is blazingly fast and memory-efficient: with no runtime or garbage collector, it can power performance-critical services, run on embedded devices, and easily integrate with other languages.
  2. Reliability - Rust’s rich type system and ownership model guarantee memory-safety and thread-safety — enabling you to eliminate many classes of bugs at compile-time.
  3. Productivity - Rust has great documentation, a friendly compiler with useful error messages, and top-notch tooling — an integrated package manager and build tool, smart multi-editor support with auto-completion and type inspections, an auto-formatter, and more.

Comments

Notice that there are no code samples. There is just one line about the borrow checker. Nothing about syntax. Nothing about error handling. It's all about what Rust provides: a No GC language that happens to have a great type system. And more importantly, it's about the problem domains that Rust solves. They really neatly categorised them, which is nice as a developer.

Typescript

https://www.typescriptlang.org/

Comments

The Typescript page is less convincing for me than the Rust page, but I think Typescript is targeting a different group. Namely, engineering managers / architects who already know JS intimately, and are looking to upgrade their front end apps. To those people, they probably know why types are important, Typescript just has to convince them that it is stable enough to be adopted in their organization.

Again, there are no code samples. It's all about how stable Typescript is and how clean it is. I really doubt many will watch the video, but having a video there shows commitment! It shows that people like this language enough, that they made a whole video on this. (For those unaware, MS Build is a huge Microsoft conference, and to be featured there is a big deal; F# wasn't even featured in this year's MS Build and it's an older language than TS)

Go

I don't want to make it sound like I'm bashing code samples, so it's just nice that the next language I picked, Go, has a lot of code samples on their website: https://golang.org/

Comments

The Go website is minimalist, reflecting the developers' philosophy. Indeed, the Go language, Go tutorial all follow this design scheme of minimalism. For instance, the Go playground doesn't even have syntax highlighting.

More interestingly is the abundance of code samples. My guess is that Go can focus on this, since its syntax is so similar to C like languages that anyone with a programming background can understand most of it.

Very little is said about Go's strengths, namely its easy concurrency handling, its huge standard library, and its minimalist syntax.

Overall, a nice contrast from the marketing-heavy websites above.

snark: It's kinda funny that Rust and Go both use basically the same tagline...

Dart

https://dart.dev/

Comments

The animation is super smooth, they really hired good designers for this. IMHO, I think this website is designed to convince people to use Dart. The target audience is mobile app developers who have never heard of Dart, who probably won't use Dart right now, but might in the future. That's why there is very little focus on getting Dart installed on their computers.

The focus is on convincing you, the reader, that Dart is a good language that you might consider for your next hobby project, and hopefully later on, your next company project.

This reflects Dart's position - It's definitely not as big as Kotlin / Swift / Typescript for mobile app dev (TS thanks to React Native). So, it has to compete by focusing on impressing new devs, even those who probably won't download your language.

will add more

damon-kwok commented 4 years ago

@mfelsche Is this what you want? nim crystal elixir

@SeanTAllen We can open a discussion topic in zulip and collect the most representative code of pony. It must have the characteristics of pony and the most spiritual representative. I think it's good if it is up to expectations. When I first logged in to ponylang.io, I was actually very eager to see this.

SeanTAllen commented 4 years ago

@damon-kwok I will argue against all those as a waste of space.