DEV Community

Meghan (she/her)
Meghan (she/her)

Posted on

Which programming language has the prettiest syntax?

Which programming languages do you never get tired of reading? Which designers nailed the readability factor?

Oldest comments (12)

Collapse
 
val_baca profile image
Valentin Baca

Python, Ruby, Go, and well-written C and SQL.

I like terse syntax, lots of syntactic sugar, and languages that just say what they're doing

I love love love that go has One Format Style. Done. I care about code style so much that I just don't want to deal with it anymore, if that makes any sense?

Collapse
 
eronaeon profile image
eronaeon

Javascript ES6+/Typescript

Collapse
 
ben profile image
Ben Halpern

I haven't found Typescript very pleasant to look at—though I haven't given it a lot of time.

Collapse
 
isaacdlyman profile image
Isaac Lyman

TypeScript struck me as pretty ugly at first, like a pile of metadata stapled onto JavaScript. But I've come around to it. And it offers a couple of features that really do make ES more readable and expressive, like enums and interfaces.

More generally, I think any language that you can express yourself in and have experience with will become "pretty" to you, as long as it doesn't actively frustrate you.

Thread Thread
 
gengns profile image
gengns

You can use the standard, JSDocs and type inference with your IDE to archive the same goal without compiling and adding extra code.

Collapse
 
defman profile image
Sergey Kislyakov

I find myself liking every language that's being used properly and well-written (formatting, etc.). Though my favorite is Ruby because of its syntax sugar things.

Collapse
 
dmerand profile image
Donald Merand • Edited

Elixir! It has a lot of the syntactical sugar from Ruby, which is very nice, but mainly I just love reading functions that look like:

def the_main_workflow(data, other_data) do
  data
  |> first_transformation
  |> now_spice_it_up_with(other_data)
  |> one_last_transformation
end
Collapse
 
ben profile image
Ben Halpern • Edited

I most appreciate Ruby when I have to spend large amounts of time reading basically any other language.

I like the Erlang thing where . ends the routine as if it were ending a sentence. Of course, dot-notation being so pervasive makes it kind of impractical. But if I were making a language from scratch I might consider that as a way to be more language-like.

Example:

f({connect,_,To,_,_} = Signal, To) ->
    ...;
f(Signal, To) ->
    ignore.
Collapse
 
kspeakman profile image
Kasey Speakman • Edited

Piet

This is a Piet program that prints "Piet".

piet source image

Collapse
 
nektro profile image
Meghan (she/her)

functional programming languages are very pretty. more recently I've been using Go a lot, which is very nice also

Collapse
 
_umairali_ profile image
Umair Ali ✳️

Given below is for loop syntax to ‘print 1 to 10 numbers’ in 4 different Programming languages:

1

JAVA for(int i=1;i<11;i++){ System.out.println(i);
}

2

Python for x in range(1,11):
print(x)

3

Kotlin for (i in 1..10) {
println(i)
}

4

Swift for i in 1...10 {
print(i)
}

You are required to calculate points of each language on the basis of the following aspects:

  1. Readability
  2. Reliability
  3. Cost/Programming effort You have total of 30 points for each language.10 points for each aspect based on your opinion. Scale: 1 point lowest and 10 highest
Collapse
 
dimer1275 profile image
Dimer1275

C#