TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

FOAM: New JavaScript Framework by Google Engineers

145 点作者 oscarfr大约 10 年前

26 条评论

jasim大约 10 年前
This is a bold take on a problem that a lot of people have written away as reinventing the wheel. But color me impressed!<p>Unlike almost every other Javascript framework we&#x27;ve so far seen, FOAM makes the data model the primary entity in the system, which is a good idea. In the typical UI-driven development of web applications, the data model often gets modified without much thought and causes cascading complexity across the rest of the system. A lot of the convoluted UI code that I&#x27;ve written could&#x27;ve been kept simple by keeping the data model sane by finding and utilizing equivalences, making implied meaning explicit by extracting names, and normalizing&#x2F;denormalizing the data appropriately. A data-structure driven development approach should help a lot here.<p>FOAM also implements another item from my wishlist: being able to see all the UI representation of any given piece of data in one place. It achieves this by keeping all possible templates for a piece of data directly in its object. (<a href="http:&#x2F;&#x2F;foam-framework.github.io&#x2F;foam&#x2F;tutorial&#x2F;4-templates&#x2F;" rel="nofollow">http:&#x2F;&#x2F;foam-framework.github.io&#x2F;foam&#x2F;tutorial&#x2F;4-templates&#x2F;</a>)<p>In general, this looks like the most declarative (as in, define your business requirements instead of writing imperative code) way of building web applications that I&#x27;ve seen yet. I would like to see what new ideas this library can bring into the &#x27;Perfect UI Framework&#x27; conversation, but past experience makes me skeptical of any implementation that overly relies on metaprogramming. Metaprogramming can take us maybe 50% of the way home, but programming unfortunately is often an art in the minutiae. UI code is especially prone to this problem: things that have to deal with humans cannot be absolutely symmetrical all the time, which is where any overly declarative approach to building software breaks down. I often look back to this quote by DHH as a reminder of the dangers in generalization:<p><pre><code> On the surface, the dream of components sounds great and cursory overviews of new projects also appear to be &quot;a perfect fit&quot;. But they never are. Reuse is hard. Parameterized reuse is even harder. And in the end, you&#x27;re left with all the complexity of a swiss army knife that does everything for no one at great cost and pain. - DHH ca. 2005 </code></pre> Also, template based UI frameworks are IMO a relic of the past, of which I&#x27;m convinced by the way templates are defined imperatively using code in React. In templating, the UI is a String, but UI should be Code because code is awesome.
评论 #9445712 未加载
评论 #9445698 未加载
seizmo大约 10 年前
One thing you notice right off the bat: Its very slow. It takes about 2s on my machine to load the TodoMVC example. Thats about as long as it takes to load my GMail inbox. Thats pretty horrible for whats supposed to be the &quot;Hello World&quot; of JS frameworks. I didnt dig in what actually takes so long, but it seems like it has still some way to go.<p>I find it interesting that after Angular this would the second (3rd if you count GWT) JS framework released by Google with pretty bad performance characteristics (if it actually is made be Google).
评论 #9467964 未加载
评论 #9445519 未加载
评论 #9450025 未加载
评论 #9446970 未加载
yedpodtrzitko大约 10 年前
I use Google&#x27;s Javascript framework. GWT? No, the other one. Polymer? No, the other one! AngularJS? No, the other one!!
评论 #9445755 未加载
评论 #9447449 未加载
jreimers大约 10 年前
&gt; FOAM is a full-stack Reactive MVC Meta-Programming framework.<p>Inevitably reminds me of this: <a href="http:&#x2F;&#x2F;html9responsiveboilerstrapjs.com&#x2F;" rel="nofollow">http:&#x2F;&#x2F;html9responsiveboilerstrapjs.com&#x2F;</a><p>I understand MVC, but what is reactive meta-programming exactly?
评论 #9447498 未加载
Rifu大约 10 年前
Doesn&#x27;t seem to actually be by Google. Perhaps the title could be changed to &quot;by a Google Engineer&quot;?
评论 #9445885 未加载
评论 #9445539 未加载
评论 #9468287 未加载
评论 #9446307 未加载
forgottenacc56大约 10 年前
Just today I was thinking &quot;there&#x27;s not enough ajavaScript frameworks.&quot;, and BANG! Google solves my problem. Nice.
peeyek大约 10 年前
I&#x27;m not sure this framework is endorsed by Google. I can&#x27;t find &quot;by Google&quot; on the home page nor about page.
评论 #9445301 未加载
评论 #9445332 未加载
thomasfl大约 10 年前
It&#x27;s about time more people starts using ES6 class constructors instead of rolling their class definition hack. This is how it&#x27;s done in the calculator demo:<p><pre><code> CLASS({ name: &#x27;Calc&#x27; </code></pre> With babeljs you can use ES6 syntax like this:<p><pre><code> class Calc { }</code></pre>
评论 #9445610 未加载
rattray大约 10 年前
Five clicks in and I&#x27;m still not sure what it really is&#x2F;does...
评论 #9445335 未加载
glutamate大约 10 年前
On the demos page<p><a href="http:&#x2F;&#x2F;foam-framework.github.io&#x2F;foam&#x2F;foam&#x2F;demos&#x2F;DemoCat.html" rel="nofollow">http:&#x2F;&#x2F;foam-framework.github.io&#x2F;foam&#x2F;foam&#x2F;demos&#x2F;DemoCat.html</a><p>All the links to &quot;Source&quot; take me to GitHub 404.<p>I would suggest this is the most important part of showcasing a new project.
评论 #9445397 未加载
tacone大约 10 年前
It does not seem a new thing, rather an old one just migrated it to Github.<p>It has 8,474 commits. The first commit (and also the first issue on Google code) dates back to Jul 30th 2012. And it was just the first public release, not an empty commit (43 files).<p>(first issue: <a href="https:&#x2F;&#x2F;code.google.com&#x2F;p&#x2F;foam-framework&#x2F;issues&#x2F;detail?id=1" rel="nofollow">https:&#x2F;&#x2F;code.google.com&#x2F;p&#x2F;foam-framework&#x2F;issues&#x2F;detail?id=1</a> )
blitzprog大约 10 年前
Regardless of how good it is, the presentation could and should be improved. Quick to grasp examples, an explanation telling me <i>which problems this project solves</i> and as a bonus how it compares to other frameworks. All of this should be on the GitHub readme frontpage. Poor presentation is like a 0.01 multiplier for your amount of potential users. It&#x27;s easy to avert your eyes from this but it&#x27;s almost as important as the quality of the product itself.
some1else大约 10 年前
A first glance of the docs I see the components aspire to a declarative style (being defined entirely in JSON). I&#x27;m wondering though, why not use composition[1] instead of inheritance? I need to take a better look to see how view composition would work in FOAM.. But I can tell from experience with Backbone, that using composition instead of inheritance improves code structure and increases maintainability. If composition was a first-class construct (like they made extendsModel), it would get a lot of issues out of the way.<p>[1] <a href="http:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Composition_over_inheritance" rel="nofollow">http:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Composition_over_inheritance</a>
评论 #9445260 未加载
staltz大约 10 年前
They say it&#x27;s reactive, but this is how they explained &quot;reactive&quot;: <a href="https:&#x2F;&#x2F;foam-framework.github.io&#x2F;foam&#x2F;foam&#x2F;apps&#x2F;overflow&#x2F;Overflow.html#q12" rel="nofollow">https:&#x2F;&#x2F;foam-framework.github.io&#x2F;foam&#x2F;foam&#x2F;apps&#x2F;overflow&#x2F;Ove...</a> and <a href="https:&#x2F;&#x2F;github.com&#x2F;foam-framework&#x2F;foam&#x2F;wiki&#x2F;KeyConcepts#reactive-programming" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;foam-framework&#x2F;foam&#x2F;wiki&#x2F;KeyConcepts#reac...</a>
exit大约 10 年前
looking at the todo example, i was perplexed by the way templates are inlined through comments:<p><a href="https:&#x2F;&#x2F;github.com&#x2F;foam-framework&#x2F;foam&#x2F;blob&#x2F;master&#x2F;apps&#x2F;todo&#x2F;Todo.js" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;foam-framework&#x2F;foam&#x2F;blob&#x2F;master&#x2F;apps&#x2F;todo...</a><p>it led me to discover that the full text of a function can be reflected through .toString() ...<p>i&#x27;m not sure i&#x27;d be happy to see this approach widely adopted though. it feels like a language hack, like <i>maybe</i> js needs a multiline literal string..
评论 #9445719 未加载
评论 #9446058 未加载
nicksellen大约 10 年前
Use of ES6 classes would have been nice and I&#x27;d prefer to work with simple javascript objects to hold data vs rich model objects (<a href="http:&#x2F;&#x2F;foam-framework.github.io&#x2F;foam&#x2F;tutorial&#x2F;2-model&#x2F;" rel="nofollow">http:&#x2F;&#x2F;foam-framework.github.io&#x2F;foam&#x2F;tutorial&#x2F;2-model&#x2F;</a>).<p>I don&#x27;t think this is the framework for me.
bootload大约 10 年前
interesting look, example documentation a bit spotty (pages missing eg: <a href="http:&#x2F;&#x2F;foam-framework.github.io&#x2F;foam&#x2F;foam&#x2F;demos&#x2F;" rel="nofollow">http:&#x2F;&#x2F;foam-framework.github.io&#x2F;foam&#x2F;foam&#x2F;demos&#x2F;</a> &amp; others), rest of the docs ok.<p>What do I see? It&#x27;s language centric, that&#x27;s good and bad. The good bit is you can with a very small JS lib write code to generate a dynamic page. The bad bit: as the language grows and rusts, you have to chase down the removed features. Much easier to grasp in concept and execution than Angular.<p>Loved this bit in the calc demo source, testing: <a href="https:&#x2F;&#x2F;github.com&#x2F;foam-framework&#x2F;foam&#x2F;blob&#x2F;master&#x2F;apps&#x2F;acalc&#x2F;Tests.js" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;foam-framework&#x2F;foam&#x2F;blob&#x2F;master&#x2F;apps&#x2F;acal...</a><p>Q. Is foam an attempt to create a framework for Mobile Apps?
tn13大约 10 年前
Another &quot;higher performance&quot; framework! At least dont throw these phrases around.
评论 #9467980 未加载
kgr大约 10 年前
Video of the FOAM Empire.js presentation is now available at:<p><a href="https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=n699DWb2TUs" rel="nofollow">https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=n699DWb2TUs</a>
wanda大约 10 年前
Seems similar to this: <a href="http:&#x2F;&#x2F;jsblocks.com" rel="nofollow">http:&#x2F;&#x2F;jsblocks.com</a>
pekk大约 10 年前
Would someone mind very simply explaining how this relates to (or differs from) Angular?
electic大约 10 年前
It seems every week there is a new javascript framework.
评论 #9446625 未加载
brianhama大约 10 年前
This sounds a lot like Microsoft&#x27;s TypeScript.
nthcolumn大约 10 年前
Good God it&#x27;s beautiful
venomsnake大约 10 年前
&gt; FOAM is a full-stack Reactive MVC Meta-Programming framework.<p>5 years ago I would have thought that this would have been the title of the tech section of Onion article ...
评论 #9449328 未加载
评论 #9446105 未加载
评论 #9446734 未加载
评论 #9446568 未加载
elcct大约 10 年前
It&#x27;s been like 5 seconds since last new JavaScript framework was released. I really started to worry, so thanks for this post.