Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

RANT: The pains of using a "green language" (Also some advice)

This a rant and a cry for help.

 

So somebody told me to learn a "Green language", i.e. the cool kids language. I chose Javascript, figuring that a lot of web stuff is being done there, and my front end is VERY weak.

 

The pains of learning javascript(from a guy doing java and c(and variations))

 

- No static typing: Why? Why? What pain does it cause you people to put write an int or double or string or char? Dynamic typing is really useful, but opens a can of worms. It is also quite dfficult to learn for someone usied to dynamic typing.

-Interpreted code: Compiled is faster, easier to debug(imo ofc) and just plain simpler. Why do you have to mess with dirty interpreters?

- Broken OOP: That's it. No other language apart from java and its subtypes have managed to get oop quite right.

 

 

 

Well, after the rant, you may be thinking me as the old man who hates new languages. Well, no. My point is that if you have been using an old language, it is easy to get frustrated. But after some time you will come to appreciate other languages. I really liked concurrency and the non broken frameworks for JS. The frameworks were a fresh breath of air for a java guy like me.

 

 

 

 

 

 

Link to post
Share on other sites

You could consider using TypeScript which adds support for static types and is transpiled to JS, so it is "backwards compatible" with browsers.

 

27 minutes ago, WolframaticAlpha said:

- Broken OOP: That's it. No other language apart from java and its subtypes have managed to get oop quite right.

I like Java, but imho they made some very boneheaded decisions (e.g. no generics in earlier versions). They did this to make the language "easier to learn", except now it is actually harder to learn because type erasure makes some things much more complex then they'd need to be.

Remember to quote or @mention others, so they are notified of your reply

Link to post
Share on other sites
1 hour ago, Eigenvektor said:

You could consider using TypeScript which adds support for static types and is transpiled to JS, so it is "backwards compatible" with browsers.

 

I like Java, but imho they made some very boneheaded decisions (e.g. no generics in earlier versions). They did this to make the language "easier to learn", except now it is actually harder to learn because type erasure makes some things much more complex then they'd need to be.

thank you

 

> I like Java, but imho they made some very boneheaded decisions (e.g. no generics in earlier versions). They did this to make the language "easier to learn", except now it is actually harder to learn because type erasure makes some things much more complex then they'd need to be.

Java isn't perfect, but has the slickest implementation of OOP

Link to post
Share on other sites

JavaScript is going to seem very strange coming from another language. Once you embrace its concepts it makes a lot more sense in the web context that it is used for.

 

Still, I find that it is still difficult to develop since debugging can be challenging because it's so asynchronous.

 

As far as static typing goes, just use TypeScript (already brought up, but worthy of another mention), which fixes a lot of this issue.

 

Also try to stick to the big three frameworks instead of something experimental that will be abandoned who knows when. Angular, Vue, or React only.

On 6/17/2021 at 5:21 AM, WolframaticAlpha said:

 

Java isn't perfect, but has the slickest implementation of OOP

Java's adherence to OOP means it also comes with its flaws, where you have silly things like strings being treated as first class objects instead of as a primitive type.

 

They did improve it considerably with collection streams (the Java equivalent of LINQ). Personally I don't know if there's a reason to choose it over C# unless you have to.

Link to post
Share on other sites
38 minutes ago, Sakuriru said:

JavaScript is going to seem very strange coming from another language. Once you embrace its concepts it makes a lot more sense in the web context that it is used for.

 

Still, I find that it is still difficult to develop since debugging can be challenging because it's so asynchronous.

 

As far as static typing goes, just use TypeScript (already brought up, but worthy of another mention), which fixes a lot of this issue.

 

Also try to stick to the big three frameworks instead of something experimental that will be abandoned who knows when. Angular, Vue, or React only.

Java's adherence to OOP means it also comes with its flaws, where you have silly things like strings being treated as first class objects instead of as a primitive type.

 

They did improve it considerably with collection streams (the Java equivalent of LINQ). Personally I don't know if there's a reason to choose it over C# unless you have to.

lol I thought that linq was the c# version of collection streams

Link to post
Share on other sites
17 minutes ago, WolframaticAlpha said:

lol I thought that linq was the c# version of collection streams

LINQ came out about 7 years earlier.

Link to post
Share on other sites
15 minutes ago, Sakuriru said:

LINQ came out about 7 years earlier.

Didn't know that. Thanks!

Link to post
Share on other sites
10 hours ago, Sakuriru said:

Java's adherence to OOP means it also comes with its flaws, where you have silly things like strings being treated as first class objects instead of as a primitive type.

 

What do you mean by Strings should be a primitive?

Did I get you wrong or what's the reasoning? Pure curiosity

Link to post
Share on other sites
13 hours ago, Hi P said:

 

What do you mean by Strings should be a primitive?

Did I get you wrong or what's the reasoning? Pure curiosity

A String is sort of like a mix between the two, and that's how C# handles it. Note that IsPrimitive will return false, but it is included in the System namespace. Additionally, in C# it's normally declared with "string" instead of "String", but they mean the same thing.

 

If you were to deal with strings in C, they're just pointers to an array of characters. This means of course, that they are actually reference types. This is why they're ultimately objects. However, in C#, they're treated as though they were a value type (i.e., primitive type). Doing firstString == secondString is a valid operation in C# that will compare two different strings to see if the characters are equal, for instance. However in Java this compares references (is the string in secondString reference the same area in the heap as firstString) and .equals is need to check if the values are equal. The C# compiler will go through and adjust the == to some equals method internally, but this is a point of major difference between the two.

Link to post
Share on other sites
On 6/18/2021 at 1:53 PM, Sakuriru said:

Still, I find that it is still difficult to develop since debugging can be challenging because it's so asynchronous.

This was the hardest part for me to get when i started my job as a nodeJS developer, now i just vscode + typescript + break points makes life so much easier.

                     ¸„»°'´¸„»°'´ Vorticalbox `'°«„¸`'°«„¸
`'°«„¸¸„»°'´¸„»°'´`'°«„¸Scientia Potentia est  ¸„»°'´`'°«„¸`'°«„¸¸„»°'´

Link to post
Share on other sites
On 6/19/2021 at 9:25 AM, Sakuriru said:

, in C#, they're treated as though they were a value type (i.e., primitive type). Doing firstString == secondString is a valid operation in C# that will compare two different strings to see if the characters are equal,

Yes it does that only for convenience as pointer compare for strings is very rarely what the dev wants. So it's simply an operator overload. Well in 30 years programming I never had a case where I needed to compare string pointers.

 

Don't forget C# does still check for reference pointer first on the String object and if they don't match only then compare by value for a second stage

Link to post
Share on other sites
Quote

No static typing

Agreed. I dislike dynamic typing, mostly because I make many typos and sythax errors and in case of vanilla js, it will happily just assume none existent/incompatible property to be the type 'undefined' and let the program continue executing.

 

Depending on the size of the project, I may need to wait until the application execute the buggy code before I can even figure out the issue. This is especially annoying if I have perform several steps to replicate the bugs like clicking on a dozen buttons and fill out dozens forms with certain datas. This is downright annoying. Runtime errors happened in static type languages too of course but never are they silly typed errors, either due to typos or you just assume the wrong type, because compiler check for you. Above all, the best features of static typing is that many IDE can read those types and auto-suggest/intellisense all the variables and methods/functions of an object plus all the comments so it is super awesome. In dynamic type, you either need to spend time to read the documentation or if you are like me, write shit tons of console.log or other forms of logging. IDE cant exactly get them for you because you won't know the actual type until runtime. this just sucks. 

 

Quote

Interpreted code

A language can be both compiled and interpreted . E.g.. Java is partially interpreted. I mean the .class files are java bytecodes which are interpreted. But then again, the byte codes are compiled from java source code so it runs through a compiler as well. This means a language can be both compiled and interpreted and if you want something similar for js, you have typescript. It's compiler, or rather transpiler, and does more or less the same thing as any other compiler. It will check silly type errors for you.

 

I disagree on the point about speed however. To me this is a none issue. In js, I have yet encounter a time in my years of coding, in which I find performance lacking outside of lengthy async request which has more to do with network speed and latency than the performance of an interpreter. 

 

Quote

Broken OOP

Many features of oop requires static typing. I mean what is the point of an interface, virtual/abstract class, virtual/abstract method etc if type is both dynamic and weak?

Everything is polymorphic in such cases. This defeats the entire purpose of having these things in the first place. This makes oop of ALL dynamic type language like python/php/js utterly broken. 

 

this can apply to static type language like c++, typescript, and c# as well if you use auto/any/var everywhere. Seriously, people should just get rid of these things. Java isn't broken because it doesn't have any of these(as far as I know, but no telling what they will do in future version of java).

Sudo make me a sandwich 

Link to post
Share on other sites
49 minutes ago, wasab said:

Agreed. I dislike dynamic typing, mostly because I make many typos and sythax errors and in case of vanilla js, it will happily just assume none existent/incompatible property to be the type 'undefined' and let the program continue executing.

 

Depending on the size of the project, I may need to wait until the application execute the buggy code before I can even figure out the issue. This is especially annoying if I have perform several steps to replicate the bugs like clicking on a dozen buttons and fill out dozens forms with certain datas. This is downright annoying. Runtime errors happened in static type languages too of course but never are they silly typed errors, either due to typos or you just assume the wrong type, because compiler check for you. Above all, the best features of static typing is that many IDE can read those types and auto-suggest/intellisense all the variables and methods/functions of an object plus all the comments so it is super awesome. In dynamic type, you either need to spend time to read the documentation or if you are like me, write shit tons of console.log or other forms of logging. IDE cant exactly get them for you because you won't know the actual type until runtime. this just sucks. 

 

A language can be both compiled and interpreted . E.g.. Java is partially interpreted. I mean the .class files are java bytecodes which are interpreted. But then again, the byte codes are compiled from java source code so it runs through a compiler as well. This means a language can be both compiled and interpreted and if you want something similar for js, you have typescript. It's compiler, or rather transpiler, and does more or less the same thing as any other compiler. It will check silly type errors for you.

 

I disagree on the point about speed however. To me this is a none issue. In js, I have yet encounter a time in my years of coding, in which I find performance lacking outside of lengthy async request which has more to do with network speed and latency than the performance of an interpreter. 

 

Many features of oop requires static typing. I mean what is the point of an interface, virtual/abstract class, virtual/abstract method etc if type is both dynamic and weak?

Everything is polymorphic in such cases. This defeats the entire purpose of having these things in the first place. This makes oop of ALL dynamic type language like python/php/js utterly broken. 

 

this can apply to static type language like c++, typescript, and c# as well if you use auto/any/var everywhere. Seriously, people should just get rid of these things. Java isn't broken because it doesn't have any of these(as far as I know, but no telling what they will do in future version of java).

Sorry I meant to write no dynamic typing

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×