Dumping PHP For Go
mikebeale.blogspot.com
mikebeale.blogspot.com
Sometimes your app just stops working because of some typo in your code
I don't know of any programming language that will auto-correct typos for you. or the spaghetti code becomes just too unreadable.
If you don't write spaghetti code, you won't have a problem PHP just doesn't seem exciting for me anymore. There doesn't seem to be anything exciting happening.
PHP isn't some 0.6-pre-alpha release software that douchebag developers use for production apps and get excited about when the core API changes every 3 weeks. not much has been happening with the language and nothing interesting as far as apps or frameworks.
so you, as a developer, are complaining that no interesting apps are being developed in a specific language..? Since I'm not a sysadmin, I prefer to pay extra to have my code managed by someone.
Sysadmin's don't manage code. You are a developer, you should be managing your own code. Interfaces and reflection are awesome.
both of which PHP has. Go helps me write cleaner and more maintainable code
I doubt it. You claimed that your code "becomes" spaghetti. Which implies that it starts out "clean and maintainable". I'll wait with baited breath for how long it takes your new code to also "become" shit.I know of many compilers that will point them out to you, and IDEs that will offer to auto-correct them (Eclipse, XCode and Visual Studio for example).
>If you don't write spaghetti code, you won't have a problem
Yes. And if you don't make any memory allocation errors you don't need a GC. Hell, if you don't make any errors period, you can just program in hex, building the executable code directly and skip assembly.
The thing is, different languages have different inherent characteristics (syntax, features) and different cultures (pertaining to libs, common practices, frameworks, etc), so one can tend to create more spaghetti code than the other, the programmer being equal.
PHP's lint option will identify syntax errors, and an IDE can identify or auto-correct typos in any language - it's not a Go specific thing.
>And if you don't make any memory allocation errors you don't need a GC.
Memory allocation is a feature. Spaghetti code is a symptom of a poor developer/team. They are not comparable.
> Hell, if you don't make any errors period spaghetti code is not a "mistake" like a typo, missing function reference etc.
That's simply not true. If you are organized, you will use whatever structures the language you are using provides to you (classes, modules, namespaces, etc.) to NOT write spaguetti code.
Spaguetti code it's not inherent to the language, it's inherent to the programmer.
I'm a PHP/Ruby/JS developer, I dabble in iOS/ObjC and it's ok, but the language which has me most excited is Go. I've watched screen casts and read things but still haven't got around to building anything serious in it, but when I get the time/need to build something really performant, I will. It could just be because it's new, but it seems to have an energy about it and the developers have made a real effort to provide great docs and make it accessible to us mere mortal, non-cs educated dynamic folk. I thank them for that.
It would be nice to have a language you can do scripty stuff with but also build high performance systems, but I doubt Go will be it. Clojure seems closer but somewhat less performant.
foo, _ := DoBar()In other words, you are moving backwards from decision to made up reasons.
Looks like he didn't seriously consider Python or Ruby at all.
Agreed. I'm not one to push my language preferences on others, but "it had scaling problems" more likely means "I read about Twitter's unique scaling problems".
I don't think Go is a bad choice for web apps, though; perhaps, if anything, the ecosystem is a bit immature and therefore can make deployment a bit more of a chore.
Now I'm doing a project which leans towards python and in some aspects C - that does seem to be more pandaring towards doing it in GO. But if it was a production project and not a fun project then I'd hold back from looking at GO, but it's a fun one so I'm looking at it and finding it very suitable alternative to python/C in this case. Still sussing out a nice IDE but I'm in no rush.
But for a PHP project I'd say PHP may be a better fit for cases were you use PHP as a ASP alternative. Lets that how I see it, though I'm no PHP guru, let alone ASP.
I hope the author was joking. That makes no sense otherwise.
Obviously languages can serve multiple purposes but the intended uses of these have almost no overlap.
Languages specialize. PHP is suited for the web because it is a dynamic language, stuff is compiled right when it is accessed, and there is no memory sharing between requests.
Go, C, C++, etc. are static languages, stuff needs to be recompiled for even a minor change, and of course, memory is shared for each request.
And that's just the tip of the iceberg.
Obviously you can bring all functionality that the web demands to Go. A jit compiler might help, maybe some loose typing, a few other widgets ... and then, guess what? You turned Go into PHP.
For each job, a proper tool.
Not with Go. Go compiles super fast.
just like it was being done in game development for decades already, it's not like web app is much different from computer game
I don't think this is really a problem. Although dynamic typing vs strong typing advantages/disadvantages are a whole 'nother argument, the reason you might choose (say) Python over Clojure for a web app is the ecosystem (libraries, frameworks, deployment), performance (is this a concern for your design?), the syntax (do you like it?) and tools support (IDE's, etc.).
> Obviously you can bring all functionality that the web demands to Go. A jit compiler might help, maybe some loose typing, a few other widgets ... and then, guess what? You turned Go into PHP.
You could say the same about Ruby or Python. Both built up a lot of web-centric libraries and packages. But neither have "turned into" PHP.
Yes, some languages reduce the barrier to entry for certain tasks. But that doesn't mean other languages are a bad choice; they likely have other benefits worth considering.
memory is shared for each request
What does this even mean? Something like an Apache module (as an example in C) may or may not share memory depending on how it is written, but there is nothing that means it must share memory.
All sensible web programming environments have a stateless programming model (if that is what you meant). Some add state on top of that using sessions etc, but that can be in any language.
All sensible web programming environments have a stateless programming model
By default, Go doesn't. The default HTTP server in Go works by calling into your code via a callback, and you are free to maintain any state you wish across requests.[1]I don't consider this a problem in Go, because the good module system and scoping rules mean that global state is explicit and obvious, and a good concurrency model means that accessing global state can be done safely. Global state can be useful and performant, so I'm glad Go lets you take advantage of it, but it might rule it out as a "sensible web programming environment" by your definition.