Forgot your password?

typodupeerror
Image

Book Review: Android User Interface Development 111

Posted by samzenpus
from the read-all-about-it dept.
RickJWagner writes "So you want to be an Android developer? If you're like me, you've probably been wanting to learn how to program a mobile device, but just haven't found the time to master Objective-C. So now that Android is here, all of us garden-variety Java coders can jump on the bandwagon and start slinging apps out, right? Well, it turns out there's a little more to it than that. This book can make the trail from everyday Java code slinger to best-selling Android app writer a little more plausible." Read below for the rest of Rick's review.
Android User Interface Development
author Jason Morris
pages Packt Publishing
publisher 304
rating RickJWagner
reviewer 1849514488
ISBN A good resource for Android developers who aren't already UI experts.
summary 7/10
The book does not teach Android development. For that, there are other books and the Android SDK documentation, which I found adequate for my uses so far. This book emphasizes teaching Android User Interface development, which is something I would not have had much of a clue about without the book. (The Java and XML-based configuration of Android is easy enough for a back-end Java coder like myself, but I've never been a web-design and layout guy. Or fat-client layout and design guy for that matter, either.) That's the sweet spot for this book.

Android newbies do get an introductory chapter that guides the reader through setting up the SDK and writing a quick first app. After that, the book starts to take a serious UI bent, and that's o.k. because that's where the book's intended to go. The earliest chapters cover UI-centric matters like asking the user a question and processing the answer that is returned. List selections are explained (i.e. single-select button choices versus multi-select). Functional features like adding a header or a footer are explained.

The middle chapters cover pragmatic issues like producing an image gallery, handling date/time inputs, and validating user inputs. Layouts in Android are explained, which will be somewhat familiar to Java Swing developers. I had an interest in learning how animation works (don't we all dream of writing the next viral-selling game?), this is explained as well.

The final chapters deal with styling (i.e. how to change the way a button looks) and themes. It's very important that your application 'feels' like it should, and this is given adequate coverage in the book. I'm sure a back-end coder like myself would botch this part horribly without guidance, so I can appreciate the reason the book emphasizes these things.

The book is written in Packt's 'Cookbook' style. If you haven't seen one of these before, the book is largely cut up into sections covering some general idea. Within the section you'll find headings for the topics "Time for Action", "What Just Happened" and "Have a Go, Hero". "Time for Action" is a series of instructions that spell out exactly what to do for a sample scenario. "What Just Happened" follows up with an explanation of why the reader was asked to execute the instructions. "Have a Go, Hero" is a section challenging the reader to extend the spoon-fed instructions by implementing a next-step challenge. This style of writing emphasizes hands-on knowledge transfer without a lot of verbose theory, so it'll be good for readers who like to learn as they code. Contrast this to books that have a lengthy section of text explaining all the details of some topic, followed by a monolithic code blob towards the end of the chapter-- this book is not written that way.

The sample code that's available on Packt's site is clean and easy to understand. It follows the same structure as the sample code you'd find in the SDK, so if you're brand new to Android development you might start with the SDK teachings and then extend it with the book as soon as you're ready. I thought the examples the book presented were almost all reasonably relevant. The author did a good job of keeping the exercises presented throughout the book well contained, so you're never asked to code too much stuff at one time. I like that, as it lets you read the book without having to set aside a huge block of time at once to see the results of your coding efforts.

So who is this book good for? I'd say it's a good resource for Android developers who aren't already UI experts. I'm not saying it's good for Android newbies who need to learn the basics of Android programming, because there's just too little introductory material for that. But if you can already hack something together, and want it to be appealing to someone besides yourself, this book can help.

You can purchase Android User Interface Development from amazon.com. Slashdot welcomes readers' book reviews -- to see your own review here, read the book review guidelines, then visit the submission page.

*

This discussion has been archived. No new comments can be posted.

Book Review: Android User Interface Development

Comments Filter:
  • by Anonymous Coward on Wednesday March 23, 2011 @02:35PM (#35589966)
    yet another packt publishing review.
  • by wvmarle (1070040) on Wednesday March 23, 2011 @02:36PM (#35589990)

    Just reading this story when finishing some Android programming work... and it sounds very interesting to me. Especially as UI design is not my strongest point.

    Unfortunately USD 45 is quite steep, will have to add international shipping costs to it even, for a book that I can't check out first.

    Now if they were selling this for a few bucks as e-book, I'd be digging up my credit card instead of writing this comment. Besides, it's a bit strange these days that a book about computers and programming does not come in e-book format.

  • by jmcbain (1233044) on Wednesday March 23, 2011 @02:37PM (#35589992)
    I've written some basic software on Apple iOS and also the fragmented Android. Apple's XCode has a wonderful Interface Builder GUI component that lets you lay out your interface's widgets exactly (and in XCode 4, the Interface Builder is now part of the XCode IDE rather than a separate program). Now, I know that Android (and the Java GUI system from which Android illegally stole most of its functionality) is based on layout flows, so having an Interface Builder to place elements exactly on the screen isn't the correct approach for Android's fragmented system. Nonetheless, the XCode Interface Builder lets me set widget properties and connect source code to the widgets. Similarly, in Microsoft's Visual Studio, there is a nice interface construction GUI-based builder system as well. Is there an equivalent Interface Builder for Android, particularly one that isn't affected by Android's pervasive fragmentation?
    • It's the ADT Plugin for Eclipse [android.com], jackass. If you'd taken a glance at the Dev Guide [android.com] you wouldn't have had to type out that dumb comment.
      • by $1uck (710826) on Wednesday March 23, 2011 @02:56PM (#35590232)
        Why respond to an obvious troll?
      • by jmcbain (1233044) on Wednesday March 23, 2011 @03:25PM (#35590586)
        The fact that you saying that the ADT Plugin has a tool even remotely close to Apple's Cocoa Interface Builder is shameful. Android has nothing like Interface Builder or Visual Studio's GUI builder. It's like comparing a Camry to Porsche, or Android to iPhone.
        • I have no idea why you're at 0: Troll. ADT is nothing close to IB, or even Microsoft's WPF tools. If you haven't tried them all, don't rush to make judgement.
        • by hey! (33014) on Wednesday March 23, 2011 @04:46PM (#35591754) Homepage Journal

          Well, *coding* the user interface is one of those things that seem daunting when you set out, but turns out to be no big deal after you've learned your way around a platform. The real challenge is *designing* a mobile user interface, which is especially hard for developers coming from a desktop app background. It's important not to transfer your keyboard/mouse/big ole display ways of doing things to a palmtop device. There aren't just disadvantages your app has to work around (e.g. the screen is really tiny) but there are advantages you need to exploit (less modality than a keyboard and mouse interface).

          That's not to say that having a great interface builder isn't a convenience, or that the developers of such a thing don't deserve a hearty pat on the back. It's just that I would never choose a development platform, much less a *target* platform, based on how much I liked an interface builder. I'll do without a GUI for building the interface, so long as it's possible to get good looking results and the platform has other features that make my overall job easier.

        • by ustolemyname (1301665) on Wednesday March 23, 2011 @05:34PM (#35592286)
          Hey! I drive a Camry. How does it not compare to a Porsche? It's comfy, gets good mileage, decent speakers and takes me where I want to go.

          The comparison you are looking for is "comparing a Porsche to a stick up your..."




          (guy who dabbles in android but really envies his iOS dev buddy)
        • Apple's Interface Builder is very much a double-edged sword though. Because it's designed as the way to create interfaces on iOS, the .xib XML files that it creates are inscrutable. They're a step up from the old .nib files, which were binary, but they're still not made for human consumption.

          This means that you can't fall back to the text editor to make changes when Interface Builder refuses to do what you want it to do. Thankfully, IB is good enough that this is a fairly rare occurrence (other graphical editors might not be so good). Worse, it makes diagnosing and fixing bugs that crop up during regression testing much more difficult, because it's hard to tell exactly what's changed when viewing a diff between versions.

          The graphical environment that comes with the ADT plugin is crap by comparison (hey, when your dev environment is built on Eclipse, my expectations are low). But the fundamental idea behind it is different. Android layout XML files are meant to be written and read by humans, and the graphical editor is just an optional extra that can help you learn how to write the XML. And a diff between two different versions of an Android layout XML file will be illuminating, not baffling.

          I've only had the briefest introduction to Visual Studio, so I won't comment on it. It reminded me of using Visual Basic 6 in high school though.

      • I hate to agree with the troll, but he's right on that point: UI Layout on Android is sorely lacking compared to the offerings from Apple and Microsoft.

    • by Anonymous Coward on Wednesday March 23, 2011 @02:47PM (#35590118)

      Android's GUI system actually has pretty much fuck-all to do with Java Swing; the patent infringement allegations mostly have to do with techniques used in Dalvik's JIT system, if I remember correctly.

    • by Anonymous Coward on Wednesday March 23, 2011 @02:49PM (#35590136)

      Think you could say fragmented a few more times there?

      Yes, there is an interface builder for Android in the eclipse ADT plugin. You probably already know this, but "haters got to hate", I suppose.

    • by psyclone (187154) on Wednesday March 23, 2011 @02:52PM (#35590172)

      To answer your question, there are a few GUI Builders like this one [droiddraw.org], but they aren't great [yet].

      Carrier/handset device fragmentation does mean the developer needs to account for different sizes/resolutions of screens. Using flow-based layouts, this allows the developer to create one UI and apply it to many devices (phones, tablets, laptops, TVs, etc.)

      Do you have to create two exact UIs, one for iphone/ipod and the other for the ipad using the XCode Interface Builder (assuming you don't just "scale" the smaller UI to the larger screen)? And what if you were able to run your app on AppleTV someday.. would you then need to create a third exact layout?

      • You can use a single nib for iphone and ipad (both horizontal and vertical orientations) if it's the exact same UI. Of course, some people want to take advantage of the larger screen size and iPad-specific UI functionality.

        The hypothetical apple TV app isn't touch based, so re-using the exact same iPhone/iPad UI doesn't make much sense.

      • by SuperKendall (25149) on Wednesday March 23, 2011 @03:58PM (#35591046)

        Do you have to create two exact UIs, one for iphone/ipod and the other for the ipad using the XCode Interface Builder (assuming you don't just "scale" the smaller UI to the larger screen)?

        You don't have to but in practice you do. Where the fingers are positioned when holding, the way the keyboard comes up, even the styles of navigation that make the most sense all differ from large to small devices.

        Interface Builder in XCode provides very nice tools to build scalable interfaces, and they work well to support rotation. But if all you are doing to support a tablet is allowing a small screen to scale up... the in the immortal words of technical users the world over, you are Doing It Wrong.

        The correct way to think about the move from a smartphone sized to display to a tablet sized display is the concept of Responsive Design [needmoredesigns.com].

        That's a lot of text, but what is it really? It's realizing that with more space you can present more information, very well illustrated by this site that collects examples of responsive design:

        http://mediaqueri.es [mediaqueri.es]

        Now those are talking about the context of web design, but the idea applies equally well to application UI design.

        What you should be doing in a design tool is building a scalable component that can be placed as a node into a responsive design.

        But it does mean the container may be different depending on the device, where you select the best container at runtime - especially in terms of arranging navigation.

      • Given the introduction of Android Tablets and Honeycomb, Android devs are going to have to start making two different UI layouts for phone and tablet apps. Mainly because consumers of tablet apps are going to expect you to do something with the extra space a tablet affords other than just making everything bigger. Also, because the tablet versions of the OSes come with new UI controls specifically for tablets.

        • by psyclone (187154) on Wednesday March 23, 2011 @06:09PM (#35592666)

          A proper flow-based layout could work for both a small screen and a large one. Think more scrolling for the small screen, while text and other elements flow into the available space for the large screen. Just like good HTML + CSS; content can look great on a wide variety of screen sizes.

          • I've had Xoom since release date, and GP is right. While it's true that dynamic flexible layouts that are the hallmark of (most) Android apps scale to tablet screen size more often than not - most of my phone apps still look okay - they're not perfect in that respect. In particular, on small screens, developers tend to stuff a lot of secondary functions away in the context menu, some of which on tablet are better placed in an always-visible toolbar or suchlike. Also, because the screen is wider (even in portrait), sometimes it makes sense to do two-column layout instead of single-column with everything stretched to width.

          • I'm not debating that the flow based layouts of Android won't properly scale; quite the opposite, I believe the layout manager I wrote for my phone will scale up (aside from some of the image assets) and fit the tablet view just fine. The thing is, with a tablet, there's a lot more that I could do than just scale everything up. Taking some iPad apps as an example (as I haven't really looked at many Android tablet apps), the sketching apps use the extra space not just for more canvas, but also to introduce persistent color pickers and toolbox panes that stay on the display, instead of having to be launched from a menu. That's an example of better using the extra space.

    • by tehcyder (746570) on Thursday March 24, 2011 @05:41AM (#35596390) Journal

      I've written some basic software on Apple iOS and also the fragmented Android. Apple's XCode has a wonderful Interface Builder GUI component that lets you lay out your interface's widgets exactly (and in XCode 4, the Interface Builder is now part of the XCode IDE rather than a separate program). Now, I know that Android (and the Java GUI system from which Android illegally stole most of its functionality) is based on layout flows, so having an Interface Builder to place elements exactly on the screen isn't the correct approach for Android's fragmented system. Nonetheless, the XCode Interface Builder lets me set widget properties and connect source code to the widgets. Similarly, in Microsoft's Visual Studio, there is a nice interface construction GUI-based builder system as well. Is there an equivalent Interface Builder for Android, particularly one that isn't affected by Android's pervasive fragmentation?

      I don't think you used the word "fragmented" enough.

  • by Anonymous Coward on Wednesday March 23, 2011 @02:40PM (#35590046)

    I'm getting more and more interested in Android -- especially as the newly redesigned XCode 4 is the worst IDE I've ever used -- but I am not going to read a review by someone who finds Obj-C a significant effort to learn from Java. That's a sign that you're a code monkey and not someone who has anything close to a deep understanding of programming; moving in either direction between Java and Obj-C is one of the dead-simplest transitions amongst distinct programming languages.

  • by EMB Numbers (934125) on Wednesday March 23, 2011 @02:45PM (#35590098)

    Saying you don't have time to learn Objective-C is ridiculous. If you know Java, It takes half a day to learn Objective-C. The time consuming part of learning any new technology/platform is learning the frameworks. Cocoa and Cocoa Touch are huge and use design patterns that many coders do not already know. Fortunately, the design patterns are used everywhere, and they are used consistently. Once you understand and recognize the patterns, there is no more productive and flexible framework on the planet.

    Frankly, learning the design patterns will make you a better programmer no matter what platform you choose. It's worth it just to advance your computer science knowledge.

    • by Daniel Phillips (238627) on Wednesday March 23, 2011 @03:04PM (#35590326)

      Java is immensely easier to develop with than any flavor of C because of garbage collection and lack of pointers. If you do not understand why then please do not come anywhere near my C code.

      That said, I personally prefer to put in the extra work and develop in C++ because the result usually starts faster and performs better. And I absolutely detest JNI.

      • by beelsebob (529313) on Wednesday March 23, 2011 @03:13PM (#35590440)

        Java is immensely easier to develop with than any flavor of C because of garbage collection and lack of pointers. If you do not understand why then please do not come anywhere near my C code.

        1) Objective-C has garbage collection (though admitedly not on iOS at the moment)
        2) Even without GC, cocoa's reference counting system is about the best there ever has been and makes life *almost* as easy as GC –just gotta watch out for retain cycles.
        3) Java very much has pointers – that's why you can get Null pointer exceptions ;)

        • Don't forget that with the new Objective-C 2.0, reference counting is a thing of the past thanks to auto-released objects, and properties which are automagically created for you. Objective-C may not be the easiest OO language, but it sure is easier than ever (and I am an Android fan BTW).
          • by beelsebob (529313) on Wednesday March 23, 2011 @05:02PM (#35591970)

            Don't forget that with the new Objective-C 2.0, reference counting is a thing of the past thanks to auto-released objects

            autorelease is a method in cocoa and has nothing to do with ObjectiveC 2.0. Notably, it has nothing to do with making reference counting a thing of the past –it is in fact part of the ref counting system – it adds the object to a set of objects to have their reference counts decremented when the current stack unwinds back to the next autorelease pool drain.

        • by mswhippingboy (754599) on Wednesday March 23, 2011 @07:39PM (#35593614)

          Java is immensely easier to develop with than any flavor of C because of garbage collection and lack of pointers. If you do not understand why then please do not come anywhere near my C code.

          1) Objective-C has garbage collection (though admitedly not on iOS at the moment)

          Sort of an important distinction don't you think given that it's not available on iOS and this thread is about mobile development?

          2) Even without GC, cocoa's reference counting system is about the best there ever has been and makes life *almost* as easy as GC –just gotta watch out for retain cycles.

          Not a little biased are we?

          3) Java very much has pointers – that's why you can get Null pointer exceptions ;)

          Now here you go just spreading FUD. Java does NOT have pointers. None. Absolutely none. Despite the inappropriately named NullPointerException, pointers do NOT exist in Java. Java has references. References are != Pointers. Pointers "point" to a memory location. References "reference" an object. These are very different concepts and I don't care to write a tutorial on the subject here on /. Suffice it to say that pointers provide a mechanism for code to corrupt (whether intentionality or not) memory while references (being immutable) preclude this.

          • by Anonymous Coward on Thursday March 24, 2011 @12:48AM (#35595378)

            Now here you go just spreading FUD. Java does NOT have pointers. None. Absolutely none. Despite the inappropriately named NullPointerException, pointers do NOT exist in Java. Java has references. References are != Pointers.

            References are pointers without an explicit need to dereference them. Every reference is internally a pointer.

            Pointers "point" to a memory location. References "reference" an object.

            Internally they are identical. Both contain a natural word-sized number that references a memory location.

            These are very different concepts and I don't care to write a tutorial on the subject here on /.

            I'll take the time to write a tutorial. Pointers and references are internally identical. References as a language construct do not permit address arithmetic, while C pointers do. References are not immutable, they can be reassigned.

            Suffice it to say that pointers provide a mechanism for code to corrupt (whether intentionality or not) memory while references (being immutable) preclude this.

            I don't think immutable means what you think it does.

            • by mswhippingboy (754599) on Thursday March 24, 2011 @11:37AM (#35599040)
              You are soooo wrong on nearly every point.

              References are NOT internally pointers. Just run a java app in a debugger and step through the code. Look at each reference created. The first reference created will have a reference id of something like 16, the second will be 17, and so on. These are simply "references" used to lookup the object, not address locations in memory. In C you can take a pointer and add 1 to it to address the next byte in memory, but you cannot do this with a reference. That's a VERY big difference. If there was a way to increment the reference id (which there is not - and this is not a language construct issue, it is not possible due to the architecture of the JVM), you would be simply referencing a completely different object, or referencing an object that does not exist which the JVM does not allow. In C, a pointer with an address value of 0 is a null pointer, but in Java a variable set to a null reference does not point to an address of zero, but rather references a special object in the JVM called the null object. Again, a big difference.

              References ARE absolutely immutable. You can reassign a variable to a different reference (thereby referencing a different object), but you cannot change the reference itself.

              I suggest you learn a little about what you are speaking of before making a fool of yourself.

      • by pslam (97660) on Wednesday March 23, 2011 @03:16PM (#35590474) Homepage Journal

        Java is immensely easier to develop with than any flavor of C because of garbage collection and lack of pointers. If you do not understand why then please do not come anywhere near my C code.

        Funny, I find any flavor of C immensely easier to develop responsive applications due to pointers and the lack of garbage collection. I get the impression I don't want to see your C code.

      • by Desler (1608317) on Wednesday March 23, 2011 @04:15PM (#35591350)

        Java is immensely easier to develop with than any flavor of C because of garbage collection and lack of pointers.

        What exactly is so hard about pointers? Unless you're a mouth breather pointers are quite easy to learn. Also Java DOES have pointers that's why there is even an exception [oracle.com] for when they are NULL.

        • by mswhippingboy (754599) on Wednesday March 23, 2011 @07:18PM (#35593414)

          Also Java DOES have pointers that's why there is even an exception [oracle.com] for when they are NULL.

          Actually, to be precise, Java does NOT have pointers (despite the mis-named NPE). It has references. References are NOT the same thing as pointers. While they serve a somewhat similar purpose, they are very different in implementation. I won't go into a long discussion of this on /., but the fact that you are equating the two is misleading and needs to be flagged.

          Also, statements like "What exactly is so hard about pointers?" is just geek bravado. I'm a long time hired gun and I can't count the number of times I've had to come into a C or C++ project because the team of programmers working on it could not resolve the reliability issues which were primarily due to pointer problems or memory leaks. While there are definitely performance considerations in Java (and a wise man knows that nothing in life is free), Java offers productivity gains over C (and even Obj-C IMHO) while still maintaining reasonable performance. This combination is unmatched by other language platforms at the current time (although I'd say C# runs a close second - again IMHO).

          Programming languages are many, and the way I look at it, they are all part of a continuum from the bare bones assembly languages all the way through to the highest level languages. Each (well, most) have things I like and things I don't and every developer has their own taste. There is no "best" language, but for a particular application, there is usually a best choice (and it doesn't always have to be based on technical merit).

          • by Desler (1608317) on Thursday March 24, 2011 @12:17PM (#35599590)

            Also, statements like "What exactly is so hard about pointers?" is just geek bravado. I'm a long time hired gun and I can't count the number of times I've had to come into a C or C++ project because the team of programmers working on it could not resolve the reliability issues which were primarily due to pointer problems or memory leaks. While there are definitely performance considerations in Java (and a wise man knows that nothing in life is free), Java offers productivity gains over C (and even Obj-C IMHO) while still maintaining reasonable performance. This combination is unmatched by other language platforms at the current time (although I'd say C# runs a close second - again IMHO).

            Yeah, how dare someone actually learn about how the internals of hardware works and how their code actually runs!! Such bravado!! Oh wait, that's just common knowledge that pretty much EVERY programmer should know. Secondly, I can quite trivially point you to a famous Java program, Minecraft, that has dozens up dozens of posts on the Minecraft forums about nullpointerexceptions [google.com] and memory leaks [google.com]. Yeah, Java may have been "more productive" (a completely subjective term because I know numerous people who are far more productive in C and C++ than many Java mouth breathers could ever hope to be) for making Minecraft and yet it seems to have all the same issues with memory leaks and pointer problems as you whine about in those C and C++ projects. This is the reason why even Java mouth breathers need to learn these concepts because having your hand held by the JVM clearly doesn't seem to be working.

            Also, Minecraft isn't the only example one can bring up that share those memory leak and nullpointerexception problems. I've seen it in tons of them. Also, I've seen numerous C# applications and libraries that have all sorts of null exceptions and memory leak issues too. They probably also had the same mindset of "Durrrr learning pointers and memory management is too hard so I'm just going to chunk out mah code and hope duh JVM/.NET runtime handles all the problems".

            • by mswhippingboy (754599) on Thursday March 24, 2011 @01:09PM (#35600390)
              It's not about "about how the internals of hardware works and how their code actually runs!!". Most of my customers don't give a damn whether I can look at a hex dump of some machine code and recite the mnemonic instructions they represent from memory, they just want the code to work, and work reliably.

              Just because I can write assembly code that would kick your C-code's ass in terms of performance (and believe me, I can) doesn't mean my customers who are paying me by the hour want me to take the time to write everything in assembler. No, they want me to produce quality code that performs well, is reliable and I can get done quickly and within budget. Unless they specifically want me to write the code in C or C++ (or assembler), I can be much more productive in Java, that's just a fact. It's not because I don't understand C/C++ or pointers or manual memory management, I've logged many years doing exactly that, it's that not having to devote a as much bandwidth to dealing with memory management allows me to concentrate more on the logic/algorithm that I'm implementing. Assuming that because someone is more productive in Java than in C/C++ is because they don't understand the later is an invalid assumption, just as assuming that someone that is more productive in C/C++ than in assembler is because they don't understand assembler is an invalid assumption.

              Your references to Minecraft mean nothing. I can point out plenty of C/C++ programs that have plenty of problems as well. Bad programmers are a bad programmers regardless of the language they are using. You're references to Java programmers as "mouth breathers" is pure ignorance.

              As a long time assembler programmer, I could take take the same stance your are taking and claim C programmers are not real programmers because they let the compiler "hold their hand" managing registers rather than understanding the hardware internals. In fact I recall many years ago my assembler colleagues making that very claim about "C" programmers. They were wrong then just as you are wrong now. The real key is an intimate understanding the language platform you are working with, regardless of whether it's assembler, C or Java. Efficiency is not guaranteed by any language but rather, it is the responsibility of the developer.

              • by Desler (1608317) on Thursday March 24, 2011 @05:52PM (#35605074)

                Your references to Minecraft mean nothing.

                Actually it means quite a bit in counter to your:

                I can't count the number of times I've had to come into a C or C++ project because the team of programmers working on it could not resolve the reliability issues which were primarily due to pointer problems or memory leaks.

                because you were attempting to try to paint a picture where Java programs don't have those problems yet it's trivially easy to find Java programs with memory leaks and throwing nullpointerexceptions. And it all has to do with shitty mouth breathers who learn Java but know jack and shit about how to write software because all those things like pointers are "too hard".

                • by mswhippingboy (754599) on Thursday March 24, 2011 @08:49PM (#35607122)
                  No, I was pointing out that having to manage memory manually can easily lead to less reliable software. Having the runtime manage memory allocation/deallocation, while not completely eliminating the need to worry about memory over consumption entirely, leads to more reliable software and increases productivity. You can disagree all you want, but almost all modern languages today incorporate automatic memory management. Objective-C is now incorporating it, .Net languages have always had it. Even most C/C++ compilers now support managed memory, which is just another way of tacking the same issue that has plagued C and C++ from their inception. There is a reason for this trend toward automatic memory management and it's not just because it allows idiots to become programmers. Even though it does take away some the bullets that idiot programmers have to shoot themselves in the foot with, it's main reason for being is that it makes software development more productive and reliable.

                  No matter how good a C/C++ programmer you may be, you are still fallible and the slightest mistake with pointer or memory allocations can lead to a crash of the software. Worse than crashes, which can usually be easily debugged, corrupted memory may go completely undetected. In high transaction volume business software errors can cost real $$$, so data integrity is of utmost importance. In C/C++ you have no way to be 100% sure this will not occur unless the program is trivially small.

                  Finally, what you are calling memory leaks in Java are not memory leaks at all. A memory leak (as often happens in C/C++ programs) is when a pointer to a block of allocated memory is changed, but the memory is not deallocated, resulting in memory that is no longer addressable. This cannot happen in Java since, once an object is no longer referenced, it is removed by the garbage collector. It is absolutely possible to chew up memory in Java by allocating objects and never allowing them to be garbage collected (because they are still referenced in the code) and obviously you can cause a NPE. The difference between these problems in Java and C/C++ is that these conditions are relatively easy to detect and correct in pure Java. I say "pure" Java because once you venture in JNI or some of the Android APIs all bets are off because the JVM is no longer managing resources.

              • by Desler (1608317) on Thursday March 24, 2011 @06:08PM (#35605346)

                I can point out plenty of C/C++ programs that have plenty of problems as well.

                Great, but neither I nor anyone else tries to claim that C and C++ programs are immune to those problems. Java weenies on the other hand are constantly telling us how Java eliminates memory management issues, null pointers, etc and yet numerous high profile Java programs suffer from all those issues.

                Bad programmers are a bad programmers regardless of the language they are using.

                Yes, which is why we shouldn't be ENCOURAGING more bad programmers by allowing them to get away with not actually learning enough to do their craft correctly.

                You're references to Java programmers as "mouth breathers" is pure ignorance.

                Nope.

      • by aristotle-dude (626586) on Wednesday March 23, 2011 @04:34PM (#35591604)

        Java is immensely easier to develop with than any flavor of C because of garbage collection and lack of pointers. If you do not understand why then please do not come anywhere near my C code.

        That said, I personally prefer to put in the extra work and develop in C++ because the result usually starts faster and performs better. And I absolutely detest JNI.

        Since you seem to think that garbage collection is magical and never causes problems, I assume that you have never worked with file handles or network sockets.

        You should NEVER rely on garbage collection to deal with resources such as files and network sockets. Both should always be closed explicitly when they are no longer needed. I would hate to see your code.

        • by Anonymous Coward on Wednesday March 23, 2011 @04:45PM (#35591750)

          Or in C# if you deal with anything relating to GDI handles such as Bitmaps, Fonts, Rectangles, etc. It's hard to count how many times I've come across bugs due to people forgetting to release these resources just assuming that the garbage collector takes care of everything. Now in some cases this is due to the fact that some documentation won't explicitly tell you this, but today's "programmers" (really just scripters) seem to overly reliant on some other mechanism cleaning up their shit. Can even a good or great programmer still have issues with null pointers, memory leaks, etc? Sure, but since they actually bothered to LEARN such things as manual memory management and pointers (which really are not THAT hard of subjects despite protestations to the contrary) they have fewer and fewer issues with such. Throw a Java scripter into C or C++ and the amount of bugs related to pointers, memory management, etc are usually astronomically because they never bother to think about such things because the JVM or the .NET runtime has been doing all that for them for so long.

          • by Daniel Phillips (238627) on Wednesday March 23, 2011 @10:41PM (#35594754)

            ...since they actually bothered to LEARN such things as manual memory management and pointers (which really are not THAT hard of subjects despite protestations to the contrary) they have fewer and fewer issues with such.

            But never zero, and the few issues that slip through tend to be doozies. BTW, if you think that memory management is an easy subject then you have not yet scratched the surface of it.

          • by wdef (1050680) on Thursday March 24, 2011 @03:56AM (#35595964)

            ... today's "programmers" (really just scripters) seem to overly reliant on some other mechanism cleaning up their shit. Can even a good or great programmer still have issues with null pointers, memory leaks, etc? Sure, but since they actually bothered to LEARN such things as manual memory management and pointers (which really are not THAT hard of subjects despite protestations to the contrary) they have fewer and fewer issues with such.

            Reasons that everyone should learn C even though the latter always takes thought. I guess unless you'te programming in C all the time you just can't be asleep at the wheel, ever. I taught myself C and Perl and still dabble. I have this sneaking suspicion that these mobile platform thingies just can't be all that hard.

        • by Daniel Phillips (238627) on Wednesday March 23, 2011 @10:37PM (#35594724)

          I assume that you have never worked with file handles or network sockets.

          Heh, good one.

      • by GooberToo (74388) on Wednesday March 23, 2011 @05:16PM (#35592126)

        Well, Android's framework makes leaks trivially easy. Read the developer blogs and the various other tidbits they provide. They are full of donts to prevent leaks left and right. Hmmm...was suppose to be a feature of Java and a major one-up over C++ and other languages. Not with Android...

        As an android developer who didn't originally have much background in Java (years ago), I can tell you I pine for C++ or python. Java tries to be a better C++ but fails. Its like the libraries were created by purists who had never actually done anything OO. Everything is painful to use because its never been normalized for how people actually do things. As such, its frequently far more verbose and tedious or on par with C++. Which always raises the question; why am I not doing this in C++ already. And then on the other side, there is something like Python. I've literally written several pages of Java code to do what a half dozen lines of python code is able to do. So Java isn't really as high level as everyone would have us to believe. And the size is largely driven by the fact it was designed by purest who seemingly, didn't have the experience to be writing something like Java. Which means it doesn't really challenge C++ and its far from challenging the likes of Python.

        So in a nut shell, there absolutely are very strong reasons why many people were in a hurry to rush to the NDK once it actually supported C++ (exceptions, templates, RTTI; contrary to Google's assertions, they didn't actually support C++ for a long, long time ) and the ability to develop full blown android applications. The lack of Dalvik performance was only part of the rush developers had for the NDK. Of course it didn't help that literally, Google thinks C++ is C with a couple of extra features; which is why C++ on Android was originally so screwed up and crippled.

        Long story short, I absolutely agree with you. If you're interested in Android development and do not absolutely love, love, love Java, and feel even moderately comfortable with C++, skip Java/Dalvik completely.

        • I actually wonder why someone doesn't wrap Android Java-only APIs via JNI and exposes them as well-written, idiomatic C++ (like you said - exceptions, templates where convenient, etc).

          • by GooberToo (74388) on Thursday March 24, 2011 @10:22AM (#35598156)

            I guess I didn't communicate it clearly. Android now exposes its API via C++. With the latest release of the NDK, you can now create applications completely in C++. Even better it includes template support, exceptions, and RTTI and they even include a port of STLport.

            If you are comfortable with C++ development, I encourage developers to move directly to C++ rather than bother with Java/Dalvik. The result is frequently smaller and considerably faster. The major down side to doing this is its not multiplatform and can create the need for large apks and multiple compiles per target down the road. But, for now, its really a no brainer.

    • by jmcbain (1233044) on Wednesday March 23, 2011 @03:34PM (#35590698)

      Coming from a rudimentary background of C/C++/Java/C#/Perl/Pascal/Modula-2/BASIC, I find Objective-C's named parameters infuriating.

      Seriously, what's the point of:

      foobar = [myClassObject runMethod:foo withParam:bar andHeresAnotherParam:baz ohWaitOneMore:foobarbaz];

      Sure, if there's a lot of parameters, then naming them is a bit helpful. But I can do that in C by placing the parameters in a struct with named fields and then passing the struct in as a parameter.

      • by Anonymous Coward on Wednesday March 23, 2011 @03:52PM (#35590952)

        Well, then you are in luck - Objective-C does not have named parameters.

        It has infixed multi-part method names, just like Smalltalk.

      • I like the mulit-part method names in Objective-C. They tell me what I'm passing in, as opposed to just knowing the type that I'm passing in. And I don't have to declare infinity billion structs to do it your way.

      • by Anonymous Coward on Wednesday March 23, 2011 @05:05PM (#35592000)
        I agree to a certain point. Objective-C is a kludge designed by a C programmer who wished he could be writing in Smalltalk. It was initially just a simple preprocessor for C, but as sometimes happens, the kludge gets picked up and gains enough popularity that it sticks around.

        Having said that, there are certain attributes it brings to the table (the dynamic typing and message passing of Smalltalk combined with the speed of C) that can be advantageous for certain applications.

        Where I take issue with Apple is the idea that Obj-C is the only language you should be using which only an idiot (or Apple fanboy) would buy into.

      • by torako (532270) on Thursday March 24, 2011 @05:35AM (#35596362) Homepage
        You don't have to use names for your parameters if you're writing your own classes. [myClassObject method:foo :bar :baz :foobarbaz] can be used if you declare the method that way. Also, runMethod:foo in your example is a bit misleading, because it doesn't mean "run a method called foo", but actually "run a method called runMethod:withParam:andHeresAnotherParm:ohWaitOneMore with parameters foo,bar,baz,foobarbaz]".

        Of course, you can't get around the long names if you want to use any pre-existing frameworks...

      • by teh kurisu (701097) on Thursday March 24, 2011 @06:15AM (#35596568) Homepage

        Seriously, what's the point of:

        foobar = [myClassObject runMethod:foo withParam:bar andHeresAnotherParam:baz ohWaitOneMore:foobarbaz];

        It's simple (hell, the IDE will autocomplete it for you) and makes your code easier to maintain.

        Sure, if there's a lot of parameters, then naming them is a bit helpful. But I can do that in C by placing the parameters in a struct with named fields and then passing the struct in as a parameter.

        That doesn't help you at all when you have to call a method (that you didn't write) with the signature doSomething(int, int, double) and the documentation is poor.

  • Money saver (Score:2, Interesting)

    by Anonymous Coward on Wednesday March 23, 2011 @02:46PM (#35590108)

    If you don't think you'll need this book for over 2 months, you may want to get a subscription [packtpub.com] to access *all* books Packt has published. As a side benefit, there's a couple hundred other books you get access to too.

  • by Anonymous Coward on Wednesday March 23, 2011 @03:17PM (#35590486)

    Objective C should take anybody who knows C and understands Java about a day to master. Its extensions are really quite simple and elegant.

  • by EMR (13768) on Wednesday March 23, 2011 @03:23PM (#35590556)

    Has anyone else notice that the field are in the wrong place?

    pages = Packt Publishing?
    publisher = 304 ?
    Someone messed up on the ordering of the fields.

  • So my only choices for smartphone development are Objective C or Java? Seems like a lose-lose situation to me. Why can't I use native C or C++ on either of them?

  • not really (Score:0, Flamebait)

    by toxonix (1793960) on Wednesday March 23, 2011 @04:11PM (#35591276)
    So you want to be an android develeper? No. I'm a Motherfucking programmer motherfucker. And garden variety Java programmers? Is Objective C that friggin obtuse?
  • by ideaz (1981092) on Wednesday March 23, 2011 @04:46PM (#35591758)
    who noticed that table column values are messed up
  • by mdm42 (244204) on Thursday March 24, 2011 @04:04AM (#35595996) Homepage Journal
    The author's blog [wordpress.com] is a good chance to check out his writing, coverage of the kinds of development he's done, and depth of technical expertise. It's also worth mentioning that he is the designer of the EodSQL [java.net] open-source (LGPL) O/R bridge for Java.

    Disclosure: The author is my son, so yeah - proud Dad talking, but seriously check his work out for yourself if you (like me) think the review leaves something to be desired. Personally I'm still reading the book, so can't evaluate yet...

  • by HotBBQ (714130) on Thursday March 24, 2011 @05:17PM (#35604456)
    Ah....the old Java sucks, no it doesn't, C is better, no C++ is, garbage collection is for newbies, I can write some trivial program in that beats your program written in , blah blah blah blah blah. I've seen enough of these threads on /. to know that nothing useful will come of them. Including, especially, this comment. Pro-tip. Does your code meet required specifications? If yes, whodafuckcares.

I'm still waiting for the advent of the computer science groupie.

Working...