[Kickstart] Pool mediated exchange - General Idea
-
HAT TIP TO KEVLAR.
Literate programming mode for Coffeescript FTW!
-
[quote name=“Kevlar” post=“35003” timestamp=“1384884817”]
I beg of you not to do it in PHP. There are so many GOOD frameworks for doing web development in node.js, Ruby, and Python, and PHP is SUCH a horrible language. Erlang is also an excellent choice for massively parallel tasks, like node.js. You should check it out.
[/quote]I don’t mean to thread jack, but can you give me a break down on why you think PHP is such a horrible language?
-
[quote name=“PhantomSTi” post=“35071” timestamp=“1384906472”]
[quote author=Kevlar link=topic=4507.msg35003#msg35003 date=1384884817]
I beg of you not to do it in PHP. There are so many GOOD frameworks for doing web development in node.js, Ruby, and Python, and PHP is SUCH a horrible language. Erlang is also an excellent choice for massively parallel tasks, like node.js. You should check it out.
[/quote]I don’t mean to thread jack, but can you give me a break down on why you think PHP is such a horrible language?
[/quote]Oh god, where do I even start?
Operators?
== is useless. It’s not transitive. “foo” == TRUE, and “foo” == 0… but, of course, TRUE != 0. == converts to numbers when possible (123 == “123foo"… although “123” != “123foo”), which means it converts to floats when possible. So large hex strings (like, say, password hashes) may occasionally compare true when they’re not. Even JavaScript doesn’t do this. For the same reason, “6” == " 6”, “4.2” == “4.20”, and “133” == “0133”. But note that 133 != 0133, because 0133 is octal. But “0x10” == “16” and “1e3” == “1000”! === compares values and type… except with objects, where === is only true if both operands are actually the same object! For objects, == compares both value (of every attribute) and type, which is what === does for every other type.
Comparison isn’t much better. It’s not even consistent: NULL < -1, and NULL == 0. Sorting is thus nondeterministic; it depends on the order in which the sort algorithm happens to compare elements. The comparison operators trys to sort arrays two different ways: first by length, then by elements. If they have the same number of elements but different sets of keys, though, they are uncomparable. Objects compare as greater than anything else… except other objects, which they are neither less than nor greater than. For a more type-safe ==, we have ===. For a more type-safe
-
Zerodrama has complained a lot about organization… shall we talk about organization in PHP?
There is no module system. You can compile PHP extensions, but which ones are loaded is specified by php.ini, and your options are for an extension to exist (and inject its contents into your global namespace) or not. As namespaces are a recent feature, the standard library isn’t broken up at all. There are [u][i][b]thousands[/b][/i][/u] of functions in the global namespace. Chunks of the library are wildly inconsistent from one another. Underscore versus not: strpos/str_rot13, php_uname/phpversion, base64_encode/urlencode, gettype/get_class “to†versus 2: ascii2ebcdic, bin2hex, deg2rad, strtolower, strtotime. Object verb versus verb object: base64_decode, str_shuffle, var_dump versus create_function, recode_string. Argument order: array_filter($input, $callback) versus array_map($callback, $input), strpos($haystack, $needle) versus array_search($needle, $haystack). Prefix confusion: usleep versus microtime. Case insensitive functions vary on where the i goes in the name. About half the array functions actually start with array_. The others do not. htmlentities and html_entity_decode are inverses of each other, with completely different naming conventions. The library includes: Bindings to ImageMagick, bindings to GraphicsMagick (which is a fork of ImageMagick), and a handful of functions for inspecting EXIF data (which ImageMagick can already do). Functions for parsing bbcode, a very specific kind of markup used by a handful of particular forum packages. Way too many XML packages. DOM (OO), DOM XML (not), libxml, SimpleXML, “XML Parserâ€, XMLReader/XMLWriter, and half a dozen more acronyms I can’t identify. There’s surely some kind of difference between these things and you are free to go figure out what that is. Bindings for two particular credit card processors, SPPLUS and MCVE (???). Three ways to access a MySQL database: mysql, mysqli, and the PDO abstraction thing.
Most of the damn language is just thin wrappers on some C code, but even that’s a mess and a half. There’s “Out†parameters, even though PHP can return ad-hoc hashes or multiple arguments with little effort. There’s at least a dozen functions for getting the last error from a particular subsystem, even though PHP has had exceptions for eight years. Warts like mysql_real_escape_string, even though it has the same arguments as the broken mysql_escape_string, just because it’s part of the MySQL C API. Global behavior for non-global functionality (like MySQL). Using multiple MySQL connections apparently requires passing a connection handle on every function call. The wrappers are really, really, really thin. For example, calling dba_nextkey without calling dba_firstkey will segfault (WTF???). The wrappers are often platform-specific: fopen(directory, “r”) works on Linux but returns false and generates a warning on Windows. There’s a set of ctype_* functions (e.g. ctype_alnum) that map to the C character-class detection functions of similar names, rather than, say, isupper.
Generics? Forget about it. There is none. If a function might need to do two slightly different things, PHP just has two functions. How do you sort backwards? In Perl, you might do sort { $b
-
What would you suggest?
-
[quote name=“mnstrcck” post=“35105” timestamp=“1384910775”]
What would you suggest?
[/quote]Every solution depends on your problem.
Want something that’s good for parallelism? Javascript, Erlang, and Golang are good choices.
Like functional programming? Python and Ruby are top notch.
Like solid object-oriented design and static typing? Java all the way. Like the VM and the Java libraries, but want to avoid the verbosity? Groovy is pretty awesome, and makes developing DSL’s trivial.
Want a native app for your platform? C# is great for windows. Objective-C is the official iOS language. Java runs on Andrioid phones.
Want something that will let you talk directly to the hardware? It’s REAL hard to beat C and C++.There’s literally thousands of languages, and the one you choose is going to depend entirely on what problem you’re trying to solve. Each language has it’s features that make it well suited for some things, and shitty for others.
For instance, Java is a great language, UNLESS you want to do parallelism. Then it sucks. The Thread class is so not-object-oriented it hurts, and using it correctly is HARD. Javascript and it’s descendants like Dart is a great language, UNLESS you want to provide a statically typed library. Then it sucks. I’ve not even mentioned other great language like OCaml, Haskell, Scala… The list is literally exhaustive.
A good programmer can program in any language, but great developers choose the right language for the job based on what the job is, and the strengths and weaknesses of the language. A good carpenter can drive in a nail with either a rock or a hammer, but how many carpenters do you see bashing stuff with rocks? Part of what makes a great developer is the ability to choose the tools that work best.
And please, do not tell me that Facebook and Wikipedia are built in PHP. I’m aware! They could also be written in Brainfuck, but as long as there are smart enough people wrangling the things, they can overcome problems with the platform. For all we know, development time could be halved or doubled if these products were written in some other language.
-
[quote name=“Kevlar” post=“35098” timestamp=“1384909955”]
== is useless. It’s not transitive. “foo” == TRUE…
[/quote]Yeah, I’m well aware of that article that you mention. [url=http://me.veekun.com/blog/2012/04/09/php-a-fractal-of-bad-design.]http://me.veekun.com/blog/2012/04/09/php-a-fractal-of-bad-design.[/url] However, I’m also aware of the debunking of such article. [url=https://news.ycombinator.com/item?id=4177516]https://news.ycombinator.com/item?id=4177516[/url]
While generally I would agree with you that PHP is a whacky language at times, I’ve used it for a good 10 years and it always boils down to a few things personally for me. I’m extremely comfortable with it, I’m able to rapidly prototype, and there’s a huge community.
I guess you could say PHP is my weapon of choice to get the job done. I think like with anything, there needs to be a good attack plan on how to execute a well thought out application which to me means (if choosing PHP) selecting a good framework (CodeIgniter, FuelPHP, Laravel), a database (MySQL, Mongo), server (Apache, Lighttpd, Nginx) and a well thought out roadmap for the future. I also like a lot of the developments that Facebook has done with HipHop VM [url=http://www.hiphop-php.com/blog]http://www.hiphop-php.com/blog.[/url]
I do however, respect your opinion. Thanks for your input.
-
Let’s move technical discussion here: [url=http://forum.feathercoin.com/index.php/topic,4556.0.html]http://forum.feathercoin.com/index.php/topic,4556.0.html[/url]
Feel free to rant about PHP and ideas here.
Project stages:
Nethercoin - XUL Coin-neutral wallet GUI
Nethercode - Bitcoin protocol teaching code in literate coffeescript - no crypto, just placeholders to try out and understand the process
Netherxchg - Exchange plugin for Nether
Netherserv - Coin-neutral daemon with Feathercoin module -
Now that’s a pretty awesome critique of PHP your some coding guru kevlar!
-
Kevlar I am impressed with your comments. thanks