11 ms·
Imba: A new programming language for web apps
- manyoso 11y agoDoesn't solve any of the big problems with large scale javascript apps: 1) Lack of type checking leading to exploding runtime exceptions 2) Object inheritance/prototype is weird and counter intuitive to other OO languages 3) Lack of proper encapsulation leading to spaghetti code when combined with #1 I suspect we are in for a new era of languages targeting web assembly to be used as webapp frontends and backends but if they don't tackle the big issues above then what is the point?
- programminggeek 11y agoThere is no solution to large scale JS apps. Large systems are inherently problematic. The only way to "fix" them is to break them into smaller modules and subsystems. Fancy abstractions and features will never solve large system issues. The large system issue is that it's large.
- manyoso 11y agoThis is too clever by half. Some tools/languages are more amenable than others to creating and maintaining large apps. Very large applications have been written and maintained in C/C++ for decades. My contention is that Javascript is particularly ill-suited to the creation and maintenance of large scale apps in the long run for the reasons explained. Any new language which purports to be an improvement upon Javascript should at least attempt to rectify these issues. That's my thesis.
- j42 11y agoThis is actually quite fascinating (and part of my upcoming book...) Despite the obvious high/low-level language differentials, people have been managing multi-million-line C code-bases since the 80's. Then again, think of how little the build tooling has actually changed -- instead of fragmenting, you're left with llvm, gcc, make at the core of most compiled software. JavaScript is the exact opposite with the lowest possible barrier to entry (built-in to every web browser...), and the proliferation of frameworks and libraries may be due to this in combination with the lack of fundamental understanding of design patterns that can scale. Lots of people trying to partially solve symptoms, missing the forest for the trees. Theoretically there's nothing preventing good patterns in high-level UI development, but I'm not quite sure it's been done right, yet and have no idea when the dust will settle.
- manyoso 11y agoJavascript and other dynamic language like it are very good prototyping languages and for developing a quick mock-up to explore the pros/cons of a potential solution to a problem. But the lack of type checking and proper encapsulation turn into big headaches when scaled to a large app with even a few more junior developers. Without a compiler/type checker to help spot obvious problems in code runtime exceptions explode. This happens even for senior developers. And the lack of proper encapsulation other than by convention can/does lead to an explosion of the surface area of source code that a dev needs to know and be familiar with in order to refactor and make changes to large codebases which makes for very brittle large apps. Hence, I look forward to new languages targeting web assembly that will be more amenable to creating/maintaining large scale and long lived apps.
- EdSharkey 11y agoJavaScript is a toy language wherein I shake my head in disbelief every day that it is my primary language, but I have found it is possible to write typesafe code with vanilla JavaScript. With tooling and a rigid coding style observed by all developers, I'd say medium-to-large codebases (100K and up) can be maintained and extended just as well as other C-like languages. Using ultrastrict tools like Google Closure Compiler in conjunction with JSDoc comments gives you type checking along with minification and closure elimination. If you don't want the harsh taskmaster that Closure Compiler can be, IDE's like IntelliJ are able to navigate (with plugin helpers) your Node.JS codebase and build a useful type library. Again, JSDoc comments are critical here, and if you markup your JavaScript accurately and completely, you wind up with an editor that gives you very good type correctness warnings and inspections. Just keep your eyes peeled for yellow highlights and squiggly lines, and you can have confidence that your codebase is clean. JSDoc is very verbose, which is a shame, and you have to get good at forming types that are conducive to its tags. A good coding style document can go a long way to making that possible. I've found boring JavaScript groks best for all tooling. I stay away from mixins and mostly stick to boring old JS prototype definitions where the mutable bits are @type'd and assigned in the constructor to 'this'. Chrome can JIT these types of prototypes the best. Of course, there's no substitute when maintaining a large code base than to run with a comprehensive test suite.
- wtetzner 11y agoWell, by combining small systems, you can still end up with a large system. Abstractions absolutely can help solve the problem, by providing ways to modularize better.
- wnevets 11y agoprototypal inheritance isn't a liability that needs to be fixed.
- manyoso 11y agoYes, it is and the first reason is related to #1. Prototypical inheritance doesn't make much sense outside of a dynamic language. The second reason is because Javascript is disguised to look like Java and hence people familiar with the C-family of languages are surprised and baffled because Javascript is using the C-family syntax and idioms for classical inheritance to mask the very different prototypical inheritance.
- wnevets 11y agoJavascript is disguised to look like Java because people keep trying to "fix" it.
- manyoso 11y agoIt was designed from the very beginning by Eich to look like Java and not because subsequent people tried to "fix" it. Where are you getting this stuff?
- wnevets 11y agoES2015 just added the class keyword to make it look like java last year. IIRC the new keyword wasn't part of javascript in those first two weeks when javascript was released. Where are you getting this stuff?
- nilliams 11y ago'class' wasn't added to make it look like Java. It was added as sugar for a common pattern that everyone was already using. Many languages other than Java have a class keyword.
- nerdwaller 11y agoWell put. I've been keeping an eye on elm (elm-lang.org) for a bit to see if it stands the test of enough time for me to decide to try it out. It, at least as far as I've seen, tries to address these concerns. But who knows, maybe it's just more noise.
- manyoso 11y agoFWIW, having tried Elm, I was very impressed with: 1) Type checking... yay! 2) Awesome compiler error messages that help fix #1 3) Purely functional language with immutable data structures helping performance 4) Reasonably easy and well thought out encapsulation mechanism via modules On the other hand I was put off by: 1) Very opinionated about design patterns with a react style gui framework 2) Signals are hard to explain and don't easily map to more familiar patterns 3) Not much (if any?) server side development I think Elm would really benefit from something like built-in support for Qt-style signals/slots that are much easier for newcomers to grok and a much less opinionated focus on the one-true-react-style-design-pattern But I could very well have missed something. Just my two cents.
- Drup 11y agoYou could be interested by http://ocsigen.org/ http://ocsigen.org/
- TimJYoung 11y agoYes, exactly: http://www.elevatesoft.com/blog?action=view&id=why_limit_web_development_to_javascript http://www.elevatesoft.com/blog?action=view&id=why_limit_web...
- manyoso 11y agoThanks for the link! Yes, I think this generation of Javascript developers will eventually need to come to grips with this.
- lisivka 11y agoJavaScript is syntax sugar for Scheme (Lisp variant). Lisp is proven to support large scale apps, but you need to cook it using another cookbook.
- manyoso 11y agoI have a lot of respect for Lisp/Scheme, but I wouldn't regard Emacs as the most maintainable of large scale apps. Besides, the ability level of the average Lisp/Scheme developer and the average Javascript developer is likely not commensurate.
- lisivka 11y agoIt is funny that I downvoted on YCombinator site. :-) See few hints how to write efficient lisp: http://www.paulgraham.com/carl.html http://www.paulgraham.com/carl.html . You can apply them to JS too.
- temp 11y agohttps://news.ycombinator.com/item?id=10866540 https://news.ycombinator.com/item?id=10866540 https://news.ycombinator.com/item?id=10863827 https://news.ycombinator.com/item?id=10863827 https://news.ycombinator.com/item?id=10091454 https://news.ycombinator.com/item?id=10091454
- judofyr 11y agoThe last story there has many interesting comments. I recommend reading through it (and looking for comments by "somebee" and "judofyr") if you want to understand more about the philosophy behind the Imba. This submission is mainly because the website has been updated with more documentation and examples. If you were interested earlier and found it difficult to get started, it might be worth a second look now.
- chvid 11y agoGetting thru at HN takes multiple submission it seems. Even for a big project like this.
- dang 11y agoIt 'got through' on the first try: https://news.ycombinator.com/item?id=10091454 https://news.ycombinator.com/item?id=10091454.
- qwertyuiop924 11y agoYay! Another new programming language for hipsters! Another pointless technology to learn! For god sakes, use js &co, clojure, or elm. Nothing else is worth it.
- aeze 11y agoYou know your examples were/are considered new languages at one point, right?
- mrgoldenbrown 11y agoPretty sure they are still considered new or at least exotic from a "typical" developer's point of view.
- qwertyuiop924 11y agoyeah, but I feel they have a reason to exist. Clojure exists because it has interesting ideas about immutability, and is a lisp. Elm exists because FP. This exists because... Why? They thought we needed a new syntax for JSX? They thought we needed another language that was kind of like coffescript, but different in subtle ways? I don't know, and I can't see what this is bringing to the table.
- such_a_casual 11y agoThen don't use it? There's no reason to bash on anyone for making something, even if it's absolutely useless: https://news.ycombinator.com/item?id=10758290 https://news.ycombinator.com/item?id=10758290
- qwertyuiop924 11y agoSorry, I didn't mean to bash on them for making. Let me clarify my opinion. What annoys me is that they made a thing, which is of debatable use, and talked it up as the next big thing, which everyone should use, because it's amazing. That bugs me.
- alfanick 11y agoit gets boring... why we need another language?
- golergka 11y agoTo all people who reply negatively to this: don't you guys actually like learning new languages? Why?
- nailer 11y agoI think existing programmers sometimes forget that there's more people who /will/ program than who /do/ program. They have existing biases: towards extra tokens, separation of concerns by separating technologies rather than components, and other newer concepts that they legitimately do find strange. People making programming languages are much better suited by targeting non-programmers: existing devs are often simply not their audience.
- diezge 11y ago"People making programming languages are much better suited by targeting non-programmers: existing devs are often simply not their audience." In this case I'd argue it would be better for non-programmers to learn JavaScript before a language which compiles to it.
- nailer 11y agoI agree with that: these languages often don't have devtools, so they have to look at the compiled output to fix bugs. This makes for an unpleasant learning experinece. Once these tools fix the DevTools situation they'll be a lot more useful.
- sindreaa 11y agoImba is still lacking when it comes to devtools, but it does have full support for source mapping, and the sublime text plugin includes inline error messages from the compiler.
- psykovsky 11y agoI get a little confused when people say they "compile" x scripting language into y scripting language.
- madmaniak 11y agoI recommend it. Syntax for tags and tags inheritance is awesome. I keep my fingers crossed for Imba.
- mikkom 11y agoAs this seems to be some kind of javascript derivate using node.js on the backend (?) I'm interested in how this deals with async operations, ie. can you create functions which take a long time to run without blocking other users? This is especially important as they are targeting server side too.
- vertex-four 11y agoI'm not reading anything which suggests they're targeting server-side.
- jarcane 11y agoThis whole website is written in Imba. It uses the same code for server and client. After the initial load, all navigation in the browser is happening with history push/popState, and rendered directly on the client, yet any hard refresh should land you at the same spot when rendered from the server, thanks to using the same logic for routing as well. http://imba.io/guides#toc-examples-scrimbla http://imba.io/guides#toc-examples-scrimbla
- mikkom 11y agofrom http://imba.io/guides http://imba.io/guides What is Imba? Imba is a new programming language for the web that compiles to performant JavaScript. It is heavily inspired by ruby and python, but developed explicitly for web programming (both server and client).
- judofyr 11y agoImba itself is "just" a language which compiles to JavaScript and can be used both at the client- and the server-side. At the server-side you use the same techniques as in Node.js (callbacks/promises for I/O-bound concurrency; process pools for computational concurrency). Imba has syntax support for `await` (based on Promises) which helps quite a lot on concurrency-heavy code.
- creamyhorror 11y agoI've been following Imba for the past several months since the initial announcement on HN. I like the clean syntax, tags, and high performance, so I hope you guys attract interest despite all the library/framework fatigue we're experiencing in frontend JS land. It's rather refreshing to be able to write code and view all together, like <div.marker>.css(appropriate_styling) It would be great if you had some walked-through example apps on webpages (like the old site used to have). That kind of thing helps people better understand the benefits of your approach.
- SimeVidas 11y agoI think the HTML standard prohibits you from using non-standard tags like <clock> or <star>, unless they have a dash in them.
- sindreaa 11y agoAs you can see from inspecting the examples, any non-standard tag will use standard tags in the dom, with a class denoting their imba type.
- Kiro 11y agoThis can't be true. I use non-standard tags without dashes all the time for my custom directives in Angular.
- SimeVidas 11y agoI understand that it works in browsers. My point is about the HTML Standard disallowing it.
- acoard 11y agoNon-standard tags generally work in all browsers modern, but they aren't part of the spec. It's just like custom attributes which don't start with `data-`. They're recognized and work, but not strictly speaking legal. Your code fill fail HTML5 validation tests.
- codygman 11y agoHow does it compare to the amazingly fast ur/web?
- xaduha 11y agoIt doesn't? It's closer to Coffescript I think. ur/web might be hard to get into for someone who doesn't have ML or Haskell experience.
- chvid 11y agoWhy not use the more familiar C-syntax of JavaScript?
- fgtx 11y agoI came here to ask exactly that. Sounds to me like learn a new thing just for the hype of it...
- Ralfp 11y agoThis is actually a fork of Coffescript that used Python-inspired syntax.
- nv-vn 11y agoBecause trading familiarity for usability is not beneficial in 90% of cases.
- oneeyedpigeon 11y agoBut usability is very strongly affected by familiarity.
- wtetzner 11y agoOnly for a very short time.
- andybak 11y agoFunnily enough my first thought was "how nice - it's not cluttered with awful curly braces!" ;-) I'm a Python guy so that's probably half the reason - but the syntax looks nice and clean to me.
- estefan 11y agoAll these languages du jour should go out of their way to answer the question: "why bother?". 10x faster than react. OK cool. Except unless it has something like react native it's irrelevant if you might want to write an app in future with any sort of code reuse since you'll be tied to the web (unless you want the inevitable world-of-pain of trying to integrate this preprocessor into your xcode/android builds...).
- judofyr 11y agoA few months ago I played with ImbaKit (https://github.com/judofyr/ImbaKit https://github.com/judofyr/ImbaKit) which is essentially React Native iOS implemented on top of Imba. It's just an experiment for now, but there's only time and money which stops this from becoming a proper tool.
- andreash 11y agoNice. Why not call it Imba Native to make things clearer?
- cabalamat 11y ago> "why bother?". Surely the answer to that is obvious: because building webapps in js/html/css is a major pain in the arse.
- paxcoder 11y agoThis won't solve the problem of having to learn three different technologies, but whatever might mitigate the pain that we call JavaScript (quirks) is welcome. People who specialize in webdev learn things by heart so perhaps they forget how bad they are.
- JustSomeNobody 11y agoThese are devs who would rather build tools to build a web app than to build a web app. Different people have different itches. We don't have to consume what they produce. Just have to read about it on HN.
- tasqyn 11y agoin website it is written "Imba brings the best from Ruby ..." exactly what?
- woah 11y agoIs it actually 10x faster than React? If you're not doing shouldComponentUpdate, then the benchmark is misleading.
- sindreaa 11y agoReact and Imba can both optimize using shouldComponenUpdate (in Imba you would add the same logic inside node#commit). Utilising shouldComponentUpdate (in React and Imba) requires additional logic by the developer, not the framework. This is not an optimisation at the framework level - but an endpoint where the developer can write their own custom optimisations. Adding your own manual checks all around your app to check for statechanges is inelegant, cumbersome, and bug prone. In my opinion it defeats much of the purpose of a virtual dom, if you are expected to do your own diffing before sending it through. Also, the relative performance difference is about the same when turning it on. I fully stand behind the benchmark, and would even go as far as saying that it is more relevant for real world applications than benchmarks like dbmonster where everything in the view updates on every render. This effectively tries to calculate how quickly each contestant can reconcile the whole view (synchronously), but when only parts of the view has actually changed. Here is some additional discussion about the benchmark: https://github.com/somebee/imba/issues/9 https://github.com/somebee/imba/issues/9
- lhorie 11y agoI see you guys did a lot of work on improving the docs since last time you submitted. Keep up the good work!
- _Codemonkeyism 11y agoMy imba language: 10 GOSUB CREATE_WEB_APP_THAT_I_WANT 20 DEPLOY TO_CLOUD
- Lapsa 11y agocanihaz facebook for 200$
- tomcam 11y agoIt looks very much worth a try to me. Couldn't find anything about database bindings in the docs.
- tomcam 11y agoOK, that was handled very quickly on gitter! Just use something like knex.js, duh.
- davidw 11y agoWorlds collide: IMBA has meant International Mountain Bike Association to me for the past 25 years or so.
- nik736 11y agoFor me it's the short form for imbalanced ;-)
- scotty79 11y agoI love languages that understand indentation. Actually imba looks like many things I love mixed together.
- Keats 11y agoNon-closing html tags? Looking at the doc it seems it is using the same structure as hiccup or hyperscript except. What was the reasoning?
- adrusi 11y agoWell the rest of the language is indentation-based and lacks closing delimiters so it would be inconsistent for the embedded markup to have closing delimiters.
- tempodox 11y agoReminds me somewhat of Opa, http://opalang.org http://opalang.org
- WizardlySquid 11y agoReminds me of every other wannabe web programming language build in the past 10 years.
- arunix 11y ago“You must avenge my death Imba, ... I mean Simba.”
- tomlong 11y agoFinally, a new programming language for web apps.
- tomcam 11y agoSurprising how many comments are of the "why bother" variety as opposed to critiques of Imba itself.
- mruniverse 11y ago"why bother" should be the first question asked and first question answered (by the Imba team).
- FilterSweep 11y agoThis, as well as the fact that recent years have brought on new language fatigue from having a completely new language with its own syntax and its own pros and cons being shown every 6 months. "Why bother" is important.
- amelius 11y agoOk, so what is the reason it is more than 10x faster than React (as claimed on their web-page)?
- mako-taco 11y agoIf I had to guess, the use of requestAnimationFrame https://github.com/somebee/imba/blob/7ab3d380562b8e6cd09ab0942cfa8529ad65eedb/lib/imba/scheduler.js#L7 https://github.com/somebee/imba/blob/7ab3d380562b8e6cd09ab09...
- imaginenore 11y agoActually on their own benchmark page the imba example is the slowest. http://somebee.github.io/todomvc-render-benchmark/index.html http://somebee.github.io/todomvc-render-benchmark/index.html
- virtualSatai 11y agoWhat's your specs/browser? I get: http://i.imgur.com/dtKCSxL.png http://i.imgur.com/dtKCSxL.png in Waterfox 40.1.0, and http://i.imgur.com/4bu0Hev.png http://i.imgur.com/4bu0Hev.png in Chrome 47.0. 20x and 26x improvement over the slowest.
- gbersac 11y agoIsn't it pretty much the same thing as dart. Except dart also manage the backend and is already used and mature ?
- johnhenry 11y agoAt first glance, this seems a lot like elm. I wonder if anyone could point to a comparison of sorts?
- such_a_casual 11y agoThe syntax of this looks absolutely stunning. It gives the code a real beauty.
- felipellrocha 11y agoWhy are we still compiling to javascript, when we should be compiling down to WebAssembly?
- ianamartin 11y agoI have a backlog of personal projects of various kinds that I have been tinkering with for years now. But since I'm a back end guy, that's what I normally work on when I have free time. Every time I decide that I'm going to take the plunge and get down and dirty with front end stuff, I get completely paralyzed by choice, and I end up deciding that the most sensible way for me to move forward is to learn the fundamentals and design front ends with html + CSS + vanilla JavaScript. As you can imagine, my elegant back-end designs have interfaces the 90s would have deemed tacky. I really like the syntax (Python guy checking in here), but I don't even know where to start integrating this into a Pyramid app or what to do with it. I don't even know how to get started here. I have a market research app for building questionnaires. Like SurveyMonkey, but different. I want the front end to be trello-like so that you can move the questions around that way. I "know" JavaScript pretty well at this point. But when I look at the front end code for an open source trello clone, I swear it's just effing magic. Doesn't even relate in my mind to the language I thought I've been learning all this time. Since these kinds of threads tend to attract a lot of front end people, I thought I'd ask here: is this an appropriate language for a trello-like interface? There was a certain point in my career when I was learning Python when I went from knowing how to write classes and functions to being able to know what classes and functions to write to achieve my goals. I know how to do things in JS, but I have no idea what to do to accomplish my goals. Any tips from anyone?
- jestar_jokin 11y ago- Don't worry, there's only a few different paradigms in use by the different libraries and frameworks out there. Just look at the examples and see which one piques your interest. - Do some analysis to break down your problem into manageable steps, until you reach steps small enough to action. For example, a task tracking board might have the following components: columns (representing "status"), drag and drop (which changes the position of some DOM elements, plus updates the task status), and a form (to capture the task status). So, look for ways to solve each of those problems. e.g. column might be made easier using a grid layout system, such as provided by Bootstrap. Drag and drop can be handled using HTML5 features. And form handling can be made easier (or fancier) using any number of libraries out there. I wouldn't jump on a brand new language for the purpose of solving a problem, if you don't have a clear idea of the solution you would like to implement. Writing code is a means to an end, not a goal itself. It'd be easier to write a solution using methods you're familiar with, then rewriting it using different technologies.
- deleted 11y ago[deleted]
- ericathegreat 11y agoI like the syntax from the front end, but the details for back end seem a bit light on. I can't see much in the examples around persistence of data on the server side. Is this covered/planned?
- abatista111 11y agoI built this simple module pattern framework that makes building apps pretty simple. the idea is that everything is a controller (module patter) so you break you app into controllers or modules. https://github.com/ThinkAcademy/MasterControl https://github.com/ThinkAcademy/MasterControl check it out its open sourced by http://thinkacademy.io/ http://thinkacademy.io/