Jackdaw's Nest A Web Log

[ Log ] [ Projects ] [ About ]

Posts tagged with javascript

# Ember Frustration, Data Relationships 2017/09/13

I've been building a large web app for about two years. The front end is made with Ember.js. We have a team of two people and for both of us this was the first really large scale single page app we have written.

Honeymoon Period

Ember was very good to start with. It gave us all the build tools and project structure to start with. Even with so little experience we were able to start writing our business logic in day one.

The Reality Kicks in

But, when your experience and needs grow you suddenly realize that in many cases you are fighting the framework. Of course, Ember has good intentions and most of the time everything works as expected and there's a lot off cool magic that Ember does for you.

But every now and then you need to do something in a non-Ember way. Maybe you're working with a legacy API or your data model doesn't quite fit Ember's way of thinking. And this is when things get frustrating. You find yourself fighting the framework which is just trying to do your work and does it wrong. It can be difficult to tell Ember to back off a bit and give you more space to do your own thing.

Now I've hit one of those moments. We have some relatively complex data models, although in this case they are used in a very simple way. Sometimes I'd just like to be able to call an API and process the raw data without Ember intervening.ng.

Of course, there's always an Ember-y way of doing things but sometimes I'd just like to take a short cut and have my own way. But in a way, Ember forces you to use some good programming practices and I have to give them credit for that.t.

# Don't Use includes(), use indexOf() Instead 2017/09/12

I always forget that Internet Explorer does not support includes. Use indexOf instead. Luckily Edge is one step ahead and already has support.

# Ember "No model was found for `user-role?`" 2017/09/12

I added a new model in Ember called user-role. It's no different to any of the other 30+ models the app has. But out of the blue I get this error in the console:

No model was found for 'user-role'

I get this error when I'm requesting the user model from the API. user model has a hasMany relationship to user-role models.

Our user model already has at least three hasMany relationships to other similar models and they work just fine. I'm completely lost why this is happening.

UPDATE almost two hours later

I renamed the user-role model to userrole and everything works as expected. I've been using Ember for over two years almost on a daily basis and I'm still lost with their naming conventions. user model also has a hasMany relationship to user-relationship model and it works just fine. There must be some difference how the data is loaded from the API.

# Long Term Support in the JS World 2016/10/18

Ember.js, one of my favourite JavaScript frameworks announced in February that they will release Long Term Support (LTS) versions of Ember.js.

The LTS version will receive security fixes for 60 weeks. Sixty weeks? Long term?

I guess that's considered a long term in the JS world. Anyway, it's a very welcome announcement for anyone who creates enterprise software.

# JavaScript Frustration 2016/10/05

I'm starting to get frustrated with all the front-end development kits. I'm more of a back-end guy and I've been spoiled by Symfony's long term support, excellent documentation and punctual release cycle. I wish some JS frameworks would offer the same kind of enterpriseyness.

# Note to Self: Check out Aurelia 2015/11/16

There's a hot new name in the JavaScript world: Aurelia. This one goes straight to the top of my tools-to-check-out list.

It's still in pre-beta, but it looks interesting. Documentation is good (especially for a pre-beta) and it seems to focus on real world use cases like routing instead of trying to be the fastest framework or rendering engine compared to others.

From a first glance one of the coolest things in Aurelia is the fact that it relies heavily on plain JavaScript classes and ES2016. So most of the code you write is just plain JavaScript and not tightly coupled to Aurelia. I've been wanting to try out some of the new features of ES2015 and ES2016 and now I've got a great chance to try out ES2016 and a new framework.

ps. If you're confused with all the ES5, ES6 and ES-whatnot names, here's a good explanation by Ben McCormick.

# CSS & JS Minification 2015/10/20

I just installed some tools for CSS and Javascript minification and concatenating. This time I wanted something simple and lightweight and I didn't use Gulp like I usually do

I installed Sass gem and UglifyJS and use them from the command line. This is a pretty simple and easy to get started approach for a small project.

# Angular VS Ember VS React 2015/10/02

The battle of the JS frameworks, this is something that I've been wondering lately. I'm working on a longer blog post about this, but I think in the end it comes down to these things:

  1. Use the tools you and/or your team knows
  2. Use the tools best for the job

I know that's easier said than done.