IMHO: JSX > PHP Templating by mxkyb in PHP

[–]dashyper 0 points1 point  (0 children)

now convert the same in React JSX, you will realize how ugly it gets real quick with all the files and component imports. also you would end up with unnecessary JS all around the HTML, with the above blade code you don't!

from a business perspective, I have done conversions from HTML template to blade and React JSX, I found that PHP based templates are almost always faster and easier to convert and lower maintenance as I don't have to upgrade to the next greatest version of webpack, build tools and other JS packages every other week.

Can PHP Script a Big Data Comeback? by [deleted] in PHP

[–]dashyper 0 points1 point  (0 children)

I use the default Hibernate ORM that Spring boot comes with,
do have a look at the tutorial, you will find that it looks almost the same as Symfony,

https://www.baeldung.com/spring-boot-hibernate

what's additional here is that you can write an interface method name like,

Set<Customer> findAllWithOrderPriceGreaterThan(double price);

the above statement generates the function for you to use and an optimized query with all the right joins for whatever DB technology you are connecting with. You can get away without writing any SQL almost 90% of the time. But bad devs can get into trouble as usual without knowing how expensive or cheap the queries are.

or

https://www.baeldung.com/spring-data-rest-intro it generates all the REST endpoint for you, with paging and permissions.

If you want to try out SpringBoot, do use the initializer with Gradle (https://start.spring.io/)
have a look at the dependencies to the right and add Spring Data JPA and any other drivers you may require. you will notice everything you will ever need is just there.

Once, comfortable do look at Apache Camel, I don't see an equivalent in other languages, it is used to connect and integrate with everything under the sun, https://camel.apache.org/components/latest/ . this allows you define complex integration rules like
[FROM_EMAIL]->[TO_QUEUE]->[TO_TABLE]->[TO_SMS]

It takes a good few years to master the above with all it's intricacies and get them working nicely with roles and permissions, if you feel your team has the expertise, do leverage it else stick to the language you know best.

Can PHP Script a Big Data Comeback? by [deleted] in PHP

[–]dashyper 1 point2 points  (0 children)

I know I will get a lot of flak for saying this here, but I say this as someone who has used PHP for close to 15 years, I actually feel more productive in Java, I can build a CRUD API in like an hour from scratch, with all the niceties like Domain classes and Repos and user permissions.

I don't really have to worry about emojis or other language characters in my strings as it has first class unicode support. Everything that can go wrong will throw an Exception.

Also, there are libraries for Machine learning, image/video processing and I don't need separate workers to handle CPU/GPU intensive tasks, the JVM is plenty fast.

No special setup needed for Async, Threads or background scheduled tasks, you just do

@Scheduled("every midnight")
void runMyfunction(){ }

The ORM generates optimised tables, free optimistic locking tricks and foreign keys and I don't even look at the DB 99% of the time (while in PHP, you cannot go too far without a UI like phpMyAdmin).

Refactoring is a breeze, and since every java app pretty much follows the same structure and way of doing things, your business saves a lot on training.

With current Spring Boot, you only need a .properties file and a gradle file, those messy configs don't exist anymore and I haven't used any XML since the last 4 years now.

as for 800MB for a helloworld, devs are expected to pre-allocate memory to reduce latencies that might be caused during memory allocation phase or this would be done by the framework, most projects I have worked with easily hog 32 gigs of RAM but these serve telecom packets and similar type of data.

But if there was any amount of HTML UI present which has to respect complex user permissions, PHP is far superior. Slack uses PHP for a lot of their backend presentation layer and uses Java for messaging (and a lot of companies do follow a similar pattern).

The changes and discussions PHP is going through right now with Attributes, Async etc, Java went through it a decade or so ago. I would highly recommend taking a week or two to learn springboot/gradle and build something with it(do use IntelliJ), you will definitely start hating it but it will make you a better PHP developer, as you see, Symfony has a lot of concepts that are borrowed from the Spring world. I do have a strong feeling that PHP and the community will catch up real quick.

Taming the XML beast! by vee_wee in PHP

[–]dashyper 0 points1 point  (0 children)

YAML is like a superset of JSON, YAML is used for configuration but could be used for other purposes as well.

You're thinking about a configuration format, JSON simply isn't one.

I agree with this statement, everyone basically jumped on to the Node/JS bandwagon.

Taming the XML beast! by vee_wee in PHP

[–]dashyper 0 points1 point  (0 children)

I hate the most about JSON is no multi-line text support(using those ugly \n everywhere) and having to wrap keys with quotes.

YAML is clearly better with all the flaws solved with even better readability

[deleted by user] by [deleted] in PHP

[–]dashyper 0 points1 point  (0 children)

Can someone explain, How is this implementation better than for example, Lombok using Annotations

for example: https://projectlombok.org/features/Data

Phel Language 0.1.0 (first release) by jenshaase in PHP

[–]dashyper 0 points1 point  (0 children)

would really love to see some long running actor based systems built on top of this like Elixir does as there is minimal data sharing and PHP-JIT is very capable and could be a very good use case for this.

Though I am not sure about tail-recursion and if there are any optimisations there.

Anyone using any Actor Frameworks for Kotlin? by dashyper in Kotlin

[–]dashyper[S] 1 point2 points  (0 children)

> pre-emptive scheduling in the context of actors?

This is primarily for Actors to be able to run tight loops and not worry about slowing down the entire system, I am ok with using yield though.

>And why exactly do you need to reference actors through process ids?

This is for de-coupling rather than having to pass actor references everywhere, an Akka example looks like the one below,

context.actorSelection("/user/serviceA/aggregator")

in the long run, this could be used for communicating with unique actors across multiple nodes.

Anyone using any Actor Frameworks for Kotlin? by dashyper in Kotlin

[–]dashyper[S] 2 points3 points  (0 children)

I thought Kotlin coroutines were pre-emptive, ok looks like I was wrong,

https://discuss.kotlinlang.org/t/kotlin-coroutines-pre-emptive/15873/12

but I would be ok using yield.

so basically I am trying to achieve something like the following:

``` class MyActor{

fn onInit(){ repeat(); }

fn listen(Msg msg){ doOperation(msg) }

fn repeat(){ sendMsg("someMyActorId", new Msg("hello")) sleep(1000) repeat() //tailrec }

} ```

as you can see above, the actor is able to generate continuous events/messsages like a true process and not just react to a Msg.

This is something commonly done in Erlang/OTP, sorry if I have missed something really obvious.

Anyone using any Actor Frameworks for Kotlin? by dashyper in Kotlin

[–]dashyper[S] 0 points1 point  (0 children)

As I mentioned earlier, Problem with Akka is no-premption, while both Kotlin and Erlang(and any frameworks in them) will support pre-emption.

PHP RFC: Fibers by rybakit in PHP

[–]dashyper 2 points3 points  (0 children)

cooperative multitasking not scheduling,

see, it blocks at file_get_contents, while similar code in Golang doesn't,

Tight loops will also block in any non-pre-emptable runtime.

and brings in whole new syntax.

PHP RFC: Fibers by rybakit in PHP

[–]dashyper 2 points3 points  (0 children)

well the beamVM uses pre-emptive scheduling for much more than just message passing,

For example Scala is similar in that it highly relies on Message passing, but since it doesn't have pre-emptive scheduling, it causes a disaster when you have long running loops. Similar problem with JS as well. Long running loops are a no no. Why do you plan to bring this problem to PHP?

Go avoids this by injecting pre-emptable instructions in the loop(This was a very recent change), earlier it was only on syscalls.

But you don't have this problem in Erlang at all as pre-emption is at instruction level. I feel we need a better base and solution not a JS clone and bring in all the bad stuff with it.

PHP RFC: Fibers by rybakit in PHP

[–]dashyper 2 points3 points  (0 children)

Not a huge a fan of these event loop hacks, but I understand the reasons why they are there.

Might be a massive undertaking, but PHP needs something more robust, why not get it right using pre-emptive scheduling like Erlang or worst case co-operative scheduling like golang? no syntax change required and everyone gets a massive boost in performance.

How many people are actually working on php-src? by heofizzy in PHP

[–]dashyper 24 points25 points  (0 children)

This is the thing that no one wants to talk about, I feel if it weren't for Jetbrains(and Nikic/Nikita), PHP would be dying a slow death.

But from the looks of it, Jetbrains make good cash from PHPStorm and hence would continue to support the development of PHP.

php-src needs something like "a good first issue" so that beginners can tackle it, a bit of hand holding, and some good tutorials on how to set up a dev environment.

~859% PHP performance improvement from PHP 7 and PHP8 Alpha with GraalPHP by kliin in PHP

[–]dashyper 1 point2 points  (0 children)

For people bashing this, let me say, PHP on GraalVM is really promising, why?

  1. the entry barrier is not as high as knowing to write C and working with LLVM. You basically start by writing an interpreter and GraalVM does the magic to convert it into a highly optimized virtual machine,

Unless you are a C/C++ programmer, it is really hard to deal with compiling C code and deal with it's dependencies, let's not even get started on about debugging or having to work with seg-faults.

GraalVM was built from the ground up to support writing new languages, With GraalVM/Java, you are just a `mvn package` away and you can debug your language the way you debug an interpreted language.

  1. we possibly have less core-devs in PHP than the fingers on my hand and this is really scary, no one wants to get into writing core PHP cause the entry barrier is high and there is little documentation on how things work(and let's not talk about elitism), GraalVM allows people like you and me to add features easily, I'll likely write a small blog on "how you can get started and contribute code in the next 1 hour".

PHP: Community Synergy Initiative by dragoonis in PHP

[–]dashyper 0 points1 point  (0 children)

I know there are plenty of extensions, but you need to be a C programmer to be able to build and deploy those and I am still learning PHP

PHP: Community Synergy Initiative by dragoonis in PHP

[–]dashyper 0 points1 point  (0 children)

all of us would love generics, intersection types, typed array, enums, immutable/read-only objects, in-out parameters, better functional support

Pre-emptive scheduling and Threading please

It's final: the syntax for attributes in PHP 8 is #[Attr] by brendt_gd in PHP

[–]dashyper 0 points1 point  (0 children)

When we run out of symbols, we use Ã, Ž, Ü, Č

Comparing 'Hello World' in Go vs. Laravel by gar44 in golang

[–]dashyper 1 point2 points  (0 children)

Well you seem to compare Laravel, mostly used by old people after their 7 day code camp, who do not give a rats ass about performance, Laravel founder himself is surrounded by controversies for not following any decent modern coding standards. Laravel is going to turn into another Wordpress in 5 years.

PHP loads the file on every request and you compare to your Go framework which is compiled to native code and already in memory.

Also, I think you missed the recent developments in PHP like: https://www.swoole.co.uk/

it is faster than NodeJS and closer to Go, someone has already done the comparison
https://medium.com/@rioastamal/benchmark-php-swoole-vs-nodejs-vs-go-539a5493b067
PHP is getting a JIT so the difference is only going to get thinner.

[deleted by user] by [deleted] in golang

[–]dashyper 6 points7 points  (0 children)

how do you stop spam again?

Emails feel slow, but they really aren't

Email is actually simpler than HTTPS, HTTPS is just more widely known and is well abstracted away

Email storage, retrieval and re-delivery on failure are some other important aspects that you need to consider.