CppCast - Hybrid C++/Javascript apps

Episode Date: February 26, 2016

Rob and Jason are joined by Sohail Somani to discuss building hybrid apps with Javascript and C++. Sohail Somani is a contract cross-platform application developer who has been working in C++ ...and Python for over 10 years. He has worked in a variety of fields such as computer graphics, C++ compilers, finance and plain old desktop apps. Sohail's obsession with (or hate of) time tracking led him to create Worklog Assistant, a cross-platform time tracker for JIRA, which is in use by more than a thousand companies worldwide. He hopes to one day achieve time tracking nirvana for his users so that he can finally move on to something else. He might be too optimistic... Otherwise, Sohail is a full-time, work-at-home dad of 2 since 2007. He enjoys playing hockey and listening to rap music. You can contact him at hello@sohailsomani.com - but he doesn't recommend that you visit the domain. News C++Now Accepting Student/Volunteer Applications CppCon 2016 Registration Khronos Releases Vulkan 1.0 Specification Experimental Boost Dependency Injection A bit of background for the operator dot proposal Sohail Somani Sohail Somani Links Worklog Assistant Degreed

Transcript
Discussion (0)
Starting point is 00:00:00 CppCast is sponsored by Undo Software. Debugging C++ is hard, which is why Undo Software's technology has proven to reduce debugging time by up to two-thirds. Memory corruptions, resource leaks, race conditions, and logic errors can now be fixed quickly and easily.
Starting point is 00:00:15 So visit undo-software.com to find out how its next-generation debugging technology can help you find and fix your bugs in minutes, not weeks. Episode 46 of CppCast with guest Sohail Samani recorded February 26, 2016. In this episode, we talk about Boost.di and some conference news. Then we talk to Sahil Samani, developer of WorkLog Assistant. Sahil tells us about his experience building hybrid apps with JavaScript and C++.
Starting point is 00:01:30 Welcome to episode 46 of CppCast, the only podcast for C++ developers by C++ developers. I'm your host, Rob Irving, joined by my co-host, Jason Turner. Jason, how are you doing today? I'm good, Rob. I did find out that I got a talk accepted for C++ Now. Only one? Which one? C++ Now. Two. Two talks. Two talks.
Starting point is 00:01:48 Two talks, and we'll see how that works out. Okay. Yeah, I guess they just sent out that letter just a day or two ago? Four days ago they actually sent it out, yeah. And then we got some of the details about the process just today, actually. And when is the conference again? May, second week of May. Okay. Very cool. Well, I wanted to May, second week of May. Okay, very cool.
Starting point is 00:02:08 Well, I wanted to jump into this piece of feedback. This one's kind of interesting. On Twitter, David wrote to us, as well as the Twitter accounts of two other podcasts, programming podcasts, MS Dev Show and Coding Blocks. And he said, looks like you guys are now going to be part of my integrated learning profile apparently there's this website called degreed and you can now get credit for listening to podcasts on degreed so i saw that i i'm curious what all that means and entails and and everything else i think it must just be a way to catalog online learning that you're taking, that you're performing, like Pluralsight courses and now podcasts, things like that. Interesting. Is what I'm guessing, but I haven't really looked into it too much. Cool, though. Well, we'd love to hear
Starting point is 00:02:59 your thoughts about the show as well. You can always reach out to us on Facebook, Twitter, or email us at feedback at cppcast.com. And don't forget to leave us reviews on iTunes as well. Joining us today is Sohail Samani. Sohail is a contract cross-platform app developer who's been working in C++ and Python for over 10 years. He's worked in a variety of fields such as computer graphics, C++ compilers, finance, and plain old desktop apps. Sohail's obsession with, or hate of, time tracking led him to create WorkLog Assistant, a cross-platform time tracker for Jira, which is in use by more than 1,000 companies worldwide. He hopes to one day achieve time tracking nirvana for his users so that he can finally move on to something else.
Starting point is 00:03:39 He might be too optimistic. Otherwise, Sohail is a full-time work-at-home dad of two since 2007. He enjoys playing hockey and listening to rap music. You can contact him at hello at sohailsamani.com, but he doesn't recommend that you visit the domain. Sohail, welcome to the show. Hey, guys. Thanks for having me. So what compilers have you worked on?
Starting point is 00:03:59 I've worked on Clang and GCC. I also wrote my own compiler for Visual Basic, which was fun. And the last time I worked on a C++ compiler was probably 2014, which was Clang. And it was a lot of fun. What kinds of things have you contributed to? Well, it was for a proprietary version of Clang. Okay. So the stuff that I did, most of it didn't really get contributed back yet.
Starting point is 00:04:35 They're still trying to figure out their model. But the things I worked on was exception handling in Windows for 64-bit exception handling and various other language extensions that this proprietary implementation had. So that was the kind of thing I worked on. So if you look up my name associated with Clang, you'll probably see some long rant that I had about... It's not really a rant. It was just, you know, a request for, for ideas on how to implement, uh, asynchronous exception handling in LLVM, given that, given the LLVMs, uh, given LLVMs language itself. Okay. So that's, that's probably the extent of my contribution that you'll find online.
Starting point is 00:05:26 All right. Now, we're a C++ podcast here, but I have to ask, since you just said that you worked on a Visual Basic compiler, what's that about? So at a school, I've only really had one full-time job, and that was at a financial software company and the the process of this this company was they would develop their models in Excel and VBA and they would convert them to C++ by hand so that they could run them on Unix and whatever they needed to do. And, yeah, I saw your reaction there. I raised my eyebrows, yes. Yes. And that was the same reaction I had.
Starting point is 00:06:17 And they had been doing this for something like 10 years. And, yeah, I couldn't agree to be a part of that. So I worked with my manager to develop a plan for getting out of that, and part of that was writing a VB compiler, and that's what I did. And I was really proud of it because until I left, there had only ever been 12 bugs filed against it, and all of the bugs were to do in a misunderstanding between how I thought the VB runtime should work and how it actually worked. So it wasn't even compiler level.
Starting point is 00:06:50 It was like the runtime level, which was pretty cool. And they used it for a few years. And I think hopefully they've retired it by now. But last I checked, they were still using it. So is this late enough in the history of VB that you were able to use Microsoft's parsing and reflection tools? Or did you have to parse all the VB yourself? No, I had to write the compiler, like the parser, elixir, all that stuff myself. Wow. Okay. That's crazy.
Starting point is 00:07:19 To be fair, there's a tool out there called ANTLR. Yes. It stands for another tool for language recognition. To be fair, there's a tool out there called ANTLR. A-N-T-L-R. Yes. It stands for Another Tool for Language Recognition. That made my job a whole lot easier. Okay. So without that, I think it would have been much more painful. Wow, that's amazing.
Starting point is 00:07:38 Yeah. Okay. Well, we have a couple news articles to go through. These first two are conference announcements. As Jason mentioned, the C++ Now speakers have been informed and now they're accepting student and volunteer applications. We had Bryce Lell back on a couple episodes ago when we talked about this a little bit. It's a really great program if you're a student and you want to get a free trip to be able to attend c++ now um you can help out and get that if you want to apply for this program the applications are going to be accepted until
Starting point is 00:08:12 march 16th bryce spoke very highly of the program yeah he he was he was a member of the program while he was still a student i believe right. So definitely worth looking into if you're a student interested in C++. And the next one, and I wasn't expecting this so early, but CppCon 2016 has opened registration at Early Bird Pricing, which, did you see what the pricing was for Early Bird? I think it was like $1,000. I didn't. I just looked at it, and my heart skipped a beat because I'm like wait did i miss the submission for speakers no they haven't
Starting point is 00:08:48 done submission yet no right so i was i was also very surprised okay so early bird registration is 8 45 but there are also a number of additional pre-conference classes that you can participate in and some of these are being given by former cpp cast guests including kate gregory and anthony williams which is pretty cool yeah so definitely look into this um when is early bird registration ending i'm not sure if they tell us but i'm sure it'll be at least a couple months probably until the summer I would be surprised if it ends before they do the call for submissions that's a good point the only thing I would have to add to this
Starting point is 00:09:33 as someone who went to the first one and spoke at the second one you need to go even if you're not a student you need to go as a C++ developer does C++ now both either? Oh, you know what? I'm talking about C++ Now.
Starting point is 00:09:51 I haven't been to CppCon yet. C++ Now was the students and CppCon is the early registration. Yeah. This next one is, this is getting a lot of news, Kronos released Vulkan 1.0 spec. And it's basically an improvement of OpenGL. The rendering performance seems to be much, much better. Yeah, Jason, do you have anything you want to add to this one?
Starting point is 00:10:19 It's completely outside of my wheelhouse. I've never written a single line of OpenGL code. I don't. So I expected you to have something to say about it, Rob. Not too much. I know some of my coworkers are talking a lot about it, and we're starting to look into it. I haven't written much OpenGL myself, though.
Starting point is 00:10:37 So, Hale, how about you? Do you have any experience with OpenGL? Yeah, I do. And most of my experience is from the model viewer perspective. So I don't really have much input into it from a games development perspective. But I think that this specific API is geared towards high performance graphics as opposed to just regular model viewers things. So if you look at the list of companies, for example, you'd expect Autodesk to be there
Starting point is 00:11:10 because they require OpenGL for their applications, but they're not there. And I think part of the reason is because the use case for this API is much different from the use case for regular OpenGL. This API is much lower level than OpenGL. And what I think that means is there's going to be a huge gap to be filled between your application and this new API that was previously filled by OpenGL. That's just my reading on it.
Starting point is 00:11:42 I don't know whether that's legitimate or not, but that's my reading. My understanding is that it can be used in place of OpenGL just for graphics rendering, and from what I saw on the website, it looks like it's promising much, much greater performance with triangle rendering. It's like an assembly
Starting point is 00:12:00 language for graphics, is my understanding. So it's much lower level, so you can do everything you're doing with OpenGL. If you look at the comments that people are putting up about this, they're commenting that it's so much harder to do normal things that are so easy in OpenGL. And the reason for that is because it's a much lower level API. And so I think there's going to be some innovation in between the gap between this assembly language for graphics and your application.
Starting point is 00:12:32 So that's what my understanding is of this new API. Okay. This next one, so Hale, you actually recommended this article, Boost Dependency Injection, a new experimental boost library, although it's actually listed as a 1.0. And we were talking about dependency injection not too long ago. So it's exciting to see that boost is coming out with their own library. Yeah. So this, I have my own dependency injection library that I wrote in 2011. And this guy, Chris, he's really, this is a problem he really wants to solve. And so we've been in touch over the years and he's talked to me about what he's doing.
Starting point is 00:13:14 And I think what he's got now quite possibly could be one of the best dependency injection libraries available almost in any language. The code that's generated is almost exactly what you would write by hand. And I think that's really what C++ developers want. So if you're interested in dependency injection, I would really suggest that you go check that one out and give Chris your feedback because he will definitely take it into account okay and this last one uh it's another article coming from bjorn strustrup and we talked last week about how he gave uh some background on what was the one last week it was the uh jason help me out here yeah i'm working on it no it was it was the uh unified call syntax right so this time he's doing a similar rundown on the background of the operator dot proposal and i know jason you said you weren't really
Starting point is 00:14:19 sure how you felt about this one it makes me a little squeamish. Yeah. I think I'm lost in the details of like, if you overload operator dot, but then you actually want to call a method on the container as opposed to the thing that's being contained, how do you do that? Define the priority that said that the first lookup will be done on the container and then on the result of operator dot.
Starting point is 00:14:50 So he went through, I mean in the PDF he went through all the different possibilities and that was the one that they chose. I think it makes sense given that I'll never use this, but it makes sense for people who would need to use it. It kind of makes it kind of in a way then behave like a dynamic object of some sort, like in JavaScript or something, right? Like if you try to call something that doesn't exist, then it just kind of creates that property.
Starting point is 00:15:21 I mean, you know, it's not really the same thing, but it kind of makes sense. Yeah. Although the lookup will still be static as opposed to dynamic. Right. Good point. Okay. Well, so Hale, you actually reached out to us after an episode a couple weeks back with Mark Logan, where we were talking a lot about C++ and JavaScript, and you had your own perspective on integrating the two languages that you wanted to share with us.
Starting point is 00:15:47 Do you want to get us started with that? Yeah, well, first of all, that episode was amazing because the way it was explained really allowed me to visualize the problems he was trying to solve and why he was solving them the specific way that he was doing it. And I thought that was really great. But his use case was in the context of game development, which I think we'll probably agree is high-performance computer graphics
Starting point is 00:16:15 and high-performance simulation-type stuff. So he's going to need to know the details of all the calling conventions and all of this stuff in order to do his job well. And when I heard that, I'm thinking, okay, do I need to know all this for my use case? And I think it really helps to take a step back and say, what is really the alternative use case? Why would you use JavaScript otherwise? And for me, the decision to use JavaScript has nothing to do with the fact that
Starting point is 00:16:47 I like the language. I actually hate the language. I think it's the worst language that we are forced to use as developers. But there are hundreds of thousands of developers who do use this language. And I want to make use of the work that they've put in. So my decision for using JavaScript and a hybrid user interface is so that I can make use of all that work. So my perspective is JavaScript could be any other language. The only reason I care about it is because it's the language of the web, and I'm using web technologies in my hybrid desktop app. And for that use case, I don't really care about all the things that Mark necessarily cared about. Does that make sense?
Starting point is 00:17:38 Yes. Yeah. Can you tell us a little bit more about this hybrid desktop app that you're working on that uses JavaScript? Right. So the application you mentioned earlier in your intro, WorkLog Assistant, I wrote that in 2008 using Qt and C++. And, you know, couldn't keep up, my decision was to basically switch from using Qt as the user interface to using the web technologies as the user interface. There are a whole bunch of implications there, but that's the fundamental switch there.
Starting point is 00:18:26 So if I was to distill down the reason, it's basically because Q UI allow me to use many different user interface widgets. So that's kind of the hybrid approach. So to sum up, you're using Qt and C++ for your business logic in the backend and all the user interface is written in JavaScript? Yeah, it's a combination of JavaScript and C++, yes. Okay. So what kind of results have you seen since making that switch?
Starting point is 00:19:14 Has it greatly sped up your rate of development or given higher quality UIs? So the higher quality UI is still up for debate because this's only, you know, this version has only been out for, I would say, a month and a half. But in terms of productivity, definitely, hands down, I can imagine a user interface thing that I want to do. I can Google it, and within 30 seconds, I can add it to my project. You can't do that with Qt. You can't do that with C++. It's just not possible. So from that perspective, I've definitely improved my productivity, but there is one case in which it has slowed me down. And we can talk about that if you're interested. Yes, sir. Go ahead.
Starting point is 00:20:08 So many years back, people had a complaint about C and C++. And the major complaint was that you can create memory leaks. You can leak memory. And the funny thing is you can also create memory leaks in garbage-collected languages such as JavaScript. And that is my number one productivity hit. It's not that I'm creating these memory leaks, but actually determining whether I'm creating them is a job in and of itself. So you can call collect on the garbage collector as much as you want, it doesn't have to free anything if it doesn't want to. So it's hard to know whether you're leaking memory or whether the garbage
Starting point is 00:20:51 collector is just being greedy with what it hangs on to. So that's the only thing I've found in which I've actually had to slow down. So do you have any sort of automated process to help you detect if you're leaking memory? Or how do you even go about that? Yeah, so that's a good question. So I can easily tell on the, you know, core business logic side, whether I'm leaking memory, yeah, because we use typical C++ Java, sorry, C++ tools to do that. But on the JavaScript side, you're going to laugh. But the only thing I've found that helps is watching the memory usage over time as reported by the operating system. Even the memory usage that the JavaScript interpreter itself reports is not entirely accurate. So that's really the biggest problem I have.
Starting point is 00:21:49 And in talking with people about it, it turns out that four tabs of Chrome take up 500 megs anyway. So people are not hurting for memory these days. So it's not something that I'm overly concerned about, but I keep an eye on for sure, because I want to do the best job I can. Since you just mentioned the JavaScript interpreter, which engine are you actually using for your JavaScript rendering? I think that Qt uses V8. So you're using QWebKit? I am using QWebKit. So whatever it is you're using a q webkit or i i am using qwebkit okay so whatever whatever it is
Starting point is 00:22:27 they're using uh i think it's i think it's v8 now but uh i'm not 100 sure and this is the thing i was talking about earlier like i don't really need to know um so that that's my approach to that part of it so what are your recommendations for separating your C++ and JavaScript code, and how do you organize that? I think that the web guys have it figured out. And if you're going to do a hybrid approach like I am, then you can essentially mimic what they do. So you kind of have a view that's described by the JavaScript, and then you have a core logic base that's in C++. Now,
Starting point is 00:23:16 separating that is straightforward because you can't talk from C++ to JavaScript directly anyway. But then really the problem is how do you integrate these two? And again, this is where the army of programmers comes in. Qt has had years and years of development put into it. And one of the cool things that Qt does is it has this thing called a meta object compiler, which allows you to reflect on your types and your objects. And they've integrated that directly into Qt WebKit, which means you can expose your core objects directly
Starting point is 00:23:53 to the JavaScript. And by doing that, but by using that functionality, it not only makes it easy for me to separate them, but it also makes it easy for me to put them together. So I can test the core logic separately, and because of the way JavaScript is usually written, I can mock up all the data I need on the UI side and test the UI separately. So keeping them separate as per the usual web approach works, and then bringing them together using Qt WebKit is really the simplest way that I would integrate the two languages. Interesting. So you answered a question that I was planning to ask for, what tools do you use for actually exposing your C++ to JavaScript? So you let mock do the work for you.
Starting point is 00:24:46 Exactly. And there are some tricky bits to it. So, for example, when you connect a signal on the JavaScript side to the C++ side, so let's say you've got a C++ object and it's emitting some signal, and you want to detect that on the JavaScript side. The only thing you have to be careful of is when you're done with that signal, you have to deregister it, otherwise you'll get a memory leak there.
Starting point is 00:25:13 So the way that you want to do it is you want to have two-way communication between your C++ and your JavaScript, and you don't want to do the work to do it. So Qt does the work for you, but there are little things like this that you have to watch out for. So calling from JavaScript to C++ is straightforward. It's a simple function call. But calling from C++ back to JavaScript,
Starting point is 00:25:39 the only way you can do that is through using signals. And then you've got this requirement of making sure that you deregister your connection when you're done with it. But it works out beautifully. I mean, if you were to download the application and go to the installation directory, you'll see all the JavaScript code there. And I haven't minified it or obfuscated it specifically because I want people to look at it. But you can see how that connection is made. So does it work like a normal Qt signal slot connection
Starting point is 00:26:16 that you just call like a connect method and pass in a JavaScript lambda or a function? Yep, pretty much. That's exactly how it works. That's exactly how it works. That's exactly how it works. Yeah. And I had to do a lot of testing to see what approach would work. I even looked at Electron.
Starting point is 00:26:33 I don't know if you guys have heard of Electron. I have not. No. It's basically a framework for hybrid desktop development. So what I'm doing, but they say this is how you should do it. I looked at that, but the say this is how you should do it. I looked at that, but the problem is it's multi-process and I don't really want to deal with all of that stuff. But I think in a few years it'll be where I would want it to be and I would
Starting point is 00:26:54 use it. Okay. Okay. Can you tell us a little bit about JavaScript promises for those who aren't familiar with them and how you can use promises between C++ and JavaScript? Okay, so one of the main resolve and reject or accept and reject. And when, well, let me take a step back. So promises are essentially an object that are a contract to deliver a value at some later time. If you're familiar with C++ promises, basically you get a handle to something and at some point a value will be
Starting point is 00:27:52 available. That's what a promise is. The way promises work in JavaScript is you've got a pair of functions, accept and reject. When your process is done doing its work, you resolve the promise. And in the process of resolving the promise, the accept callback is fired. If an exception occurs, you reject the promise and the reject callback is fired. And I personally prefer this approach to promises as opposed to the traditional C++ approach, but that's what it is in a nutshell. Accept, reject. When you're done with the value, you accept it. If it fails, you reject it. And through this kind of axiom or atomic element of asynchronous programming, you can build up a whole sequence of operations
Starting point is 00:28:47 that happen asynchronously. And one of the ways that this is done is a library called Bluebird.js, which is a promises library. So on the JavaScript side, you'll use Bluebird.js to handle your promises for you. On the C++ side, though, you still need asynchronous programming. And so what I needed to do was implement a similar approach from the JavaScript
Starting point is 00:29:15 side into the C++ side. So I've got this promise object that integrates with the Qt event loop. And when it's done, it calls a specific signal. When it fails, it calls another signal. And essentially, that allows me to detect those signals in JavaScript and then let the JavaScript promise machinery take over. So it wasn't difficult to do, but it was difficult to get all the memory? Getting to the bottom of intermittent and obscure test failures is crucial if you want to get the full value from these practices.
Starting point is 00:30:10 And Undo Software's live recorder technology allows you to easily fix the bugs that don't otherwise get fixed. Capture a recording of failing tests in your test suites and debug them offline so that you can collaborate with your development teams and customers. Get your software out of development and into production much more quickly, and be confident
Starting point is 00:30:28 that it is of higher quality. Visit undo-software.com to see how they can help you find out exactly what your software really did, as opposed to what you expected it to do. And fix your bugs in minutes, not weeks. By using C++ and JavaScript using two very cross-platform languages, do you have any cross-platform issues or are you even deploying this application to multiple platforms? Yeah, so the application is deployed to multiple platforms, but the extent of the issues I'll get are rendering issues as opposed to JavaScript orcript or c++ issues and my approach to those is
Starting point is 00:31:08 to handle them the same way that web developers handle them today which is through css if possible or javascript tweaks otherwise other than that any platform differences differences, I can write some code on the C++ side to kind of hide over. But rendering stuff, I cannot. I find it fascinating that you would have rendering issues if you're using the same rendering engine on all platforms. Yep, yep. I am still honestly trying to figure out why that is the case. For example, I know on Linux, for example, the window manager for Fedora does not respect the frameless window hint. So if I'm saying I want a frameless window, it doesn't respect it.
Starting point is 00:32:06 And that's one area where I might have issues. And there's no CSS that's going to fix that. So that's going to require some special work to get done. So that's one thing. Another thing is, for example, on OSX, for some reason, the scroll bar is on the other side when it's supposed to be on the right it's on the left and you know those kind of things they confuse the heck out of me but those are the type of issues that come up and usually I can deal with them either by doing some tweaks on the C++ side or I can do some tweaks using CSS that's that's generally's generally how it can be handled. I haven't seen any other way yet.
Starting point is 00:32:51 If you don't mind if I take just a step sideways just a moment, this project you've been talking about, is it commercial, open source? What's the deal? Yeah, it's commercial. So there's companies that use it, they pay to use it, and all that stuff. But you've intentionally left some of it accessible to the users of your application. You're saying the JavaScript source code is visible. Yep, yep.
Starting point is 00:33:16 I mean, ideally I would make it open source. I just haven't found a way to make that work yet. So if I can at least open up some parts of it then then I then I'll be happy my goal is my goal is to allow people to extend it themselves which they wanted to do in the past and I haven't been able to so this is another approach I mean this is another benefit it allows them to use JavaScript to extend the application themselves very interesting so have you had any of your users do that yet? Not yet, because as I said, it's only been out for a month and a half in this current incarnation.
Starting point is 00:33:53 But the last incarnation, there were a ton of users that customized it using the extension points that I gave. And so I'm expecting people to want to do it. And I get requests on a weekly basis for some sort of ability to modify. So they will be using it. It just hasn't been out long enough for them to really go full throttle on it. Okay. How do you go about debugging the application with both JavaScript and C++? Are you using some combination of the Chrome web tools and a standard debugger on the C++ side? Yeah, I think I would take a step back and say the way I like to write and design code is so that I can avoid ever having to debug it. Okay. That's my number one goal when writing code is to never have to debug it.
Starting point is 00:34:54 And what I like is for my design to have all the bugs and I would love for my implementation to be a transliteration of the design. Obviously, as developers, you know that's not always possible. But that's the goal that I aim for. And so there's a hierarchy of things that I, of approaches and philosophies that I use in order to avoid debugging. That being said, the most effective ways of debugging a hybrid app like this, number one, printf debugging. If you're any sort of developer, you probably use printf debugging
Starting point is 00:35:35 as your first step. I do anyway. That's my first step. If I've got a bug, I'm trying to figure out what's going wrong. And there's a little bit of trickiness around there because JavaScript has its own logging. And what you need to do is tie that logging into your application logging. So again, if you download the application, look at the code, I think there's a file called log.js, which actually connects the JavaScript logger to my C++ logger. And that's step one in printf debugging. And then, well, that's the only step you need to do to enable printf debugging for both C++ and JavaScript. And let's say printf debugging doesn't work, then yeah, you have to be ready to debug using two different debuggers.
Starting point is 00:36:21 And it's honestly not that big of a deal. But if you have to do it too often, I can imagine you wouldn't like it. So I would recommend that if you don't like debugging and you try not to have to debug, you'll be fine. But if you're in the debugger every day, you're going to hate it and you'll be miserable. So don't use this approach. QWebKit does provide you with some kind of a debugger you can use? It does. So it has the built-in inspector, the WebKit inspector. Oh, okay.
Starting point is 00:36:54 And again, if you download the application, I think if you press F11, it'll actually launch the debugger. Oh, okay. So you can actually use the debugger in the deployed application. I'm not sure if I'll ever disable that or not, but it's there. So, yeah. So I guess kind of from a practical perspective here, do your users, can they tell that they're using a hybrid application
Starting point is 00:37:22 or do they feel like they're still using your C++ application? I think I'm going to wait to find out. Okay. But so far, the feedback I've received is, oh, my God, this is so much better than version one. That's what I aimed for. And just because I did it with a web UI or a hybrid UI, it's not really relevant, I think, to the users. What they want is, is it better than what
Starting point is 00:37:53 you had before? Right. And so far, the answer seems to be yes. But time is still going to tell on that question. But they're not like, hey, what the heck, why did you just pop up a web browser in the middle of my program? No, they don't know it's a web browser. So it doesn't look like a web browser, even though it is a web view. You could make it so that they couldn't tell, but really it turns out people don't care most of the time. If you look at, for example, Skype, which is what we're using right now, they switched to HTML years ago, I think.
Starting point is 00:38:34 I don't know if they switched back now, but at some point they switched to HTML. It made their UI much more dynamic and much more interesting. And I think for them it was a good decision, but I don't know if they switched back. So there are examples out there where people, they just generally don't care. Yeah, I know there are other applications that I'm familiar with that use a web UI. I'm not sure if any of them are using C++ backend, but the Slack, Windows Client, and also Visual Studio Code, I believe, are both using a web-based UI.
Starting point is 00:39:10 Exactly. And this is the way it's going, right? And so, you know, it's going that way, and I think people should be aware. Okay. How do you go about shipping updates to an application like this? So one of the philosophies that I try to live by is try and do what the user expects on the platform that they're on. So Windows updates. Well, at the moment, there's no package manager there is the windows store but there's no package manager so i use on windows i use something that looks a lot like what i use on mac which is sparkle
Starting point is 00:39:54 have you guys heard of sparkle no so sparkle is uh it's a framework for providing updates on osx and it publishes this thing called an app cast. Sorry, you as the developer, you publish this thing called an app cast. And Sparkle checks this app cast every few days or whatever for updates. And the way it works is it downloads your installer and just your user doesn't have to go to the website or anything. And it downloads and installs your update.
Starting point is 00:40:24 On Linux, on the other hand it's still something i'm toying with i would love for it to be updated with the package manager itself i just haven't had uh the the critical mass on the new version to really get that tested and sorted out so for now, those people have to also subscribe to the AppCast feed. And when there's an update, they can click and download it. But I really want to do the native. So on Mac, the native thing is typically a Sparkle-like updater, which is why I use Sparkle. Do you have any questions, Jason?
Starting point is 00:41:10 I do not okay well so hail it's been great talking to you and learning more about uh c++ and javascript integration yep it's been great talking to you guys it's nice to see how the sausage was made where can people find you online? They can probably find me most likely at the product website, which is worklogassistant.com. They can also email me at sohilsomani.com. But as you said, don't visit the domain itself. And that's pretty much it. That's what I spend my time doing most of the time so that's the best way to get in touch with me
Starting point is 00:41:48 well thank you so much for your time today nice to be here thanks so much for listening as we chat about C++ I'd love to hear what you think of the podcast please let me know if we're discussing the stuff you're interested in or if you have a suggestion for a topic I'd love to hear that also
Starting point is 00:42:03 you can email all your thoughts to feedback at cppcast.com. I'd also appreciate if you can follow CPP cast on Twitter and like CPP cast on Facebook. And of course you can find all that info and the show notes on the podcast website at cppcast.com. Theme music for this episode is provided by podcastthemes.com.

There aren't comments yet for this episode. Click on any sentence in the transcript to leave a comment.