BT

Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ

Topics

Choose your language

InfoQ Homepage Interviews Yakov Fain on Java, JavaScript and Mobile Development

Yakov Fain on Java, JavaScript and Mobile Development

Bookmarks
   

1. I am Barry Burd I am a professor at Drew University in Madison, New Jersey, we are here at QCon in New York city, and I am talking with Yakov Fain, how are you doing there? Do you want to introduce yourself to our viewers?

Hello, sure, I live in the area of the Big Apple and I am a partner in two startups one is technological Farata Systems and it’s a consultancy, and the other one we make products for insurance companies. So when we make a couple of bucks for other systems we know where to spend them on the product. I teach, I write books, basically.

   

2. You’ve done a million things. Leader of user groups here, Java user groups, Flex user groups?

Yes, Princeton Java user groups and New Jersey Flex user groups, that’s true.

   

3. Tell us what you’ve been doing for the last several years, I know you’ve been into Java, you’ve been into Flex, can you elaborate?

Yes, I do Java for probably about fifteen years, and back in 2006 I decided to use Flex, not just myself our company for other systems, we decided to use Flex the frontend for talking to Java, and we’ve been happily doing this for five or six years, and wrote a couple of books on this subject, how Flex and Java works, and now Adobe decided to change their directions, and we didn’t have much choice but also move somewhere else and we started to look what’s going on now. The thing is that we had expertise in our company with JavaScript, and Ajax even before they’ve coined this term Ajax, but it was like early in 2000 and now we are coming back to the same world so to speak but on a different level. So this is where we are going, we are still enterprise developers mainly but we want to see how we can utilize HTML5, JavaScript, all these frameworks on the frontend and of course on the mobile.

   

4. Are you bringing something to the table here, in term of, tell me about JavaScript and your use of it, the IT world now has a love hate relationship with JavaScript, a lot of people hate it as a language but it’s in such wide use what do you see as the world and JavaScript right now?

First of all I think that most of the people don’t know JavaScript and that’s why they hate it. Most of the people are used to classical languages like Java or C# where everything is clear cut, and if you create an object and you define a property lastName and firstName is there, and it will be always there until you redefine the class. In JavaScript it’s a dynamic language, it’s object oriented so it supports inheritance but it gives you freedom and people are afraid of freedom, not because they are not capable of doing JavaScript but unfortunately in the enterprise area they have to find some lowest denominator regarding the skills of the developers who work in the project and they are afraid that it’s too complicated for them to use JavaScript as a language. It’s like if you have a sharp knife and you cut yourself you will be blaming the knife. And this is what I think people are trying to do but JavaScript is very powerful and object oriented and a very capable language.

   

5. Now let’s clarify here: JavaScript from what I understand it’s not strictly speaking object oriented, it uses prototyping?

Yes it is, it is object oriented the only thing is that they are not using classical inheritance for example they use so called prototypal inheritance but it is inheritance, the only thing it’s much more flexible.

   

6. I’ve just seen many object oriented programmers turn their nose up at the kind of inheritance that it’s used in JavaScript.

Well if you say that JavaScript is not a strong language it’s apparently because you don’t know it, not you personally, if anybody says that. But if you think about Java for example what do you do in Java? You define like a blue print, you define a class A and the class A has its properties and its methods, and then you say class B extends class A, and this is classical inheritance. In JavaScript it’s much more powerful, you create an object, think about it, an object and you create another object, these two objects are not related absolutely and now during runtime you can say “You know what? I want object B be a sub-class, not sub-class you don’t have classes but inherit everything from A”, and you do this in one line, you say for example A.prototype = B, in this case B becomes a parent of A and whatever is available in A and B in terms of properties will be available in both. And later on you say “You know what, I want to change” and now your data is not B but someone else and you change it, and you reassign a different object to the prototype. So basically JavaScript is in my opinion more powerful than Java in this regard.

   

7. […]But for an experienced programmer for a good programmer isn’t the strict typing, the static typing in a language like Java safer? […]

Barry’s full question: Now let me play either the devil’s advocate or the angel’s advocate for a minute depending on how you look at it, so for the programmer who doesn’t know what he or she is doing, JavaScript is that knife that one cuts oneself with. But for an experienced programmer for a good programmer isn’t the strict typing, the static typing in a language like Java safer? Can it be used as a tool to enhance development whereas in a less disciplined language like JavaScript even the experienced programmer is more at sea?

You had a couple of questions: one of them is it dangerous as a knife?

Barry: Any language is dangerous as a knife.

Yes, what people do these days, they try to protect themselves with the frameworks, so they say again to the Java programmer, “You know what? Don’t worry about it. This is a framework” you will be using the bare minimum of the language itself other than like find an HTML object in the DOM and replace it or change its styling so this is most what the UI JavaScript programmers do anyway. The other frameworks they try to emulate the object oriented environment for example ExtJS from Sencha, they literally create classes and they allow you to extend one from the other. So there is a protection of this kind over there. The ability to do everything dynamically in the programming language means that the program becomes less readable.

Barry: Which is a problem.

Which can be a problem if your main goal is to create programs that are as readable as possible.

Barry: But readable means maintainable to some extent.

Correct, we live in the world where you don’t know unfortunately what kind of team you will be leading, in some cases teams are forced on the managers and they don’t have much to say and they rather say “You know what? I’d rather work with the simpler language to read”, so if superstar Barry will leave our team, I will find another one easily. So maybe that’s the reason why people are afraid but the thing is that JavaScript fulfilled the dream of Java the write once/run anywhere that’s the language today. I don’t know if you read statistics like Facebook is being accessed from twenty-five hundred of different devices, just think about it, what other language can run everywhere? None.

   

8. So say an IT manager asks you for a recommendation on how to move their website to the mobile space, and I know that IT managers like to do that like crazy right now. What kind of advice would you give them?

So first of all you are right in saying that IT managers are trying to do this like crazy, even if they will not do it now, they will be forced, there is no other way, because people are using I think like fifteen percent of all access to the Internet these days is done from mobile devices. You are driving, you are sitting at a baseball game, or somewhere and you do things.

Barry: You are sitting at the baseball game, but you are not driving and doing mobile things, driving a car.

I don’t know you might be driving right on the baseball game. Anyway, if you select a platform today, for the software for the enterprise if this platform doesn’t support all these mobile devices this is a wrong platform so you will have to go there.

Barry: How does one best do that?

Well, to answer the second part of the question I could say that first of all you need to distinguish a couple of things: are we talking about website, or are we talking about a web application? These are two different animals. The website is a page, it’s one page at a time; it could be a newspaper it could be a site itself something, but it’s still a set of pages accessed one at a time. The application is a different story: it’s typically much more complex, and you need to remember state of certain objects, it has to be much better UI, it has to be much more responsive, it’s important how the data goes back to the server and to the client so this is the first question, if it’s a site or an application. Then, if it’s a site for example, now you have a choice again, do you want to develop separate websites, or separate applications, for different mobile platforms? Are you capable of hiring people with Objective-C skills and Java skills for Android? And let’s talk about Microsoft phones and Blackberry. So if you are, that’s one thing.

Barry: Is there an advantage to doing that? I am beginning to hear you say no.

I would say no, not that much. First of all even today you can write probably at least half of the applications that need to be written for mobile could be written using HTML and JavaScript, and CSS. And the thing is that even the native API, you can access from JavaScript, there is a great framework called PhoneGap, it’s not a framework for UI, it doesn’t compete with other UI frameworks in JavaScript but it’s a wrapper for the native API. So basically you can develop everything in JavaScript and HTML using CSS, and whenever you need to access the accelerometer or maybe a compass or maybe your contacts or camera, you can do this from JavaScript.

   

9. Do you pay a performance price when you do that?

Not really, and I can tell you that web browsers that are used on mobile are much more advanced, you don’t need to worry about IE 6 on mobile phones. That’s one thing. The other thing is how different should your website look like, depending on if you look at it on the iPhone or iPad, or maybe Galaxy Tab, if the changes are not that big, you can use different techniques called media queries or responsive design actually, so you develop one and only one site, one website and in the CSS file you put special media queries saying if the screen size is say between 800 pixels and 1024, then we are on the large device, if it’s say between 480 pixels to 800, we are on a tablet and automatically the appropriate CSS style is applied.

So in this case you maintain one website with multiple sections in CSS for lying out or maybe changing little pieces of code. I can tell you there is this newspaper, Boston Globe, and this is a site that was created using this responsive design. Go in there, just open it up in a big browser on desktop and then try to move it make it smaller, make it narrower and it’s immediately reassigned readjust everything but it’s only one site. In my opinion it’s a huge advantage, so I would go this way, try to have one code base for the website and use responsive design if you can and use Phone Gap if you need to access native API. If it’s a web application then consider what are the advantages if you are creating a trade application how fast it is, what is the best framework to use, how rich it is in terms of the library of UI components, what is the communication layer, how fast it is, does it work on every device?

Because in some cases people say, you know what, I picked up this framework it works fine for iOS and Android but it’s not one hundred percent of the market, if I am selling something and I have this button “Buy” I want to make sure that everybody, regardless of what device you have should be able to press this button. So there are too many variables.

Barry: And test test test. Absolutely.

Yes, that’s for sure, compiler won’t help you that much, it’s not Java you can put almost anything and it will say “Alright”. And then eventually it doesn’t work the way it is supposed to.

   

10. In the middle of the night. Let’s back up a bit and talk about Java the state of Java, the state of the Java world today where do you see Java fitting in the IT picture?

Java is doing great in my opinion, it’s never been better, because some people were afraid of Oracle, saying Oracle purchased Sun, Sun used to be like a company with engineers now it’s Oracle, I don’t see any problem with Oracle. Of course there is this first slide that every Oracle presenter starts with “Whatever I say cannot be used against me and put me in jail and so on”. If you ignore this little lawyers artefacts other than that Oracle is doing for Java a lot, it’s a very solid platform, they are moving in the right direction, Java 7 specification is moving in the right direction, they are also gearing toward a better work with HTML 5 clients, they are trying to put JSON as a standard and as of today I am pretty happy and I don’t think anything bad is going to happen with Java.

   

11. Do you have anything special to say one way or another about closures in Java 8? Any opinions and thoughts?

Again, comparing to JavaScript, whatever example I have seen in Java they are much more complicated than I would like to see.

Barry: In Java.


In Java. JavaScript is very elegant and easy, in Java 8 it’s not as simple that I would like to see, but I’ve heard that Java 8 is being delayed a little bit, so maybe they will change it a little bit.

Barry: It’s still not at this time June 2012 the specification certainly isn’t cast in stone.


But I wouldn’t go crazy about it regardless of which way they decide to go it’s not crucial for Java if it has closures or doesn’t have closures.

   

12. You spent years in enterprise IT do you see any trends or problems?

Problems is managers, mediocre managers in many cases and they think that outsourcing their project is the way to go but outsourcing a project doesn’t mean that you will give away this job and the rest works the same way, you have to be smart, you have to worry about who you hire, you don’t have to allow, you shouldn’t allow to use teams that you don’t trust, you shouldn’t leave the office unless you know what your outsourced people are working on, so I don’t see this in many American enterprises and in my opinion outsourcing is much more expensive than people think, people think that if I would be paying twenty dollars an hour, or thirty dollars an hour, for the off-shore person, I will save money. But you don’t think that you did not manage this person well enough and the person spends eight hours working and you spend say two hundred dollars it seems like not much, but he didn’t do much, if the person would be here maybe this person would be more productive so in my opinion a lot of money is being wasted.

   

13. So I have two follow up questions; the first is do you know of good outsourcing experiences? Do they happen?

Yes, it happened in our company. We are a small company and we know everybody who works for us, we are not a huge financial firm where they don’t even know names. But we do, and half of our team works in Eastern Europe and I didn’t see some of the people ever and in our case we watch very closely every person, we cherry pick every person but we can afford it, large companies have to make a special effort to do this. But we have very good experience I don’t want to blame people who work overseas in any way, if there is somebody to blame, it’s American management.

   

14. Let’s assume that we’ve done some outsourcing in a large company, and things are starting to go wrong, […] is there a way that you can backtrack and recover that you can recommend?

Barry’s full question: Now, again let’s assume that we’ve done some outsourcing in a large company, and things are starting to go wrong, or things have gone wrong, or we have waited too long to perceive that things are going wrong and that costs are rising and so on and so forth is there a way that you can backtrack and recover that you can recommend? Or does it become at that point a really difficult thing to manage well?

It’s a very difficult thing if you put yourself in this situation, unfortunately some managers that I’ve seen they care about retirement they want to live another couple of years that I would be promoted and then retire, they want to live quietly. And if something went wrong what I see is they will find a way to say that it’s not wrong actually, this is what was planned and we need more money, we need more budget and we will improve this project, but you can’t build on something that was done wrong in the first place.

   

15. So you are a partner in two companies, if you make enough money business goes well you can stop doing work, what’s the next step for Yakov Fain?

Every year I go fishing with friends we go salmon fishing up north to lake Ontario, and we hire a boat and a captain the same person and last year we went there and he said “I’ve been working so hard these days, about forty days no weekend, no day off I will take five days off and I will relax “ and I asked him “So what are you going to do?” and he said “Probably I am going to go fishing” and this is crazy, he was forty days in a row he was fishing, like he was hired for fishing and then he goes on vacation and he wants to go fishing. And in my opinion it’s the same situation, so regardless of how much money I make I will stay in IT, probably I will do more teaching like you do I would probably become a professor in the university if it’s possible, if it’s not I will be writing more books, actually I think that I am ready to write a new book on HTML5 and JavaScript in enterprise I need to tell my partners and we will probably do something soon but I will stay in IT no matter how rich I will become.

Oct 05, 2012

BT