1. 4

    Currently: Looking at learning Coffeescript for something silly. Looking online, ES6 should replace it but ES6=ES2015 so that’s only been around for at most 3 years, less if you count the time for browsers to become compatible. And isn’t CS still fewer brackets, both curly and round? Although I probably shouldn’t be getting distracted by any of this given all the other stuff going on…

    Last week: Released guitktk, the simultanous GUI and toolkit maker.

    This week:

    • Improve guitktk’s speed. I can always “hand compile” function calls to their actual effect but this reduces polymorphism. What to do?
    • Finish blog post for what all my github projects are about.
    1. 4

      At this point of time it makes sense to learn typescript and ES6 - coffescript is going the way of the dodo.

      1. 1

        Thanks. My searches already turned up the community’s general feelings. But since I tend to have uses outside of intended purposes, I was looking for properties and examples. For example, what’s the best choice if it was learned for a single project and then never again, and why?

        1. 2

          what’s the best choice if it was learned for a single project and then never again, and why?

          Do you mean what’s the best choice out of ES6, Coffee, and Typescript? If it’s a small project and you want it done quickly, with not so much concern about rigor, and plenty of examples and help online, go with ES6. If it might live on for a long time with you coming back to it periodically and making changes then the assistance of a type system may be helpful, in which case Typescript. Honestly I can’t see any reason to use Coffee anymore (especially not to learn it) but if it appeals to you for some reason then sure, why not.

          1. 1

            I have no idea, I generally try to avoid tools that I can use only once, unless there are very specific business needs to use something.

      1. 4

        I’m working on Mozillas Cornice - I’ve already added Marshmallow schema validation, now I’ve added out-of-the-box API Explorer for cornice_swagger package.

        1. 2

          I really really really hope go 2.0 will have generics or some other that will finally allow some “proper” ORM solutions (like sqlalchemy). That would be awesome.

          1. 3

            you can get pretty far with standard golang reflection. we’ve built a couple more expressive orm’s internally; generics isn’t what is holding things back. what would really make orm’s more expressive in golang is something like .net/c#’s expression trees.

            1. 1

              It seems that everyone builds their own ORM in golang instead of adding features to existing solutions :) Makes me wonder why this is the case.

          1. 8

            Backing up a bit, what kind of web apps are you building, and what makes you interested in using Go for it?

            1. 2

              Apart “standard” CRUD stuff, some of the applications would benefit from first class asynchroneous support and sometimes they do quite a bit of data crunching so the ability to utilize all cores would be a plus. I can sidestep most of the problems of python but a strongly typed and faster language wouldn’t hurt. Although I can see that lack of generics brings its own problems to the table.

              1. 7

                I’ve only worked with Go a bit, and I’m rather skeptical of it’s efficiency for developing CRUD apps. Nothing posted in the rest of this thread so far has inclined me to think otherwise. I could see a couple of ways to go then:

                1. Just implement it all in Python or something, wait and see what parts (if any) are hurting from lack of concurrency, raw computation speed, and strong typing, then convert those bits to Go, and communicate with the web process via whatever makes sense.

                2. Design with a front-end in something more convenient and a computation back-end in Go from the start, thus having the communication designed well from the start and avoiding trying to implement something in Python that probably won’t do the job well enough.

                3. All-in on Go, make it all in Go, whatever warts it may have for CRUD basics.

                If you’re thinking hard about 3, I’d try and pick up whatever frameworks look decent here and build a simple demo CRUD webapp in Go with 1 or 2 models and see how that goes before making the call.

                I also wonder if an all-Go webapp would pair well with a frontend-heavy design with React and Redux. Let the front-end stuff handle the templating and most of the routing, and let the Go code do what it’s best at - slinging JSON and DB queries around and computing business logic.

                1. 3

                  Keep in mind that concurrency in Go is very easy to use, but hard to master, as it’s super low-level.

                  You might want to take a look at Elixir.

                  1. 1

                    Elixir ecosystem is a lot smaller than Go I think? Wouldn’t Rust or Kotlin be a better choice?

                    1. 3

                      Elixir runs on the Erlang VM which is one of the most robust and mature ecosystems of all. If you’re not familiar with Erlang, take a look at the history (it was developed for telecommunications) and then a look at Elixir itself.

                      If you want to write web applications, http://phoenixframework.org/ is the web framework in the Elixir world. It’s still quite modular, so it’s easy to start your own project from parts (persistence, webserver, request handling) without using the whole framework.

                      1. 1

                        I wasn’t aware that Elixir is compatible with existing Erlang (I’m perfectly aware erlang is mature) libraries, I will take a look at that in spare time, thanks.

                  2. 2

                    If you need asynchronous support to handle a huge amount of concurrent user connections, Go will be valuable. If the async stuff and data crunching you need would work as asynchronous background jobs, then writing the web app in Python, using a job queue, and writing the job runners in Go would be a good move. Or even Python with numpy if applicable, since numpy will be faster and easier than Go at matrix math and the other things it specializes in.

                    I personally don’t like Go for web development. It’s a lower level language that’s great for writing network services in general, but slinging HTML is on the tedious side.

                    I’m also trying to wrap my head around the fact that there are tons of db drivers, when I looked last time 2 years ago I was completely unsure which one would be the right to use - are there some “language standards” that are most used and supported well by community?

                    For what database? For Postgres, github.com/lib/pq is the de facto standard; for MySQL, github.com/go-sql-driver/mysql. They are both used by the Go project for integration tests of database/sql, as described on the github.com/golang/go wiki page here.

                1. 2

                  Just my two cents, but those seem like pretty basic questions for somebody considering a jump to Go as their “main language for web development”.

                  Why not work through some tutorials or create some toy projects first? It would give you an overview of the state of Go web development, and potentially save a lot of time if it doesn’t work out.

                  1. 1

                    I’m not concerned by language syntax for example, I’m more interested in robustness of specific parts of ecosystem, mainly db interaction. I’m sure for toy projects any language would work fine if i’d try to build lets say a blog - I already got a lot of info here that is valuable for me,.

                  1. -4

                    The language is called Go :)

                    1. 10

                      I have found it useful to use “golang” when doing google searches.

                      1. 13

                        There are two languages called Go as far as I can tell :-) I thought using Golang is nice way to differentiate.

                        1. 2

                          Rob disagrees :)

                          1. 9

                            You make a pedantic comment that ignores the common use of “Golang” to refer to the Go language. Your defense of this comment is the appeal to authority fallacy. None of this has been constructive, insightful, or even particularly correct.

                            1. 0

                              Your defense of this comment is the appeal to authority fallacy

                              Is Rob Pike not a trusted authority with a relevant opinion here?

                              1. 0

                                Rob Pike is an authority and his opinion is relevant. But if Rob Pike’s opinion is correct, it is not because he is Rob Pike. Thus, “because Rob Pike said so” is not a winning argument. The fallacy of the appeal to authority is not that authorities aren’t authorities. It’s just that what authorities say, like anything anyone says, must be proven.

                            2. 13

                              Rob is wrong.

                              1. 0

                                Yeah, some random internet commenter knows better what the name of the language is than its creator.

                                1. 6

                                  Creating something does not mean that one automatically has a good idea of what a good name, method or workflow is for other people.

                                  1. -3

                                    Creating something most certainly gives you the exclusive right of giving it a name, regardless of what someone else thinks about that name. Otherwise I’m just going to call you Martin Shkreli from now on.

                        1. 5

                          There are various ORMs/mappers, but most advice you’ll find (and what I’ll say, also) is to not use them. Wrap a database connection in a struct that has methods to do what you want. Something I’ve found conditionally useful are generators to write the function to populate a struct from a database row.

                          The community will also say to not use web frameworks, and again I’d agree. The stdlib http package provides a stable foundation for what you want to do. You’ll have more luck looking for packages that do what specific thing you want, rather than thinking in terms of frameworks.

                          All that said, some coworkers like echo but I can’t for the life of me understand why. Any web-oriented package shouldn’t need to give a shit if it’s hooked up to a tty or not.

                          1. 3

                            The problem is that when you do search and filtering on various conditions (like in a shop) you don’t want to resort to sql string stitching, I wasn’t able to find anything nice when I looked at the docs, for example in gorm:

                            db.Where("name = ? AND age >= ?", "jinzhu", "22") - I expect that when you have 20 conditions with different operators and data types you will end up having a bad time.

                            1. 4

                              I’m at a small scale but I just write the query entirely and or do string concatenation. I’m having a fine time though. I just use sqlx.

                              1. 2

                                sqlx

                                https://godoc.org/github.com/jmoiron/sqlx#In is pretty useful when you need it.

                                1. 3

                                  I admit I don’t understand how to use that from the doc string. Could you show a simple example or elaborate?

                                  1. 4

                                    It’s useful for queries using the IN keyword, like this:

                                    query, params, errIn := sqlx.In("SELECT column1 FROM table WHERE something IN (?);", some_slice)
                                    // if errIn != nil...
                                    rows, errQuery := db.Query(query, params...)
                                    
                                2. 2

                                  We built something in house that is very similar in spirit to sqlx but adds a bunch of helpers.

                                  https://github.com/blendlabs/spiffy

                                3. 4

                                  https://github.com/Masterminds/squirrel (which kallax uses) seems somewhat akin to the SQLAlchemy expression API. (And yeah, to me, that’s a great part of SQLAlchemy; I’ve hardly used its ORM in comparison.)

                                  I went from Python + heavy use of the SQLAlchemy expression API to Go and got by OK with just stdlib, but part of that was that the work in Go had far less complicated queries most of the time. So, not the best comparison maybe.

                                  1. 2

                                    I support the advice to not use mappers like ORMs, but I also agree with what you said. The middle ground seems to be query builders.

                                    If you use Postgres as your DBMS by any chance, I advise you to make sure that the query abstraction layer of your choice doesn’t do query parameterization by string interleaving but utilizes PQexecParams underneath instead.

                                    1. 1

                                      I haven’t used it but I think Dropbox built a library for that. https://godoc.org/github.com/dropbox/godropbox/database/sqlbuilder

                                  1. 6

                                    I’m working on:

                                    • new release of ziggurat_foundations set of mixins for sqlalchemy that provide user permission system to applications
                                    • new release of channelstream - gevent websocket server for rapid real-time communication building, reworked demo UI to Polymer 2.x + redux and now I need to polish new release server side.
                                    1. 6

                                      I think the faulty assumption is that the happiness of users and developers is more important to the corporate bottom line than full control over the ecosystem.

                                      Linux distributions have shown for a decade that providing a system for reliable software distribution while retaining full user control works very well.

                                      Both Microsoft and Apple kept the first part, but dropped the second part. Allowing users to install software not sanctioned by them is a legacy feature that is removed – slowly to not cause too much uproar from users.

                                      Compare it to the time when Windows started “phoning home” with XP … today it’s completely accepted that it happens. The same thing will happen with software distributed outside of Microsoft’s/Apple’s sanctioned channels. (It indeed has already happened on their mobile OSes.)

                                      1. 8

                                        As a long-time Linux user and believer in the four freedoms, I find it hard to accept that Linux distributions demonstrate “providing a system for reliable software distribution while retaining full user control works very well”. Linux distros seems to work well for enthusiasts and places with dedicated support staff, but we are still at least a century away from the year of Linux on the desktop. Even many developers (who probably have some overlap with the enthusiast community) have chosen Macs with unreliable software distribution like Homebrew and incomplete user control.

                                        1. 2

                                          I agree with you that Linux is still far away from the year of Linux on the desktop, but I think it is not related to the way Linux deals with software distribution.

                                          There are other, bigger issues with Linux that need to be addressed.

                                          In the end, the biggest impact on adoption would be some game studios releasing their AAA title as a Linux-exclusive. That’s highly unlikely, but I think it illustrates well that many of the factors of Linux’ success on the desktop hinge on external factors which are outside of the control of users and contributors.

                                          1. 2

                                            All the devs I know that use mac use linux in some virtualisation options instead of homebrew for work. Obviously thats not scientific study by any means.

                                            1. 8

                                              I’ll be your counter example. Homebrew is a great system, it’s not unreliable at all. I run everything on my Mac when I can, which is pretty much everything except commercial Linux-only vendor software. It all works just as well, and sometimes better, so why bother with the overhead and inconvenience of a VM? Seriously, why would you do that? It’s nonsense.

                                              1. 4

                                                Maybe a VM makes sense if you have very specific wishes. But really, macOS is an excellent UNIX and for most development you won’t notice much difference. Think Go, Java, Python, Ruby work. Millions of developers probably write on macOS and deploy on Linux. I’ve been doing this for a long time and ‘oh this needs a Linux specific exception’ is a rarity.

                                                1. 4

                                                  you won’t notice much difference.

                                                  Some time ago I was very surprised that hfs is not case sensitive (by default). Due to a bad letter-case in an import my script would fail on linux (production), but worked on mac. Took me about 30 minutes to figure this out :)

                                                  1. 3

                                                    You can make a case sensitive code partition. And now with APFS, partitions are continuously variable size so you won’t have to deal with choosing how much goes to code vs system.

                                                    1. 1

                                                      A case sensitive HFS+ slice on a disk image file is a good solution too.

                                                    2. 2

                                                      Have fun checking out a git repo that has Foo and foo in it :)

                                                      1. 2

                                                        It was bad when microsoft did it in VB, and it’s bad when apple does it in their filesystem lol.

                                                    3. 2

                                                      Yeah definitely. And I’ve found that accommodating two platforms where necessary makes my projects more robust and forces me to hard code less stuff. E.g. using pkg-config instead of yolocoding path literals into the build. When we switched Linux distros at work, all the packages that worked on MacOS and Linux worked great, and the Linux only ones all had to be fixed for the new distro. 🙄

                                                    4. 2

                                                      I did it for awhile because I dislike the Mac UI a lot but needed to run it for some work things. Running in a full screen VM wasn’t that bad. Running native is better, but virtualization is pretty first class at this point. It was actually convenient in a few ways too. I had to give my mac in for repair at one point, so I just copied the VM to a new machine and I was ready to run in minutes.

                                                      1. 3

                                                        I use an Apple computer as my home machine, and the native Mac app I use is Terminal. That’s it. All other apps are non-Apple and cross-platform.

                                                        That said, MacOS does a lot of nice things. For example, if you try to unmount a drive, it will tell you what application is still using it so you can unmount it. Windows (10) still can’t do that, you have to look in the Event viewer(!) to find the error message.

                                                        1. 3

                                                          In case it’s unclear, non-Native means webapps, not software that doesn’t come preinstalled on your Mac.

                                                          1. 3

                                                            It is actually pretty unclear what non-Native here really means. The original HN post is about sandboxed apps (distributed through the App Store) vs non-sandboxed apps distributed via a developer’s own website.

                                                            Even Gruber doesn’t mention actual non-Native apps until the very last sentence. He just talks/quotes about sandboxing.

                                                            1. 3

                                                              The second sentence of the quoted paragraph says:

                                                              Cocoa-based Mac apps are rapidly being eaten by web apps and Electron pseudo-desktop apps.

                                                        2. 1

                                                          full-screen VM high-five

                                                        3. 1

                                                          To have environment closer to production I guess (or maybe ease of installation, dunno never used homebrew). I don’t have to use mac anymore so I run pure distro, but everyone else I know uses virtualisation or containers on their macs.

                                                          1. 3

                                                            Homebrew is really really really easy. I actually like it over a lot of Linux package managers because it first class supports building the software with different flags. And it has binaries for the default flag set for fast installs. Installing a package on Linux with alternate build flags sucks hard in anything except portage (Gentoo), and portage is way less usable than brew. It also supports having multiple versions of packages installed, kind of half way to what nix does. And unlike Debian/CentOS it doesn’t have opinions about what should be “in the distro,” it just has up to date packages for everything and lets you pick your own philosophy.

                                                            The only thing that sucks is OpenSSL ever since Apple removed it from MacOS. Brew packages handle it just fine, but the python package system is blatantly garbage and doesn’t handle it well at all. You sometimes have to pip install with CFLAGS set, or with a package specific env var because python is trash and doesn’t standardize any of this.

                                                            But even on Linux using python sucks ass, so it’s not a huge disadvantage.

                                                            1. 1

                                                              Installing a package on Linux with alternate build flags sucks hard in anything except portage

                                                              You mention nix in the following sentence, but installing packages with different flags is also something nix does well!

                                                              1. 1

                                                                Yes true, but I don’t want to use NixOS even a little bit. I’m thinking more vs mainstream distro package managers.

                                                              2. 1

                                                                For all its ease, homebrew only works properly if used by a single user who is also an administrator who only ever installs software through homebrew. And then “works properly” means “install software in a global location as the current user”.

                                                                1. 1

                                                                  by a single user who is also an administrator

                                                                  So like a laptop owner?

                                                                  1. 1

                                                                    A laptop owner who hasn’t heard that it’s good practice to not have admin privileges on their regular account, maybe.

                                                                2. 1

                                                                  But even on Linux using python sucks ass, so it’s not a huge disadvantage.

                                                                  Can you elaborate more on this? You create a virtualenv and go from there, everything works.

                                                                  1. 2

                                                                    It used to be worse, when mainstream distros would have either 2.4 or 2.6/2.7 and there wasn’t a lot you could do about it. Now if you’re on python 2, pretty much everyone is 2.6/2.7. Because python 2 isn’t being updated. Joy. Ruby has rvm and other tools to install different ruby versions. Java has a tarball distribution that’s easy to run in place. But with python you’re stuck with whatever your distro has pretty much.

                                                                    And virtualenvs suck ass. Bundler, maven / gradle, etc. all install packages globally and let you exec against arbitrary environments directly (bundle exec, mvn exec, gradle run), without messing with activating and deactivating virtualenvs. Node installs all it’s modules locally to a directory by default but at least it automatically picks those up. I know there are janky shell hacks to make virtualenvs automatically activate and deactivate with your current working directory, but come on. Janky shell hacks.

                                                                    That and pip just sucks. Whenever I have python dependency issues, I just blow away my venv and rebuild it from scratch. The virtualenv melting pot of files that pip dumps into one directory just blatantly breaks a lot of the time. They’re basically write once. Meanwhile every gem version has it’s own directory so you can cleanly add, update, and remove gems.

                                                                    Basically the ruby, java, node, etc. all have tooling actually designed to author and deploy real applications. Python never got there for some reason, and still has a ton of second rate trash. The scientific community doesn’t even bother, they use distributions like Anaconda. And Linux distros that depend on python packages handle the dependencies independently in their native package formats. Ruby gets that too, but the native packages are just… gems. And again, since gems are version binned, you can still install different versions of that gem for your own use without breaking anything. Python there is no way to avoid fucking up the system packages without using virtualenvs exclusively.

                                                                    1. 1

                                                                      But with python you’re stuck with whatever your distro has pretty much.

                                                                      I’m afraid you are mistaken, not only distros ship with 2.7 and 3.5 at same time (for years now) it is usually trivial to install newer version.

                                                                      let you exec against arbitrary environments directly (bundle exec, mvn exec, gradle run), without messing with activating and deactivating virtualenvs

                                                                      You can also execute from virtualenvs directly.

                                                                      Whenever I have python dependency issues, I just blow away my venv and rebuild it from scratch.

                                                                      I’m not sure how to comment on that :-)

                                                                      1. 1

                                                                        it is usually trivial to install newer version

                                                                        Not my experience? How?

                                                                        1. 1

                                                                          Usually you have packages for all python versions available in some repository.

                                                          2. 2

                                                            Have they chosen Macs or have they been issued Macs? If I were setting up my development environment today I’d love to go back to Linux, but my employers keep giving me Macs.

                                                            1. 3

                                                              Ask for a Linux laptop. We provide both.

                                                              I personally keep going Mac because I want things like wifi, decent power management, and not having to carefully construct a house of cards special snowflake desktop environment to get a useable workspace.

                                                              If I used a desktop computer with statically affixed monitors and an Ethernet connection, I’d consider Linux. But Macs are still the premier Linux laptop.

                                                              1. 1

                                                                At my work place every employee is given a Linux desktop and they have to do a special request to get a Mac or Windows laptop (Which would be in addition to their Linux desktop).

                                                            2. 3

                                                              Let’s be clear though, what this author is advocating is much much worse from an individual liberty perspective than what Microsoft does today.

                                                              1. 4

                                                                Do you remember when we all thought Microsoft were evil for bundling their browser and media player? Those were good times.

                                                            1. 8

                                                              As someone that has written two Ludum Dare entires in Love2D, and a Space Invaders clone in pygame, I can heartily recommend Love2D for hobbyist 2D games. It might not be as strong as unity in terms of documentation or assets available, but it’s also infinitely simpler for 2D work. The only thing that might give some pause is Lua. I personally like Lua a lot, but I know that’s not universal.

                                                              1. 2

                                                                I would love it if there was a clojurescript for lua.

                                                                1. 4

                                                                  Here ya go: https://github.com/raph-amiard/clojurescript-lua

                                                                  Hasn’t been updated in years, but IIRC it was an early GSoC project. l2l is probably a bit more practical tho: https://github.com/meric/l2l

                                                                2. 1

                                                                  I’d suggest you look at https://godotengine.org/ - with 3.0 it shapes up to be a serious competitor. It is open source and FOSS and has multiple commercial titles in it already. People like it for 2D capabilities and 3.0 (yet to be released) brings serious updates to 3D engine.

                                                                  1. 1

                                                                    The 3D stuff looks neat, but I’m extremely suspicious of the fact that they invented their own scripting language for it. Anyone who thinks inventing and maintaining a new language is going to be easier than integrating an existing one is showing very questionable judgment.

                                                                    1. 1

                                                                      Yeah, well 3.0 adds C# support, they had a blog post on why they added gdscript.