3
Levy
7y

(!rant)

I need an advise...
I am quite used to work in PHP. But I feel like it's getting older and older. Is there another comparable language? I'm thinking about Ruby or something...

What do you think? Do you have a more modern language in mind? Is it easy to use?

Comments
  • 0
    PHP is more related to websites. If you want a nice and easy modern language, go with python. If you want to make websites, go with JavaScript

    Ruby is like python but I would learn python first.
  • 0
    Node js
  • 0
    Go to java (and related) or javascript.
  • 0
    Yes, I would like to work on websites. But JavaScript ist running on clients. So you could disable it.

    I want to rebuild my web-tool (PHP) in another more modern language. So I need a database connection as well ...
  • 0
    I'd recommend Java myself, but I heard that C# is evolving faster. If you don't know any of these you should probably checkout C# first. You could also use nodeJS it's JavaScript that runs on server side.
  • 0
    Try Python + Flask
  • 0
    @sSam C# is little different and allows lower level than java. From those to suggesting java is safer.
  • 1
    PHP doesn't feel old. It has lmost every feature that I wanted. I hope they add soon operator overloading.
  • 0
    Okay, I might be a dumb person but...

    C# and Java isn't really made for web development, isn't it? I am looking for an alternative for PHP. Database connection, get data from html-form, cookies and so on...
  • 0
    @edwrodrig i guess that won't happen in near future. Last time I checked there was nothing like that planned. Maybe something changed by those 3 years since I checked, but don't think so.
    Honestly, I don't see much appliance for operator overloading in php. It would be useful when you deal with math, but there you need more than those few operators that are there. And there are more suitable languages for math than php.
  • 1
    @Levy they are general purpose languages with capabilities you never dreamed of. Including web related stuff.
    If you want to go with java, look at Spring Boot project.
    For c# aim at ASP.MVC
    There are others, but those are the most popular.

    You see, the point is, you can run almost any language with dotnet/jvm except for java/csharp respectively. Including php or js or python or ruby. It might not be a best idea, but it would work. Well, jvm has js nashorn engine included ;-)

    Keep openminded with the technologies you use. Project I'm working on is strictly java, but I have a use case for dynamically loaded scripts, think of js. I have to extract some parts of the algorithm, so that they can be modified at runtime. Without scripting languages this would be impossible.
  • 0
    @mt3o Operators are useful in many context.

    + - ++ -- are useful in set types.
    << >> are useful in stream context
    / in path context

    and so on
  • 0
    Ok, about / is system dependant. Most often used as a string or dynamic symbol.
    You can also multiply, use modulo division, use bitwise operations. Going extreme, override brackets.
    Now let's imagine we should implement a dot product operator. What works be your approach? :-D
  • 0
    Python/Django
  • 0
    @edwrodrig if you really need that operator overloading, go for languages like haskell or lisp :-P google for them and their usecases.
  • 0
    @mt3o Python has operator overloading too. I ask an implementation like the one in C++ that is the best IMO. You can do very useful patterns with it.
  • 1
    node.js

    Javascript is quietly becoming the language of the future, cross platform and cross everything.

    Thanks to Google Chromium opening source project.
  • 0
    @edwrodrig
    It's not the point of 'what language' but 'why that language'.
    It will be hard for me to keep explaining without doing some research, so I'd ask first: have you completed algebra, calculus and discreet mathematics at university level?
    If not then: there are situations where operations like addition and multiplication are not (hrmpf, reversible?) a+b!=b+a
    In that case sticking to + symbol is wrong. So it is safer to forbid operator overloading at all.
    Remember that programming comes from advanced math. For different operations you need different operators.
  • 2
    @mt3o I don't agree. Symbols are made for men and not men for symbols. Using + in non conmutative context is very acceptable in many situations. For example, for string concatenation (a + b != b + a, but it is ok). Using <<, >> for stream operations is acceptable although they are used in bit shifting at the start.
    If the context is well known is better to do list + a + b + c; than list.add(a).add(b).add(c);

    PD: I have courses in calculus, algebra and discrete maths at university levem
  • 0
    Cout << 5<<2
    What is what? Where's the stream operator, where's bit shifting? Why?

    A*b*c where a is integer, b and c are vectors. Where do we have multiplication? Why not the dot product? What is the order of operations? Which multiplication has higher priority? What has higher priority with overloaded operators + or * ?
    This syntax is not clear. So it shouldn't be used. Use fluent syntax instead. Or use different languages than imperative ones.
    You have math background, so you know some examples where typical operations perform differently just because the datatype is different.

    You agree that when use case is clear, we could use operator overloading, but what will prevent someone from violating this rule? Common sense? C'mon :-D
    Imperative languages are not meant to be used that way.
  • 1
    @mt3o Generally you should have code guidelines with some subsets of the language, indentation rules, file organization and naming conventions. If these rules are reasonable, then using operators as a feature for your code is a good thing. Is true that the case of a chain of operators is not clear because operator precedence, but the solution is simple, use parentesis. I also put parenthesis in math expression to don't get lost.
Add Comment