It's tough. Choices have to be made and decision taken.
After spending years experimenting (and even professionally working) with Node.js I think it's time to say farewell and thank for all the fish.
Why?
There's several reasons but the main for me are:
Asynchronous IO is tough. Really tough. Callbacks, Promises, Async/Await all that stuff. Sure, Async/Await will make this easier but under the bonnet it will still be async. I think the cause of this is that we think sequentially - do this, do that do something else. Not do this for user1, do this for user2, do this for user3, do that for user1, do that for user2 ... The fact that we serve several users at a time doesn't have to be reminded to us all the time.
Debugging and testing is pain with callbacks. As async functions are normally executed in their separate threads you lose continuity when your functions resumes. It's hard to track down where you'd been before the callback got called. And simulate callbacks in unit tests doesn't help either.
Dependency management. NPM everywhere. Node.js doesn't have its own packaging, module system and relies on NPM to do the hard work. Problem with NPM is, that if package A depends on package B and that depends on package C it's all nested and not reused. That means, you can end up with hundreds of packages C in your project. I still remember my Ghost blog project. It downloaded 500MB of NPM modules just to run!
Spartan core libraries. Node has very limited number of standard functions. It means that even for simple tasks like working with dates you have to turn to libraries like moment.js. Most of the stuff you can find in standard libraries in other languages needs to added as a dependency in Node. So you always facing decisions like `lib1 has these features but lacks some other` so you mix and match all the time to get basic stuff done.
No opinion. We all know that today's patterns and best practices are tomorrow's anti-patters. But this cycle is massively accelerated in the Node.js world. Grunt, Gulp, NPM. This is rapidly changing and there's no sign of consolidation. It's hard to operate in a world where tools are discontinued on a daily basis (with no replacement). Node needs something that would define and guarantee the basics so you can focus on programming and not worry if your code will be buildable in a year's time.
No explicit types. We can probably debate this for ages but as there's no way to enforce types (at least optionally) it's very hard to define contracts between libraries and their users. There's nothing that would warn you that a return value can't be assign to your variable. Or calling a function isn't possible because of incompatible types. That puts extra pressure on library authors to well document their code so the types are documented, somehow.
To sum it up. On front-end I'm left with no choice - it has to be JavaScript or transpiled JavaScript. For backend though, I stick to something else.
Showing posts with label as it goes. Show all posts
Showing posts with label as it goes. Show all posts
Friday, February 12, 2016
Wednesday, February 10, 2016
Striking the right balance
We all know that software can be really complex. Software solves complex problems and needs to be complex. Period. But when it comes to our toolkit we should always prefer simple, streamline solutions.
Software development can sometimes morph into some kind of competition. Some developers and sometimes whole development teams can turn into macho style super heroes producing pretty complex code just to show the world how good they are. So you want an example - look no further than AngularJs. That's what happens when smart guys over-engineer their solution.
Dependency injection for a functional language? Services, providers, factories? Parsing function bodies to figure our parameters? You get all this and more. The question is why? Functional languages always prefer explicitness before implicitness. Functional approach tries to eliminate auto-magicalness. And why have so many service types? Who needs to use magic string constants to describe what a directive can be applied to? Yes, we know the guys behind Angular are smart but do we need to worship them everyday?
Again the same story. All you get is something to learn. And once you learn it you the guys release version two do zero with no backward compatibility. And you start over again.
On the other end you have things like Hazelcast. You don't need a diploma to use it. You plug it in as a library or use it as stand-alone application and it just works. Don't be fooled. Hazelcast is far more complex than Angular. Both in terms of code and the problem area it covers. But the guys there don't try to awe you. And that's the trick. That's why React is so popular.
So the rule is - don't try to convince your users that you're a smart guy by writing complex difficult libraries - convince them (if you really need to convince anyone) with simplicity.
One rule of simplicity is to reuse whatever is out there or at least allow this existing tools/libraries/utilities to be used with whatever you're coding.
Don't be revolutionary - be evolutionary.
Software development can sometimes morph into some kind of competition. Some developers and sometimes whole development teams can turn into macho style super heroes producing pretty complex code just to show the world how good they are. So you want an example - look no further than AngularJs. That's what happens when smart guys over-engineer their solution.
Dependency injection for a functional language? Services, providers, factories? Parsing function bodies to figure our parameters? You get all this and more. The question is why? Functional languages always prefer explicitness before implicitness. Functional approach tries to eliminate auto-magicalness. And why have so many service types? Who needs to use magic string constants to describe what a directive can be applied to? Yes, we know the guys behind Angular are smart but do we need to worship them everyday?
Again the same story. All you get is something to learn. And once you learn it you the guys release version two do zero with no backward compatibility. And you start over again.
On the other end you have things like Hazelcast. You don't need a diploma to use it. You plug it in as a library or use it as stand-alone application and it just works. Don't be fooled. Hazelcast is far more complex than Angular. Both in terms of code and the problem area it covers. But the guys there don't try to awe you. And that's the trick. That's why React is so popular.
So the rule is - don't try to convince your users that you're a smart guy by writing complex difficult libraries - convince them (if you really need to convince anyone) with simplicity.
One rule of simplicity is to reuse whatever is out there or at least allow this existing tools/libraries/utilities to be used with whatever you're coding.
Don't be revolutionary - be evolutionary.
Wednesday, April 29, 2015
My problem with conferences
We all know the numbers - 10% of developers are active in the community whilst 90% is the programming dark matter. To have two sides of barricade is quite all right - actually we all need each other as much as we need the audience - the users of our products.
Now of the 10% of developers you have the rock stars - the talk givers. It is perceived as the highest honour to go to a conference to give a talk. As a talk giver you waltz in to a room full of the usual business developers (means configurators or integrators) and start talking about stuff they've not worked with. Say the talk giver starts explaining, in great details, the technicalities of tail recursion. Or the goodness of the new shinny feature that allows you to curry functions from right (i.e. right curry). And the audience is in awe. They can't believe their eyes - all these features. We have to use them. NOW!
Then they return to their cubicles. They launch their IDEs (see, they use IDEs unlike the talk givers happy to use 6 ... VI) and try to use tail recursion. But they couldn't. Why? Because the problem domain they're in has no use for tail recursion. They rarely use any recursion and if they do then the recursion is so complicated that you simply can't use the tail recursion.
And that's the problem with the rock star talk givers. They want to impress. They don't care about your daily chores, they're rock stars. They are the rock stars even when their presentation is a shitty Powerpoint with a stolen background, they're the rock stars when they can't really explain what the brilliant feature is good for, they're the rock stars even if their personal web page (if they have one) is a poorly knitted html4 full of marquee tags, they're the rock stars even if they have only 5 years of experience under their belts and their github is full of presentations but no code at all.
So when you go to a conference choose wisely - unlike the talk givers you don't get paid for attending, you actually have to pay the admission and find some spare time. Pick the talks you want to go to based on what you can really use in your daily life not the buzzwords. Don't be afraid to leave if the talk is of no use to you. Give the organizers a feedback and vote with your feet.
Or if you've been to many conferences try unconferences. Go to meetup groups. Smaller venues, direct contact with other developers.
disclaimer: not all conferences feature rock star talk givers. And some are happy to listen to this sweet talk just to have something to dream about.
Now of the 10% of developers you have the rock stars - the talk givers. It is perceived as the highest honour to go to a conference to give a talk. As a talk giver you waltz in to a room full of the usual business developers (means configurators or integrators) and start talking about stuff they've not worked with. Say the talk giver starts explaining, in great details, the technicalities of tail recursion. Or the goodness of the new shinny feature that allows you to curry functions from right (i.e. right curry). And the audience is in awe. They can't believe their eyes - all these features. We have to use them. NOW!
Then they return to their cubicles. They launch their IDEs (see, they use IDEs unlike the talk givers happy to use 6 ... VI) and try to use tail recursion. But they couldn't. Why? Because the problem domain they're in has no use for tail recursion. They rarely use any recursion and if they do then the recursion is so complicated that you simply can't use the tail recursion.
And that's the problem with the rock star talk givers. They want to impress. They don't care about your daily chores, they're rock stars. They are the rock stars even when their presentation is a shitty Powerpoint with a stolen background, they're the rock stars when they can't really explain what the brilliant feature is good for, they're the rock stars even if their personal web page (if they have one) is a poorly knitted html4 full of marquee tags, they're the rock stars even if they have only 5 years of experience under their belts and their github is full of presentations but no code at all.
So when you go to a conference choose wisely - unlike the talk givers you don't get paid for attending, you actually have to pay the admission and find some spare time. Pick the talks you want to go to based on what you can really use in your daily life not the buzzwords. Don't be afraid to leave if the talk is of no use to you. Give the organizers a feedback and vote with your feet.
Or if you've been to many conferences try unconferences. Go to meetup groups. Smaller venues, direct contact with other developers.
disclaimer: not all conferences feature rock star talk givers. And some are happy to listen to this sweet talk just to have something to dream about.
Friday, June 27, 2014
Is AngularJS the new Fat client?
It was year 2000. People survived Y2k, the dot com bubble was just about to burst and we were writing our shiny applications. Many people were already doing HTML based thin clients (with a bit Javascript and mostly on Internet Explorer because Netscape was crap with anything beyond basic form validation).
But at that time there were still people doing something called "Fat client".
So what exactly was (is) a Fat client application.
In a nutshell, fat client is a concept where the client holds the logic of the application and talks to database directly. Database in this case is the point of truth. Fat clients have certain advantages.
But there are certain drawbacks
And the list goes on.
Now, fast forward, year 2014. Here we are. We've got our servers but we try again to let our clients to do the heavy lifting. This time with a small twist. Instead of using native applications (we've been there, haven't we?) we use HTML/Javascript. So what exactly differs between the fat client v.1 (native application in year 2000) and fat client v. 2 (AngularJS application in year 2014)
So, is it all lost? I don't think so. Because there's already Fat client v. 3 here. Oh yes - the native smartphone/tablet applications! They install but keep themselves updated, they talk to APIs but in their own formats (although JSON is getting there as well). The applications still crash, allow you to save data and work offline. And now (*drumroll*) Google would like to allow these apps on their Chromebooks - eat that Angular!
And for those who want to see this side by side - here's the link!
But at that time there were still people doing something called "Fat client".
So what exactly was (is) a Fat client application.
In a nutshell, fat client is a concept where the client holds the logic of the application and talks to database directly. Database in this case is the point of truth. Fat clients have certain advantages.
- Fat client utilises the users CPU and resources - thus spares the company from buying (at that time) expensive servers.
- Fat client is pretty quick - unless you need something from the database (backend) and the database is busy.
- Fat client's look and feel is consistent. It is a native application so users are usually familiar with the UI.
But there are certain drawbacks
- Fat client needs to be installed and maintained locally. It's OK for several users, but thousands users can be a completely different story.
- Fat client runs on one platform only - it is a native application in the end! It means that upgrade to newer version Windows is risky not even thinking about porting that application to Unix/MacOS.
- Fat client can simply die or stop working and you don't know it until your users tell you (if they even bother to tell you).
And the list goes on.
Now, fast forward, year 2014. Here we are. We've got our servers but we try again to let our clients to do the heavy lifting. This time with a small twist. Instead of using native applications (we've been there, haven't we?) we use HTML/Javascript. So what exactly differs between the fat client v.1 (native application in year 2000) and fat client v. 2 (AngularJS application in year 2014)
- We dropped native applications, we now use HTML and Javascript. So the UI may be completely unfamiliar to our users. HTML builds a very thick layer on top of the hardware so our fat client v. 2 applications may be pretty slow on older computers.
- We ditch the installation process. Installing software is bad. Updating, maintaining it - no kudos there. Instead, we install the application over and over again as the user visits our site. But is the user really visiting our site that often? What the users just put his PC on stand by and have the page (application) running 24/7 for a days, months?
- We're smarter now - we don't talk to database. We talk to APIs. And because we're smarter we all use JSON. JSON is fine, everyone can read it, it's nicely structured and all the network sniffers are happy - listen or port 80 (443) and all the structured data is there.
- As the application is written in Javascript everyone can read the source code and tweak it. All these wannabe developers rejoice.
- We are more masochistic now. If something looks easy then everyone could do it, sure thing. So we make Angular difficult. Controllers, services, directives, dependancy injection. Who cares you only want to let user to input several parameters to get some output back, you still need to make it painful for the developers, they need to deserve their pay.
- We learn from experience and we know users hate error messages. That's why we don't give them any. If we're in a good mood we dump something on the console and we pray for the user not to press F12 (or CMD+ALT+J). Ideally we let to user in the dark by presenting a screen where things look working but the code behind them is long time zombie.
- Unfortunately the browser still has the reload and back button. We just hope the user will not press it or we try to come up with a smart way handling that. Users are confused but who cares about their feelings.
- Using browser has other nice advantages. No native printing, no access to the hardware, not working app if the user happen to lose his Internet connectivity. Some big companies allow you to continue using a crippled version of their application if you're offline but most people don't bother.
- And we all know that data is the king. So we don't allow the user to access the data. Fat client v. 1 would allow you to save data in various formats but v. 2 saves data in the Cloud and makes sure anything that even slightly resembles the save button is removed.
So, is it all lost? I don't think so. Because there's already Fat client v. 3 here. Oh yes - the native smartphone/tablet applications! They install but keep themselves updated, they talk to APIs but in their own formats (although JSON is getting there as well). The applications still crash, allow you to save data and work offline. And now (*drumroll*) Google would like to allow these apps on their Chromebooks - eat that Angular!
And for those who want to see this side by side - here's the link!
Monday, November 21, 2011
Challenging week
What a week last week. Three project - three completely different technologies.
Anyway good times last week, this week it will be more about implementing more PoC and more, unfortunately, meetings ...
- I started the week bug fixing our Wheelchair portal written in Grails. Grails underpinned by my favorite language Groovy is by far framework of my choice and means that i had a pretty good time coding.
- Next one - PoC opening Oracle CRM (EBiz suite) custom form preloaded with data coming from our new out of the shelf leasing product. Normally we would pass this information in URL but that would mean customizing Oracle CRM which is expensive and no one wants to do it. Solution - Calling system will store input data in database and CRM will load this data on form load event. This event can be handled as personalization (not customization). Technologywise - Oracle SOA to store data into database (exposed as sync webservice) and Oracle forms on CRM side.
- Last one - creating MS Outlook tasks triggered by events in CRM. The CRM bit is outsourced but the Exchange bit is pure java witha hint of Apache Jackrabbit (client side only - no webDAV server) and composition of webDAV messages.
Anyway good times last week, this week it will be more about implementing more PoC and more, unfortunately, meetings ...
Subscribe to:
Posts (Atom)