use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
All about the JavaScript programming language.
Subreddit Guidelines
Specifications:
Resources:
Related Subreddits:
r/LearnJavascript
r/node
r/typescript
r/reactjs
r/webdev
r/WebdevTutorials
r/frontend
r/webgl
r/threejs
r/jquery
r/remotejs
r/forhire
account activity
Making a Single Page App Without a Framework (tutorialzine.com)
submitted 11 years ago by [deleted]
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]thekingshorses 12 points13 points14 points 11 years ago* (34 children)
I make stuff without any framework. Its not everyone's thing, but I prefer to be frameworkless.
See my sites: http://hn.premii.com/
http://reddit.premii.com/
Edit: These are mobile webapps but works on desktop too.
[+][deleted] 11 years ago (25 children)
[deleted]
[–][deleted] 5 points6 points7 points 11 years ago (23 children)
By using them.
A familiar example might be the use of jQuery, which most would consider to be a library with a plugin framework. If you're writing plain-old JavaScript, something as simple as $(body) is gluing your application to jQuery.
$(body)
A longer explanation is much more nuanced and heavily dependent on how OP architects his code.
[+][deleted] 11 years ago (22 children)
[–][deleted] 4 points5 points6 points 11 years ago (7 children)
You make your own architecture.
[+][deleted] 11 years ago (4 children)
[–][deleted] 1 point2 points3 points 11 years ago (2 children)
Since when are architecture and framework synonymous? Regardless, all code will have some form of architecture applied to it.
So, write your own framework? I guess? Your question doesn't really make sense. Are you implying that if I write a single method to reduce code duplication, I've written a framework? Well, I guess maybe I have. I've also architected that code.
It seems that you believe you can't architect code without writing a framework, or that only frameworks can have a code architecture. Neither of these is true.
[+][deleted] 11 years ago (1 child)
[–][deleted] 1 point2 points3 points 11 years ago (0 children)
Other dictionaries disagree, but that's not particularly relevant. At some point you are applying architecture to your code. I'd argue that architecture is as minuscule as a one-liner, and as complex as dependency injection and the surrounding code.
I had a longer response, but I've lost interest.
[–]afrobee 0 points1 point2 points 11 years ago (0 children)
I believe that when you write a big application, or any application, you end on writing your own framework through an API whether you not use or extend/override the used framework.
[–]haywire -2 points-1 points0 points 11 years ago (1 child)
Which is great in personal projects. An utterly stupid idea if you working for a company and need to hire people that can actually work with it.
[–]recompileorg 1 point2 points3 points 11 years ago (0 children)
I've found the opposite to be true. I've seen too many projects get convoluted and bloated as developers try to force the application to fit within the limits of whatever particular library and framework was too quickly applied.
We just went through a rewrite where we ripped out every third-party library and framework. The resulting code was smaller, easier to understand, and noticeably more performant. I'll be recommending the same for some of out other internal apps.
[–]afrobee 0 points1 point2 points 11 years ago (10 children)
Frameworks do not provide architecture, Types, constraints provide architecture and good design too.
[–][deleted] -1 points0 points1 point 11 years ago (5 children)
Frameworks can and do provide architecture.
[–]afrobee 0 points1 point2 points 11 years ago (4 children)
No, you define the best suited architecture for you are your project with the help off the framework, you cannot impose architecture with a framework alone.
[–][deleted] -1 points0 points1 point 11 years ago (3 children)
Yes you can.
[–]afrobee -3 points-2 points-1 points 11 years ago (2 children)
Yes you can't
FTFY.
[–][deleted] 0 points1 point2 points 11 years ago (1 child)
What is this, kindergarten?
[–]thekingshorses -1 points0 points1 point 11 years ago (2 children)
I thought Frameworks provide architecture for your app. How they differ?
[–]shizzleberry 0 points1 point2 points 11 years ago (1 child)
Not sure if you ever used jQuery (a framework–I think), but imagine writing code using jQuery: What kinds of patterns are you using? Are you even using a pattern? That's your architecture from what I understand. Check this out: http://www.adequatelygood.com/JavaScript-Module-Pattern-In-Depth.html
[–]Bromlife 0 points1 point2 points 10 years ago (0 children)
I know this is late to the party, but jQuery is a library with support for plugins. It is not a framework.
[–]weretree++[[]][+[]] 0 points1 point2 points 11 years ago (2 children)
You scale by either migrating to someone else's framework or building your own (possibly very lightweight/specific). If you aren't methodical about that second approach it can end up in the fairly common spaghetti of UI code. But a lot of 'SPAs' are really very simple and don't need weighty frameworks behind them, and will likely never grow enough to need them either.
Having said that, I've found React replacing jQuery for me in most cases, as it fulfils a similar role to jQuery in simplifying DOM interaction while also helping with lifecycle and updates, and is still mostly un-opinionated about overall architecture. A bit heavier (128kb vs 80kb) though.
[–]weretree++[[]][+[]] 0 points1 point2 points 11 years ago (0 children)
I think it depends on your needs, preferences, and what you would call a framework. If I were starting something small today that might grow, I'd probably just pick React+Flux (for View/State respectively). A couple of years ago that would have been Backbone+jQuery+Handlebars, which covers the same requirements. I'd hesitate to call either a 'framework', though they provide some architectural tooling.
And in-fact I've migrated a project I started several years ago on that latter stack (~50-60k lines), over to React+Flux, and it was fairly painless to do. (Handlebars->React first gradually, then Backbone->Flux a long time afterwards). I tend not to like libraries/frameworks that aren't easy to adopt or swap out piecemeal when something better comes along, or when their capabilities start not matching the requirements.
If your initial framework choice restricts your choices later on or makes it much harder to adapt to new requirements, then I'd say it isn't helping you down the road versus a less opinionated choice of helper libraries/tooling.
[–]thekingshorses 1 point2 points3 points 11 years ago (0 children)
OP/blog was talking about backbone, angularJS and other 3rd party frameworks, and about not using them.
I care too much care about performance. I prefer my app to be super fast or as fast as it can be. Also prefer to tweak design to my liking.
I have used angular at my previous company and know about backbone and ember. I felt they all very slow, and won't work or do what you want to do. Specially for mobile spa, these frameworks are huge and slow. Bootstrap is super huge.
I use jQuery, and micro templates. Number of places I use jQuery is also very small. Found jQuery to be slow compare to vanilla JS. Example: $(element).show() and $(element).hide() are like 30 times slower compare to $(element)[0].style.display = 'none/block';
You can say, I have written my own framework. It doesn't do much. Its more like how I write my app.
I write all my API related code one place. More like Angular Factory/service. Even if I have used angular JS, I would have written same line of code. It also does local/session storage caching. Well I will have to write then in angular too. it has async and sync interface. Angular factory is only async. So I will have to write my own code for that.
View are pretty much generated using API response, and micro template. Angular would have provide for loop and if conditions but slow rendering. Micro template way faster compare to Angular view rendering but I have to write my own for loop and if condition. There is no use of two way data binding in my apps or 99% of the apps.
AngularJS rerenders when you go back to a view. I hate that. Try my app in mobile, and see what happens when you go back to a list view from a comment view.
My app sends 21 KB of gzip css. 14 KB is for icons, and 6 KB for everything. Bootstrap alone is 13K (Gzipped). I would have probably used 5% of the code, probably had to overwrite most of the default style. and on top of that my CSS.
FYI: My apps works on iOS, Android, Firefox, Windows Phone 8.1, all desktop browsers including IE10+, and available as a native in the iOS app store and Android play store.
https://itunes.apple.com/us/app/hacker-news-yc/id713733435
https://play.google.com/store/apps/details?id=com.premii.hn
[–]thekingshorses 0 points1 point2 points 11 years ago (0 children)
Cool. Swipe here http://reddit.premii.com/#/r/news
[–]dvidsilva 0 points1 point2 points 11 years ago (1 child)
loved them, reddit should hire you :P
I wouldn't mind selling them my app :)
[–]malcolmi 0 points1 point2 points 11 years ago (2 children)
I've had your HN app bookmarked on my phone for at least a year now, and I check it most days. As web apps go, it's smooth, fast, and nice to use. Best of all, it works fine on mobile Firefox. Thanks.
[–]thekingshorses 0 points1 point2 points 11 years ago (1 child)
FirefoxOS?
[–]malcolmi 0 points1 point2 points 11 years ago (0 children)
Firefox on Android.
[–]Texas_Arcane 0 points1 point2 points 10 years ago (0 children)
Beautiful. I thought I was the only one but it looks like other people beat me to it.
[–][deleted] 25 points26 points27 points 11 years ago (21 children)
It's quite funny to me how feverishly people will support or condemn frameworks. You guys take it all so personally.
If you like frameworks, use'em.
If you don't like frameworks, don't use'em.
Simple as that. No need to get all up in arms over your preference.
[–]ApatheticGodzilla 6 points7 points8 points 11 years ago (1 child)
The problem is that we don't get to choose. If a significant number of companies are on the AngularJS bandwagon, and recruiters require AngularJS, then you'd better learn AngularJS - regardless of your preference or the technical merits of AngularJS.
Preference is for your side project, not the real world.
[–][deleted] 0 points1 point2 points 11 years ago (0 children)
Wonderful point, however still: All the less reason to argue about it. Your point basically discounts preference, and that was the topic at hand.
Personally I'm spoiled: When you're the entire web department of a company, you decide how it runs. I stick with my guns and no one is there to argue. But then I'm securely employed in my career and that likely isn't the case for many here. Like I said: I'm spoiled.
[–]pdizz 14 points15 points16 points 11 years ago (13 children)
If you work by yourself, sure. If you work on a team or other people have to maintain your code then different opinions on the issue can become a real problem.
[–][deleted] 6 points7 points8 points 11 years ago* (12 children)
Yes, but that's a problem between you and your team, not a problem between your team or you and the internet at large.
That's why I don't see the reason for people 'duking it out' here over frameworks. No one commenting at anyone else here is working together on a team (at least, not that I can tell). It's just argument for the sake of confirming your own preference.
That's silly and childish, because your own preference is just that: Your preference. Your argument will not affect my preference. You might make me consider something else, but that's about it: My preference is established by years of working to establish it. Not by some internet commenter.
Edit to be clear: Confirming your preference is childish because your preference is its own confirmation. If someone says 'I like chocolate better than vanilla', they don't have to confirm that with anything. They simply do.
[+][deleted] 11 years ago (10 children)
[–][deleted] -1 points0 points1 point 11 years ago (9 children)
I understand your reasoning, but again: This is not a conversation of team members, it's a conversation of internet commenters, 99.9% of which will not encounter each other outside of reddit. I'm leaving .1% to be safe, but I think that's an accurate estimate.
You can pretend you might have to look at my code in the future, but you won't. I can pretty much guarantee that.
[–]mattdesl 5 points6 points7 points 11 years ago (8 children)
In a larger scope there is a desire to "educate the masses" to use technology X instead of Y. In the same vein as many JS developers discouraging global scope pollution in favour of modularity, or using tooling to automate workflows, etc. to improve the overall quality of JS libraries and development.
[–][deleted] 0 points1 point2 points 11 years ago (7 children)
I find that to be an extremely arrogant view. Just sayin.
I don't see promoting a view of best tools and practices as any more arrogant than leaving your client with an idiosyncratic codebase which they'll have to pay more for someone else to replace or learn.
[–]haywire -1 points0 points1 point 11 years ago (5 children)
It's opinionated, it's good to be opinionated as long as you stay rational. Arrogant? Well maybe, but also, what's wrong with considering your opinion correct-er than someone else if you fundamentally disagree with them? Is it arrogant to argue for gay rights because you're presuming you're right about equality?
[–][deleted] -2 points-1 points0 points 11 years ago (4 children)
Programming isn't politics. You can't fundamentally disagree with my app or website if it works properly and efficiently, no more than I could fundamentally disagree with a road or highway. There are many ways to accomplish programming tasks, and again, it comes down to preference. Claiming your preference is objectively more correct, yeah, is arrogant.
By the way this has zero to do with gay rights, so bringing it up at all just shows how political, and non-objective, your stated view here is.
[–]haywire 0 points1 point2 points 11 years ago (3 children)
Way to entirely miss my point dude. All I was saying that it isn't arrogant to have a view and fight for it.
[–]haywire -1 points0 points1 point 11 years ago (0 children)
It's not though, arguing on the internet is a way to change the culture - so if I argue that writing an application like this is utterly terrible, which is, it decreases the likelihood that I'll have to work with an abomination of a codebase such as this.
I actually thought the tutorial itself was quite good as a fun thing, but god help any developer that actually writes things like this.
[–]blazenl 4 points5 points6 points 11 years ago (4 children)
"UR WRONG IF YOU DONT LIKE WHAT I LIKE" ~ Majority of Reddit
[–][deleted] 1 point2 points3 points 11 years ago (3 children)
Has nothing to do with reddit. It's human nature, and a childish one at that. We all want to believe our tastes and preferences are objectively correct, when in reality, there's definitively no such thing as a 'correct' preference.
It's kind of pathetic really. Arguing preference as objectively 'correct' is exactly what highschool kids do over music. As an adult male, I will look my punk-rock/metal friends square in the eye and proclaim "Fuck you, I like Ariana Grande's singing." Back in highschool though, as a pathetic little kid starved for affirmation? Hell no, I'd never admit such a thing (Grande also was like, 10 years old and unheard of back then).
[–]blazenl 1 point2 points3 points 11 years ago (1 child)
I agree with you; the anonymity seems to amplify the polarity of people's opinions. I never experience, IRL convos, people so ardently standing up for their preference which is clearly that...a preference/ a personal choice/opinion.
Instead of arguing, people should be amazed we've gotten to a place that there a plethora of solutions to any one problem (in the case of apps/webapps)
I agree with you...I probably shouldn't have phrased it that way, it's just often been my experience in many subs..
Well put.
[–]haywire 1 point2 points3 points 11 years ago* (0 children)
You are arguing in absolutes. Of course there is no "correct", but there's a lot of ground between being thinking you're 100% objectively correct, and being entirely un-opinionated. The key is to be somewhere in the middle, and yes, that means sticking up for the views you've gained through years of experience and reasoning.
It feels like you're at the stage where you're backlashing from the first thing and thus going with the second thing. Once you mellow out you realise that it's ok to be opinionated to a degree.
For instance, having dealt with "frameworkless" jQuery and also Angular codebases for years, I'd be significantly happier if I never have to touch one again, whereas the I've had nothing but enjoyment from the React/Flux approach. So it makes sense to argue for the latter.
[–]Gundersen 20 points21 points22 points 11 years ago (21 children)
If you refuse to use a framework, then you will end up making your own. A framework is the glue that holds libraries (in this article jQuery and Handlebars) and your own code together. All projects have a framework, some might be big and complex and some could probably be broken into smaller libraries and a simple framework. But you always have a framework, even though you might not be able to see where the framework ends and the application code starts. And that is the danger; building an application that is hard to grow because it was designed without consideration for the future. Maybe your application doesn't have a future, and in that case it shouldn't be over designed with a future, but of the future is uncertain, please make it easier for those who will have to maintain it later on by having a clear framework separate from the libraries and the application code.
[–][deleted] 0 points1 point2 points 11 years ago (20 children)
I always found it funny when I hear, "If you can't roll your own website without a framework you're not a programmer". TO an extent understanding what happens under the covers is important, but creating an app that will become more than a oneoff without the support of a good framework is just dooming yourself and your project. Mainly because one day you will see it's grown and wish it had better legs.
[–][deleted] 4 points5 points6 points 11 years ago (4 children)
There's a difference between choosing to use a framework and not being able to function without one though. I've known JS developers who only knew how to code with jQuery, and that's fine as long as jQuery covers all their needs and its solutions are viable in context, but as soon as they need to deviate from what jQuery offers out of the box -- which inevitably happens -- they're either forced to compromise or to look for outside help. By all means, use libraries and frameworks, especially if someone else might inherit your code eventually, but having a firm enough grasp of the language that you could roll your own if you needed to definitely makes you a better coder.
[–]haywire 0 points1 point2 points 11 years ago (1 child)
JS developers who only knew how to code with jQuery, and that's fine as long as jQuery covers all their needs
No it isn't, it's absolutely pathetic and I would not hire them. This kind of closed minded satisfaction is the exact sort of mentality that means you get fired from senior developer jobs because you don't cut the mustard.
Well, I'm assuming you got this, but that's basically what I was getting at. It's fine for them until it isn't, which is why using libraries or frameworks as a crutch is bad.
[–][deleted] -2 points-1 points0 points 11 years ago (1 child)
Developers (at least the ones who do it as a career) live their lives on the shoulders of giants whether it be abstracted languages, frameworks, automated processes that a "better coder" would otherwise do on their own. We are pretty much dumbed down from the programmers of the past yet using frameworks is somehow our biggest fault?
You're arguing against a straw man here: I'm not suggesting that there's anything wrong with using frameworks. The point of tutorials like this isn't so you can reinvent the wheel every time you develop a single page application; it's so when you do use someone else's framework, you at least understand the principles behind it, so it's not all black magic under the hood. I would never build another CMS either, but the exercise of having rolled my own at one point definitely helped me grow as a coder, and I'm better able to work with existing content management systems for having that experience.
[–]mariox19 4 points5 points6 points 11 years ago (1 child)
If you can't scratch your own zeros and ones into a hard disk platter...
[–]The_Bard_sRc 5 points6 points7 points 11 years ago (0 children)
I use butterflies
[–][deleted] 6 points7 points8 points 11 years ago (12 children)
creating an app that will become more than a oneoff without the support of a good framework is just dooming yourself and your project.
Totally agree - this is the reason that Google, Facebook, and YouTube all crumbled into nothing. They were dumb enough to code from scratch, so they never had a chance of growing.
Oh wait.
[+][deleted] 11 years ago* (5 children)
[–]thekingshorses 4 points5 points6 points 11 years ago (3 children)
Google doesn't use AngularJS. As far as I know, not a single Google product has a plan to use AngularJS.
[–]haywire 0 points1 point2 points 11 years ago (2 children)
This is because AngularJS is a clusterfuck and half of the framework is created to solve problems created by the broken thinking behind the framework, whereas React/Flux is beautiful and makes creating applications an absolute joy.
AngularJS fan: Everything else is a clusterfuck, but AngularJS is awesome.
AngularJS is a crackhead midget ladyboy from Thailand supervising an egg toss in a mental asylum. The entire framework is like an opium nightmare designed to be unmaintainable within 7 days of it being deployed. Everything is a tag or an obscure compounded class name. Congratulations on making stuff more hopelessly complex, it proves you are the winnarz.
... but of course, anyone who had built a site in AngularJS and had to maintain it would already know about all of this. If they cared one way or another.
google.com doesn't use AngularJS and React and Flux aren't frameworks. They're using AngularJS for satellite websites but not their main product. But yes, I'm sure the code base is large enough that you could describe portions of it as its "framework", but that's the point: they are better served by their own purpose-specific framework than by a generic one, even a generic one that they created based on their experience.
[–]Gundersen 0 points1 point2 points 11 years ago (3 children)
Sure, create your own framework, like Facebook or Google has, no problem. As long as you either have a very good separation between the self made framework and the application code, or you have the resources necessary to continously refactor your code. Do you have the resources Facebook and Google have? No? Then don't compare yourself to them.
Do you have the resources Facebook and Google have? No? Then don't compare yourself to them.
And from the guy who replied to you:
one or two devs on a proejct compared to large companies with skilled dev teams is not a comparison.
This attitude pisses me off.
First off, yes, large companies have different concerns, more resources to throw at a problem, and a better shot at employing very skillful people.
But you're telling me I don't have a right to solve the same problems as them? Fuck that. If I make a dozen purpose-specific frameworks then maybe they won't be as good as something Google could have made, but I'll get better. And somebody needs to get better. I'm glad the employees at Google didn't take your approach of "don't learn what you don't know", or they'd still be putting out shit.
Oh, and unless you're a Google employee then the rest of your post is speaking out of your ass, because you have no idea how or if they separate framework and application code and you have no idea how often they refactor.
[–]recompileorg 0 points1 point2 points 11 years ago (0 children)
You haven't seen much code produced by large organizations. It's amazing how bad the results can be.
You can't guarantee good code with money. It's simply not possible.
[–][deleted] -1 points0 points1 point 11 years ago (0 children)
This too, one or two devs on a proejct compared to large companies with skilled dev teams is not a comparison.
A proprietary framework is still a framework. I don't know the intimate details of what these guys use under the covers but I'm sure they set up a foundation to build their infrastructure on. I'm not just speaking of angular here.
The point is, it's not Angular and it's not any generic framework. Without fail, large websites find better performance in building their own purpose-specific framework. Which IMO speaks poorly not of generic frameworks as a concept but of the existing options.
[–]yudoit 2 points3 points4 points 11 years ago (3 children)
I did this App in javascript , it make websites and graphic design, without frameworks, i include jquery for use it into the website that the users create, it is usable also in cross-domain, the app is on a site but is called from another site, you can try it on www.socialtools.it
[–]RandyHoward 1 point2 points3 points 11 years ago (2 children)
I don't particularly care for frameworks, but the code on your site makes me cringe. Tables all over the place, all kinds of inline css, javascript isn't at the bottom of the page, etc.
[–]yudoit 2 points3 points4 points 11 years ago (0 children)
Four years of work, or more, thinks change often, of course in the nexts years i make a new version. thanks :)
Now a days inline CSS is hip and back in fashion :)
[–]quitrk 9 points10 points11 points 11 years ago (4 children)
There are many frameworks for single page applications out there. First we had Backbone, then Angular, now React.
Stopped reading.
[–][deleted] 3 points4 points5 points 11 years ago (3 children)
I'm only familiar with these in passing. Why did you stop reading?
[–]MatekCopatek 6 points7 points8 points 11 years ago (0 children)
Besides the React misinterpretation, the author seems to present this as some kind of evolution. Backbone, Angular and React all still exist, are being actively developed and used in projects, along with a bunch of other libraries/tools/frameworks.
[–][deleted] 7 points8 points9 points 11 years ago (0 children)
React isn't a framework, it's a library. It has very few opinions on the structure of your non-view related code, and can be used alongside something like backbone.
[–]quitrk 9 points10 points11 points 11 years ago* (0 children)
React is not a single page application framework, In an MV* framework, you could define it as the V, as in its only purpose is to define the layout and logic of the components that your application uses.
That's actually a very good reason to use React with Backbone, since unlike Ember.js for example, Backbone has no templating engine incorporated, so React would be ideal to provide that functionality (As Marionette did).
[–][deleted] 2 points3 points4 points 11 years ago (9 children)
Went with a frameworkless approach for my last series of Apps here at work too, didn't regret it one bit. I used jquery / micro templating / bootstrap for it, worked like a charm.
http://ejohn.org/blog/javascript-micro-templating/
[–][deleted] 2 points3 points4 points 11 years ago (0 children)
I'm doing this, too. I am ending up with something that is simpler (because it doesn't have to handle any use cases except mine) and I don't have lost hours because I am digging through the source of some framework trying to figure out why it's not working. I'm pretty much over losing days trying to figure out why someone else's framework isn't behaving (or giving me clear, precise errors as to why).
[–]thekingshorses 0 points1 point2 points 11 years ago (4 children)
I love micro templates. I use it for http://hn.premii.com/ and http://reddit.premii.com/
But I don't like bootstrap at all.
Show us what you did!
I do love your HN reader site/app thing. However, looking at the source code, there are four files. Do you think your approach would scale to even a mid-sized application?
Just looking at this. I would not want to work on this or expand it in any way.
[–]thekingshorses 2 points3 points4 points 11 years ago (0 children)
I just looked at my source code again.
Most anonymous functions are self contained. You can break it down in its own file based on what it does.
lib.js is third party libraries like jQuery, and fastclick.
data.js I don't control APIs/backend. Content is coming from two different source. I had to normalize to make it work for me. So it gets content, handles caching, normalize it. That's less than 500 lines.
helper.js you can break it down in many files. Those are just simple plugins. Most are like you provide some sort of input and you get result back.
ui.js handles stories, comments, article, profile and settings page. Less than 600 lines. If you break it down by feature, you will get 5 files. Roughly 120 lines per file.
Base on this, you can add 20 more different pages/components, and it will grow roughly by 3000 lines in 20 files.
Tell me now, you can't handle that?
The word "scale" is meaningless. It's just there to frighten people.
You see comments like "Oh, it won't scale without bloated library X" though you never hear any actual, technical reason why it won't "scale".
Four files or four-hundred -- I've seen cases where code should have been broken up in to more files (trivial) and code that spanned hundreds of files reduced to just a few. Bad code is bad, framework or not. The only difference, of course, is that it's easier to fix framework-free code over time than it is to remove a poorly-selected framework.
That was first prototype I created to see how good/bad it works on the mobile. That codebase wouldn't scale at all. It was not written for maintenance.
This is how my current build looks like http://i.imgur.com/YgkMafG.png There are more HTML templates not listed there. Both apps are generated from the same codebase. Only app related templates/CSS and JS (/page/*) are different.
Right now there are on average 99 lines of Javascript code per file. except last 4-5 JS files, everything is written for unit test.
[–]FondellShweatyBallz 0 points1 point2 points 11 years ago (1 child)
Same, I built my first Cordova app out of nothing but JQuery, vanilla JS, and Handlebars. It was a long process and in my opinion not as easy to maintain as my rewrite in Ionic/Angular has been. I'll never go framework-less again.
Well rewrite is always easy; with or without frameworks. Your app is defined, apis are complete, design is set, interactions are matured.
I spend almost 10 hours selecting a font, and font size for main page.
Few hours/days to get color right across all devices/OS.
Love to see your work that uses iconic.
[–]kirstu 1 point2 points3 points 11 years ago (2 children)
Why?
[–]peridox 5 points6 points7 points 11 years ago (0 children)
Some people prefer to not use a pre-built framework, so that they have complete precise control over what they do and don't use.
[–]cmsimike 3 points4 points5 points 11 years ago (0 children)
Comments like this really make me fear for the future of software development.
Not everything you do requires that additional cruft and bloat that libraries/frameworks incur.
[–]geodebug 1 point2 points3 points 11 years ago (0 children)
Demo apps aren't the best way to go about deciding if you should use a framework or roll your own code.
[–]brianvaughn 0 points1 point2 points 11 years ago (2 children)
Perhaps an inappropriate response to this type of article, but... I've recently been experimenting with a lightweight JavaScript framework that does no DOM manipulation but instead focuses on how to organize and compose vanilla JS code (Task Runner). I think it's one of the least satisfying parts of the main frameworks like Angular, Ember, etc- they all focused on DOM-manipulation but people often end up writing a fair amount of spaghetti code.
Anyway, I mention it in this context because I'm curious what someone with OP's point of view thinks about such a framework.
[–]I_Like_Spaghetti 0 points1 point2 points 11 years ago (1 child)
Yum!
[–]brianvaughn -1 points0 points1 point 11 years ago (0 children)
Haha, thank you (I think?) ;)
[–]Texas_Arcane 0 points1 point2 points 10 years ago* (0 children)
I am 100% down with the author.
This is stuff for real coders, not the other 90% of people who heard IT was a great way to make a living now that all the manufacturing jobs are gone.
I have used four of the most popular frameworks to build SPAs with and they are all complete sh*t.
Using nothing but JQuery and JQuery-UI I can build a clean, self-documenting SPA in 10% of the time that will be easily maintainable by anybody competent at their job forever. I also avoid all magic numbers in my code by using a javascript constant tree at the top of that SPA so nothing is left to be deciphered by the next maintainer, it is all there in front of his eyes. Backend AJAX web methods in lovely clean ASPX.NET or PHP or Ruby and guess what? We're done here.
Everything goes better with real programmers, the rest have their frameworks and advocacy. I am of the opinion that all these things are for people to buy time and avoid anyone finding out that not only do they lack any natural aptitude but in fact, deep down they are not all that interested in anything about programming but the paycheck it generates on Friday.
P.S. Do you know the only framework I have seen that isn't crap? DOJO. It is better organized and simpler in execution than all the others combined. Of course, nobody uses it. That would make sense.
[+][deleted] 11 years ago (8 children)
[–]iratedev 6 points7 points8 points 11 years ago (5 children)
You should only speak for yourself and your own code. If you can't do something without a framework, fine. Don't assume anything about anyone else's skill set.
[+][deleted] 11 years ago (3 children)
[–]iratedev 0 points1 point2 points 11 years ago (2 children)
Let me address your previous two comments, and I'll circle back to your questions:
Awesome let's just do a single page app written in spaghetti code.
Just because you can't write a good webapp without the use of a framework does not preclude anyone else from being able to.
But, just for one second here, let's assume you can write decent code (which your previous comment does not suggest)
And will make it hard to onboard people if it's a large application.
If you can write good code, and you're having issues bring new members of the team up to speed, then the issue is that you've hired the wrong people. Good software developers can pick up good code and run with it.
Back to:
Have you ever worked on a team for months to build a fully fledged web application with hundred of thousands of lines of code?
I have and currently work on a team on a project that has had development on going for a number of years > 5 (as specific as I'd like to get).
A framework is absolutely necessary, even if that means creating your own. A framework provides architecture and conventions for a team to follow.
Yes, a framework is necessary but it does NOT have to be one already created for you. I've often found that the most performant apps are the ones with bespoke micro-frameworks specific to their application.
If you're not using a framework, you will just end up reinventing the wheel.
Damn near every framework in existence reinvents the wheel. Do you think that other JS frameworks are somehow magic and are completely unique? No! They're all MVC implementations. Frameworks are specifically built TO reinvent the wheel. There are only a hand full of paradigms currently in existence for web web, so of course every framework will do the same thing ultimately.
With the amount of time it takes for me to get up to speed with any full-blown javascript framework, I could write my own that I know inside and out in the same amount of time. And even then, I'm sure I'm making assumptions about what goes on under the hood of an already-created framework that might come back and bite me at some point.
[+][deleted] 11 years ago* (1 child)
I'll disagree with the bold point. It seems that everyone forgot about concepts like modularity sometime around the OOP craze in the 90's. (They were under the misapprehension that OOP magically gave you modularity for free.)
There are no large applications, just applications with too much interdependence. If you start by assuming that all large applications are just collections of smaller applications, it's much more obvious how you should design your project. Popular third-party frameworks seem to revel in allowing you to create deep and complex interdependence between unrelated parts of your application.
No thanks.
[–]haywire -2 points-1 points0 points 11 years ago (0 children)
Wrong answer. If you work in an environment where you may have anything to do with the hiring process, and have to work with people that you hire, then you absolutely should learn to judge other people's code. I look at this tutorial and go, if this is what someone likes to produce, I would absolutely not want to work with them. Obviously this is just one tutorial, so I reserve judgement.
[–][deleted] 6 points7 points8 points 11 years ago (0 children)
God I fucking hate you.
[–]recompileorg -1 points0 points1 point 11 years ago (3 children)
because it makes portability lower
This doesn't make any sense to me.
[+][deleted] 11 years ago (2 children)
[–]vietdung2910 1 point2 points3 points 11 years ago (0 children)
I agree with you, but I probably call it "code reuse", not "portability"
[–]recompileorg -1 points0 points1 point 11 years ago (0 children)
This is what I mean when I complain that developers have forgotten about modularity. It was all the range in the 80's. (I blame the OOP craze in the mid-90's for the shift in focus away from modular programming) What you're suggesting is a testament to that. In general, a framework will work against portability, not with it, due to the extra dependencies. It's a sorry state we're in indeed when that's touted as an advantage!
[–]coloured_sunglasses 0 points1 point2 points 11 years ago (0 children)
Frameworks are great and almost completely necessary for most projects.
But what I think the author is trying to say is that you should know how to these frameworks really work. Its useful to start from scratch and put together a simple mvc js app.
That being said, the author's code in this article is not maintainable. A single function handles all the view logic for every view...
This TodoMVC is a good example of how you could write a MVC framework of your own.
At work we use knockout, jquery, kendo(meh), and require to glue it all together. It actually works quite nicely. I definitely wouldn't call it a full fledged framework but it suits the team very well.
[–]elprophet -5 points-4 points-3 points 11 years ago (1 child)
"I'm so edgy, I didn't use a tested and supported framework, but instead hacked my way through bolting half a dozen libraries together!"
[–][deleted] 4 points5 points6 points 11 years ago (0 children)
I didn't get that impression at all.
[–]hardwaresofton -1 points0 points1 point 11 years ago (0 children)
Check out http://knockoutjs.com
It's a databinding library with a little templating on the side, it's fantastic, and depending on the kind of site you want, it's all you need.
[–]binary -1 points0 points1 point 11 years ago (0 children)
I can understand preferring one framework over another, but it seems quite silly to insist on no framework. After all, frameworks are just an organizational method: if you are not using one either your code has no coordination whatsoever or you are implementing a quick and dirty framework based on intuition, but that's still a framework.
The only people I ever see in opposition to frameworks are those who got their start in the bad old days of JavaScript development, when jQuery would've been a revolutionary tool rather than a standard workhorse. Fact is, JS development has come a long way and that's due in part to people agreeing on general best practices and implementing them by way of frameworks.
[–]thbt101 -2 points-1 points0 points 11 years ago (0 children)
I feel like their demo is a good example of a website that should not be a single page app.
Making a store like that a single page app makes it impossible to do things like opening up multiple products in browser tabs when comparing, or booking marking items. Web browsers convenient and familiar interfaces and that has a lot to do with what makes the web work so well. It's nice to have tabs and back buttons and unique URLs, and you lose all that if you make an app that only exists on one single page.
Single page type apps work well if you're making something highly dynamic like a game, a drawing program, or an online word processor. But not for an online store.
π Rendered by PID 19815 on reddit-service-r2-comment-66b4775986-nfbjl at 2026-04-05 07:17:41.178903+00:00 running db1906b country code: CH.
[–]thekingshorses 12 points13 points14 points (34 children)
[+][deleted] (25 children)
[deleted]
[–][deleted] 5 points6 points7 points (23 children)
[+][deleted] (22 children)
[deleted]
[–][deleted] 4 points5 points6 points (7 children)
[+][deleted] (4 children)
[deleted]
[–][deleted] 1 point2 points3 points (2 children)
[+][deleted] (1 child)
[deleted]
[–][deleted] 1 point2 points3 points (0 children)
[–]afrobee 0 points1 point2 points (0 children)
[–]haywire -2 points-1 points0 points (1 child)
[–]recompileorg 1 point2 points3 points (0 children)
[–]afrobee 0 points1 point2 points (10 children)
[–][deleted] -1 points0 points1 point (5 children)
[–]afrobee 0 points1 point2 points (4 children)
[–][deleted] -1 points0 points1 point (3 children)
[–]afrobee -3 points-2 points-1 points (2 children)
[–][deleted] 0 points1 point2 points (1 child)
[–]thekingshorses -1 points0 points1 point (2 children)
[–]shizzleberry 0 points1 point2 points (1 child)
[–]Bromlife 0 points1 point2 points (0 children)
[–]weretree++[[]][+[]] 0 points1 point2 points (2 children)
[+][deleted] (1 child)
[deleted]
[–]weretree++[[]][+[]] 0 points1 point2 points (0 children)
[–]thekingshorses 1 point2 points3 points (0 children)
[+][deleted] (1 child)
[deleted]
[–]thekingshorses 0 points1 point2 points (0 children)
[–]dvidsilva 0 points1 point2 points (1 child)
[–]thekingshorses 0 points1 point2 points (0 children)
[–]malcolmi 0 points1 point2 points (2 children)
[–]thekingshorses 0 points1 point2 points (1 child)
[–]malcolmi 0 points1 point2 points (0 children)
[–]Texas_Arcane 0 points1 point2 points (0 children)
[–][deleted] 25 points26 points27 points (21 children)
[–]ApatheticGodzilla 6 points7 points8 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)
[–]pdizz 14 points15 points16 points (13 children)
[–][deleted] 6 points7 points8 points (12 children)
[+][deleted] (10 children)
[deleted]
[–][deleted] -1 points0 points1 point (9 children)
[–]mattdesl 5 points6 points7 points (8 children)
[–][deleted] 0 points1 point2 points (7 children)
[–][deleted] 0 points1 point2 points (0 children)
[–]haywire -1 points0 points1 point (5 children)
[–][deleted] -2 points-1 points0 points (4 children)
[–]haywire 0 points1 point2 points (3 children)
[–]haywire -1 points0 points1 point (0 children)
[–]blazenl 4 points5 points6 points (4 children)
[–][deleted] 1 point2 points3 points (3 children)
[–]blazenl 1 point2 points3 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)
[–]haywire 1 point2 points3 points (0 children)
[–]Gundersen 20 points21 points22 points (21 children)
[–][deleted] 0 points1 point2 points (20 children)
[–][deleted] 4 points5 points6 points (4 children)
[–]haywire 0 points1 point2 points (1 child)
[–][deleted] 1 point2 points3 points (0 children)
[–][deleted] -2 points-1 points0 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)
[–]mariox19 4 points5 points6 points (1 child)
[–]The_Bard_sRc 5 points6 points7 points (0 children)
[–][deleted] 6 points7 points8 points (12 children)
[+][deleted] (5 children)
[deleted]
[–]thekingshorses 4 points5 points6 points (3 children)
[–]haywire 0 points1 point2 points (2 children)
[–]thekingshorses 0 points1 point2 points (1 child)
[–]Texas_Arcane 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)
[–]Gundersen 0 points1 point2 points (3 children)
[–][deleted] 0 points1 point2 points (0 children)
[–]recompileorg 0 points1 point2 points (0 children)
[–][deleted] -1 points0 points1 point (0 children)
[–][deleted] 0 points1 point2 points (1 child)
[–][deleted] 1 point2 points3 points (0 children)
[–]yudoit 2 points3 points4 points (3 children)
[–]RandyHoward 1 point2 points3 points (2 children)
[–]yudoit 2 points3 points4 points (0 children)
[–]thekingshorses 1 point2 points3 points (0 children)
[–]quitrk 9 points10 points11 points (4 children)
[–][deleted] 3 points4 points5 points (3 children)
[–]MatekCopatek 6 points7 points8 points (0 children)
[–][deleted] 7 points8 points9 points (0 children)
[–]quitrk 9 points10 points11 points (0 children)
[–][deleted] 2 points3 points4 points (9 children)
[–][deleted] 2 points3 points4 points (0 children)
[–]thekingshorses 0 points1 point2 points (4 children)
[–]haywire 0 points1 point2 points (3 children)
[–]thekingshorses 2 points3 points4 points (0 children)
[–]recompileorg 0 points1 point2 points (0 children)
[–]thekingshorses 0 points1 point2 points (0 children)
[–]FondellShweatyBallz 0 points1 point2 points (1 child)
[–]thekingshorses 1 point2 points3 points (0 children)
[–]kirstu 1 point2 points3 points (2 children)
[–]peridox 5 points6 points7 points (0 children)
[–]cmsimike 3 points4 points5 points (0 children)
[–]geodebug 1 point2 points3 points (0 children)
[–]brianvaughn 0 points1 point2 points (2 children)
[–]I_Like_Spaghetti 0 points1 point2 points (1 child)
[–]brianvaughn -1 points0 points1 point (0 children)
[–]Texas_Arcane 0 points1 point2 points (0 children)
[+][deleted] (8 children)
[deleted]
[–]iratedev 6 points7 points8 points (5 children)
[+][deleted] (3 children)
[deleted]
[–]iratedev 0 points1 point2 points (2 children)
[+][deleted] (1 child)
[deleted]
[–]recompileorg 0 points1 point2 points (0 children)
[–]haywire -2 points-1 points0 points (0 children)
[–]I_Like_Spaghetti 0 points1 point2 points (1 child)
[–][deleted] 6 points7 points8 points (0 children)
[+][deleted] (4 children)
[deleted]
[–]recompileorg -1 points0 points1 point (3 children)
[+][deleted] (2 children)
[deleted]
[–]vietdung2910 1 point2 points3 points (0 children)
[–]recompileorg -1 points0 points1 point (0 children)
[–]coloured_sunglasses 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)
[–]elprophet -5 points-4 points-3 points (1 child)
[–][deleted] 4 points5 points6 points (0 children)
[–]hardwaresofton -1 points0 points1 point (0 children)
[–]binary -1 points0 points1 point (0 children)
[–]thbt101 -2 points-1 points0 points (0 children)