News for hackers. Stuff that matters.

devwebee

Re:What it's like to use Haskell on Thursday March 27, 2014 @07:22AM (#7479648)
Vim is multi-platform, and there are GUIs for Vim, particularly GVim and Macvim, where you can use the mouse, and copy/paste, etc, just have to do it the Vim way. You gave up too early, Nano isn't even close; it's like comparing Notepad to Notepad++. Give both Haskell and Vim another chance.
Re:What it's like to use Haskell on Wednesday March 26, 2014 @10:50PM (#7478274)
I've seen experienced programmers failing at learning Haskell for the same reason experienced programmers fail at learning Vim, the initial learning curve is very steep, and they don't see the value on climbing that wall. Now, if you know Vim, ask yourself, was it worth it? I'm convinced 99% of people would say yes. It is the same with Haskell, all those seemingly complex concepts come with a big reward.

Learning Haskell is easier with a strong functional programming background; sadly CS students don't learn much about FP, so having lots of experience in CS and compilers won't necessarily put you in a better position than somebody who has no formal background in CS but lots of programming experience.

A math background on the other hand should help you. Learn about how category theory is applied in Haskell, and you're already half way there. Monads are just a piece of the puzzle.

I do agree with your last three points. I haven't used Haskell in production, so my experience in "real world Haskell" is limited, but it has helped me immensely in my daily work with other languages. Haskell forever changes the way you think and approach problems, just like Vim changes the way you write and edit code; it will make you a better programmer.

Re:How 13 programming languages got their names on Thursday March 20, 2014 @10:07PM (#7440241)
Interesting title, too bad I've to click "next" fifteen times; lost interest; skip.
Re:Ask HN: I am a PHP Newbie, Why do most developers hate it on Thursday March 20, 2014 @01:36PM (#7437186)
PHP can handle as well or better than Python and Ruby. The performance difference is not that important when choosing between these languages, because they are all slow anyway. If you compare PHP vs Java or Ruby vs NodeJS, then performance gain might be an important factor when choosing. Python is used more outside of webdev than PHP and Ruby, so that might be something to consider, because there are more libraries for making UIs, games, graphics, etc.
Re:Ask HN: I am a PHP Newbie, Why do most developers hate it on Thursday March 20, 2014 @01:18PM (#7437016)
The problem with PHP is its design, or lack of it to be precise. It's inconsistent and quite verbose. But it's made for the web, so it's very easy to deploy, and the workflow is straightforward, put file in a folder on a server and refresh the page. If you're new to web development but already have some programming experience, PHP is a good language to learn because it's ubiquitous and very easy to get started. If you're new to programming, I'd suggest you learn Python first; it's a beautifully designed general purpose language, and will guide you through the right path before diving into the PHP jungle.
Re:Hack: a new programming language for HHVM on Thursday March 20, 2014 @01:04PM (#7436894)
It looks promising, I highly dislike writing PHP and this seems like it might ease the pain, but they could've gotten rid of the damn dollar sign in front of variables, how ugly is this? "return ($y) ==> { return $y + 1; }"
I noticed this too. Plus they're using a bad example. Looping an array with "for..in" in JavaScript is one of the most known antipatterns.
Re:Be brutally honest, would you use this site? on Wednesday March 19, 2014 @03:36AM (#7427237)
Yes, maybe, in the same way I would browse for random stuff on other places out of pure boredom, there are some interesting polls. But the site is too slow, it takes ~5sec to load, on my desktop, and the scrolling isn't smooth. Loading 50 jQuery libraries in the header plus some other 30 libraries in the footer don't help, it's killing the site... You need to concatenate and minify all that code, same with the CSS. And do some profiling. Ebay, arguably one of the biggest sites on the internet runs on ~80mb but your site uses up 130mb; you might have a memory leak.
Re:Beginner Web Design Mistakes on Friday March 14, 2014 @11:28PM (#7403355)
Yes, content first web design is good web design, not superfluous decoration.
Re:Ask HN: What's your favorite keyboard for programming? on Thursday March 13, 2014 @10:11PM (#7396560)
Dell SK-8115 is a classic.
Re:The New Razer Blade on Thursday March 13, 2014 @02:06AM (#7390260)
They are loading like 20 jQuery libraries in the header. Nothing is minified. By looking at the JS code here http://assets.razerzone.com/eeimages/products/15348/js/templ..., it seems like they vomited jQuery on top of a PSD2HTML site. Bad indentation, bad class names like ".bar-prc1", ".bar-prc2", ".bar-prc3", no selector caching, no consitent usage of chaining, inconsistent style overall, in other words, a mess.
Not sure those two cases are really interchangeable. It doesn't seem like a very good example. By introducing an object that way you're coupling your functions that work on pure data to an instance. Now to multiply two numbers you need an instance of Calc. I'd suggest something like this instead:

  var multiply = curry(function(x, y){
    return x * y;
  });

  var add = curry(function(x, y){
    return x + y;
  });

  var Calc = (function(){
    function Calc(x){
      this.x = x;
    }
    Calc.prototype.map = function(f){
      this.x = f(this.x);
      return this;
    };
    return Calc;
  }());

  new Calc(2).map(compose(add(2), multiply(4)));

  // or

  new Calc(2).map(multiply(4)).map(add(2));
Re:7 KB front-end framework with many common features on Friday February 28, 2014 @06:50AM (#7318221)
TBH, it doesn't look too good. The syntax is all over the place, bad indentation, missing semicolons, a loop variable is leaking, it doesn't follow common conventions... But don't give up, keep improving your skills. Here's a replacement for that monstrous "getURLParameters" to pique your curiosity that can save you a few more lines:

  function getURLParameters(url) {
    var res = {},
        re = /[?&]([^?&]+)=([^?&]+)/g;
    url.replace(re, function(_,k,v) {
      res[k] = v;
    });
    return res;
  }
Then use it like "getURLParameters(window.location)".

Also just a tip in general, if you're up for some more constructive criticism I'll rewrite your "hasclass" function following conventions. So it goes from this:

  function hasclass (el, className) {
    if (el.classList)
      return el.classList.contains(className);
    else
      return new RegExp('(^| )' + className + '( |$)', 'gi').test(el.className);
  }
To this:

  function hasClass(el, className) {
    if (el.classList) {
      return el.classList.contains(className);
    }    
    return new RegExp('(^| )' + className + '( |$)', 'gi').test(el.className);
  }
Notice the camel casing in "hasClass", the braces around "if", and the early return.
Re:C++17: I See a Monad in Your Future on Thursday February 27, 2014 @08:58PM (#7316765)
So what kind of object is a multiplication, or an addition? Monoid has "no real good real-world parallel" because it is not a real-world concept. -- "It has no related or relevant meaning outside of very, very specific contexts" -- Well, that's the very nature of these abstractions; they apply to many many contexts, when working with data.
I completely agree. You're not losing me because I would've never clicked. If I want something, I go look for it myself. I don't understand why people try to make this a morality issue. You shove ads in my face, I block them, simple as that.