Posts Tagged ‘programming’

I recently enjoyed a “fireside chat” at the Indy .NET Consortium, a meetup I run for local .NET developers.

I’ve had some good conversations with interns and others recently who have struggled with or had insights into this transition. My experience as a young developer was a bit different, because I didn’t take the traditional path of high school -> college -> workforce. Mine was high school -> college -> co-op -> left-school to work and create career -> go back to school -> leave school to work again -> work for startup -> work for consulting firm -> start a business -> shut down business and go back to workforce.

Our October 5 meetup talked about how the traditional path can be a bit jarring. The way I explained it to my employees was “In school, you can get an A, B, C, D, or F. And that’s OK. You learn from it. But in the workforce, you either get an A or an F. You can have as many Fs as you want, as long as you end up with an A. Sometimes, within reason, I’ll accept an A- or B+, but it’s rare. We’re paid to deliver, not pass lessons.”

You can watch the entire discussion below:

A friend reached out today and asked “Hey, I need my splash screen to be themed based on whether Dark Mode is selected on the Android device.” I had never done that before, so I was curious how it should be done.

Dark Mode is new to Android 10, a.k.a. Android Q. Not as tasty, but hey, gotta ship something. It has a range of benefits, such as lower energy consumption, looking cool, and frustrating developers without budget for theme-aware apps.

It turns out, after some sleuthing, it’s relatively straightforward.

First, this article assumes you’re following the “splash screen as a theme” approach, which you can learn more about here. The example is for Xamarin.Forms, but the same approach applies to regular Android development.

Basically, you have a “splashscreen” style, and you set it as your app’s theme in the Android manifest. Then, you “swap” to the real theme in MainActivity. For example, what I use in an app, located in resources/values/styles.xml:

  <!-- Splash screen style -->   <style name="splashscreen" parent="Theme.AppCompat.DayNight">     <item name="android:windowBackground">@drawable/splash</item>     <item name="android:windowNoTitle">true</item>     <item name="android:windowIsTranslucent">false</item>     <item name="android:windowIsFloating">false</item>     <item name="android:backgroundDimEnabled">true</item>   </style>

Note my drawable. I want a different drawable for my dark vs. light (normal) theme. Here’s what is different:

  • The parent is now Theme.AppCompat.DayNight
  • I’ve added a different set of drawable folders for the Dark theme images. These are the same folder names, with -night appended to the end:

different drawable-night folders

In this example, I haven’t yet added the other folder variations, but you get the point.

The theme swap code in MainActivity is as follows:

protected override void OnCreate(Bundle savedInstanceState)
{     TabLayoutResource = Resource.Layout.Tabbar;     ToolbarResource = Resource.Layout.Toolbar;     // Swap back to the normal app theme. We used Splash so we didn't have to create a special activity.      // Cute hack, and better approach.     // Idea from URL: https://xamarinhelp.com/creating-splash-screen-xamarin-forms/     Window.RequestFeature(WindowFeatures.ActionBar);     SetTheme(Resource.Style.MainTheme);

That’s all there is to it. If Dark mode is enabled, the splash.png from the -night folder will be used, otherwise the normal image will takes its rightful place.

If you have any questions, please hit me up in the comments.

Special thanks to this StackOverflow article for the –night hint.

More info on Android Dark Theme can be found here.

I recently read a “Coding Question” thread, and a developer was asking what we all thought about this article. I wanted to hold on to my replies, so I’m posting it here for posterity 🙂

Auri:

Only a Sith deals in absolutes. There are use cases for everything, with exceptions.

Auri:

Seriously, though, I’d write tests to ensure the states that you want work as expected.

Auri:

And now that I’ve had my coffee:

Exceptions are a necessary construct. If something doesn’t go as planned, we need a way to handle it. In his article, he’s against blindly swallowing exceptions. That’s generally sound advice. Ask yourself: “Is this an expected exception? If so, do I have a specific exception handler for it, or am I just using the generic catch-all? Have other exceptions occurred? If so, is this one expected? Didn’t I read about C# support for exception switch statements? Did I just shiver?”

Like I was explaining before, only a Sith deals in absolutes. The way I see it, if an error is unexpected, I should have specific use cases for how to handle that exception. I should, generally, never blindly swallow with no logging, or simply re-throw and assume the code above will address. At least, not without a custom/known/non-generic exception I can check up the chain, or include in an integration test. Good article about testing [written by a friend] here, btw: https://arktronic.com/weblog/2015-11-01/automated-software-testing-part-1-reasoning/
At the very least, and I try to follow this rule as much as possible, LOG in any exception for tracking and pro-active/offensive development. Better that you can read logs, or run scripts to let you know about exceptions, and help things go right, than to be blind with a “well, the code seems to work, so let it be” approach. That’s the key goal, really: Help things go right. There are exceptions [heh] to this rule, like simple utility apps whose job is to bulk process data, and exceptions are part of the game. Still, I try to make sure to log, even with those. Unexpected/unintended bugs tend to appear when you’re dealing with massive amounts of data, and logs give a perspective you can’t see from debugging.
Ok, next cup of coffee.

CEATEC, the Combined Electronics and Technology exhibition in Makuhari, Japan is this week. The latest innovations from Japanese companies are showcased here, often many months before Americans get a taste. I’ll be posting a reporter’s notebook in a bit. For now, enjoy clicking through videos and photos of cool things found on the show floor!

Panasonic’s Cocotto Children’s Companion Robot

Bowing Vision Violin Improvement Sensors & App

Hitachi Robot for the Elderly, and those with Dimentia

Omron “Ping Pong” Robot, Now with “Smash” Shot Abilities

au’s AR Climbing Wall

Unisys’ Manufacturing Robot That Follows Lines

VR Racer

Takara Tomy Programmable Robot

Dry Ice Locomotion

Airline Customer Service Bot Attendant

Feel the Biker’s Heartbeat

Wind Sensors Paired with Fun Animations

The Trouble with Tribbles – Qoobo Robot

Spider-Like Robot from Bandai

Semi-Transparent Display with Water Effect

Bandai BN Bot

Model Train

Kunshan Plasma

The Many Faces of Robots at CEATEC

There were MANY robots at CEATEC. Many just sit there and answer basic questions. Still, some, like Omron’s Ping Pong robot, can learn and adapt and make a difference.

 

Micro Adventure was a series books in the 1980s where you had to write computer programs to get from chapter to chapter. It was a great way to learn coding for a geeky kid looking for a good story related to computers. A few months ago, I was granted rights to use the books on a website, and now it’s in beta! Check out the site and let me know what you think!

https://microadventure.net

 

Want to learn all about Xamarin and how you can use it, while not spending most of your time watching code scroll by in a video? I figured there was room for an explainer without being a close-captioner for a code tutorial. Enjoy my latest video!

https://www.youtube.com/edit?video_id=AhvofyQCrhw

From the description, along with links:

Have you been considering Xamarin for your cross-platform mobile app? This presentation will help.

In this non-code-heavy presentation, we’ll discuss:

* What is Xamarin
* Development Environment Gotchas
* Creating a Sample To Do List App without writing any code
* Reviewing a real Xamarin app that’s “in the wild”
* Review native, platform-specific integrations
* Discuss gotchas when using Xamarin, and mobile apps in general
* Answer audience questions

Why not code-heavy? Because there are many examples you can follow online. This presentation will provide valuable information you can consider while reviewing the myriad of tutorials available to you with a simple Bing or Google search, or visiting Pluralsight, Microsoft Virtual Academy, or Xamarin University.

If you have any feedback, please leave in the comments, or ask me on Twitter: @Auri

Here are the links relevant for this presentation:

Slides: https://1drv.ms/p/s!AmKBMqPeeM_1-Zd7Y…

Indy.Code Slides with Cost and Performance Figures: https://1drv.ms/p/s!AmKBMqPeeM_1-JZR4…
(you can find the Indy.Code() presentation on my YouTube channel)

Google Xamarin vs. Native iOS with Swift/Objective C vs. Android with Java Performance Article: https://medium.com/@harrycheung/mobil…

Example code for push notifications, OAuth Twitter/Facebook/Google authentication, and more: https://github.com/codemillmatt/confe…

Link to Microsoft Dev Essentials for $30/month free Azure credit and free Xamarin training: https://aka.ms/devessentials

Microsoft Virtual Academy Multi-Threading Series: https://mva.microsoft.com/en-us/train…

 

I’m continuing my resolution to record as many of my programming and technical presentations as possible. I recently spoke at the inaugural Indy.Code() conference. It was excellent, with an incredible speaker line-up. I hope they, too, post some of their presentations online!

Watch the Video on YouTube

From the synopsis:

Should you write your app “native” or use a “cross-platform” solution like React Native, Xamarin, or NativeScript? The new wave of native-cross-compiling solutions provide significant cost savings, code reuse opportunities, and lower technical debt. Does wholly native, per platform development, still play a role in future mobile development? Let’s discuss together.

In this presentation, we’ll discuss:

  • The growth of native, hybrid, and cross-platform mobile development solutions
  • Cost analysis of multiple native and cross-platform apps
  • Considerations for each native and cross-platform solution
  • Lessons learned

Slides are available here: https://t.co/5iLhEoEfen

If you have any questions, I’m happy to answer them! Please email me or ask on Twitter.

 

I’ve noticed students feel learning object oriented programming appears tough when first exposed to structured development practices. To add insult to injury, boring example relationships like “people” and “students” and even types of fruit and their plant family relationships are used to show how objects relate to each other. I’m more in the camp believing learning “scary” new concepts should be fun, even memorable. People tend to remember good jokes, and forget dull experiences. I experimented with an approach to OOP. I used the old children’s storybook, Everybody POOPs.

We’re all human beings. All Humans eat and drink, and everybody poops. It takes a system to get to the pooping stage. We also fart. Adults fart and say excuse me!, while children fart and giggle. They’re still Human. Hopefully you can see how these related entities can be turned into computer classes.

I finally got around to recording a video of my teaching this concept, as it relates to classes in Microsoft’s C#. Student reactions are always enjoyable. Most of the time, they laugh, and have fun. I usually get compliments that it’s a lot easier to remember because it’s funny. Some people are disgusted I would talk about such a topic in class – I’m thinking those people don’t have a sense of humor. No photos are involved, so what’s the big deal?

Watch the Video

Here’s my original Blog Post about it

I was challenged last year to write a JavaScript version of Everybody Poops. I finally got around to that this year, explaining objects to students at the TeKY Initiative. That was a bit tougher, since JavaScript isn’t really object oriented. Still, it was fun. The students even got me a poop emoji mug 🙂 You can view the code here. You’ll need to use the console to play with the object.

I’m continuing to teach concepts in [what I feel are] fun, real world ways. My first step has been to create “Real World Programming” videos on YouTube. Two are complete as of this article – OOP (link above) and Inversion of Control + Dependency Injection. I hope to do a few more in 2017 as time permits. If you have a suggestion, please let me know!

I’ve been using this example for a couple years now – explaining Object Oriented Programming with a cute example based on the book Everybody Poops. It’s fun, and much less bland than the other OOP examples I’ve seen 🙂

Here’s the link: https://www.youtube.com/watch?v=_0PFHaX04mo

In case you missed the first video on Inversion of Control and Dependency Injection: https://www.youtube.com/watch?v=HcJN1XCs8t0

This is the second video in my Real World Programmer series. I hope you enjoy!

 

I was recently included on a thread with a high school student considering programming as a career. Fellow developers at Eleven Fifty were sharing their insight. I liked my pre-caffeinated contribution. I hope you enjoy as well.

Aaron,
I echo Tiffany’s sentiment. I’d be delighted to be more interactive with you on questions. Funny – I think I went to school with a Rickleff.
Anyway… I *loved* computers growing up. Still, until I was in high school, I didn’t want to be a programmer, which I later learned was really a “software engineer.” I thought they were just unhealthy, unsocial slobs that worked long, grueling hours, with pizza their only food group. Well, that was television and movies, at least. I found programming and problem solving came easily, and I liked making the computer do whatever it was I wanted, if I only spent the time. I didn’t start out with programming as a career – I started with technology, being an analyst and writer at a consumer electronics research firm. It wasn’t until my friend [and employer] challenged me to write a program for the company, and I accomplished it by putting my hobby to good use, that I started thinking programming could be a career. I learned I could make a living with my favorite hobby. That’s fun, and freeing. It’s like not working, even when it feels like work.
So what will your career look like? Software engineering makes you somewhat of a white collar worker – the pay is higher, and you’re always working with intelligent people – not that you’ll always admit that. It’s more of a “white collar t-shirt” job, because you’re required to be both a thinker and a creator at once, which can be messy. Ask yourself if you like to make things better, and if you think about how to actually do it. Even if you don’t have the skill yet – that will grow over time, and you’ll have to fail… a lot – that two-punch thinking combination is what will get things done, and make you enjoy your job. Did I mention failing? It happens all the time. You’re always building things that don’t exist, based on ideas written in a few sentences by people who don’t know how to do what you’ll be able to do. Like the beautiful buildings you see when walking, to paintings at shows, to jokes you hear for the first time – all those are the final result after all the failures to make them reality before. Building designs start with an idea out of thin air, go through a billion revisions, and finally get built. Jokes usually start from trying variations that don’t get a blink, to the final one that makes an audience laugh. But the comic started the line of thought, from thin air, from inspiration, and from thinking about how people think. The same goes with programming.
The lesson: Fail quickly, then move on to the next approach.
That being said, I’ve found the best parts of programming are the community, and what it leads to.
First, Community. Software engineering is like medicine. You’re not going to know all the practices. You’ll be good at one, or a few, but can never be good at all. Yet, you’ll meet brilliant people that can fill in the gaps in your knowledge, and you feel even better when you do the same. As engineers, we inspire other engineers. Look at Steve Wozniak, Steve Jobs, Nicholai Tesla, Sergei Brin, Larry Page – all their bios mention influencers. Nobody did it on their own. They all had help.
Second, What it Leads To. Coming up with ideas all the time has its side effects. The most prevalent? A constant stream of ideas on how to make those cool computers, whether they have a keyboard or not – phones for example – do more stuff. You’ll have ideas. Lots of them. And you have the power to make your ideas real. You’ll fail in bringing them to reality, often. Like medicine, or any career really, you’ll get better over time, tuning your craft. You’ll release your ideas, maybe as apps, maybe as web sites, maybe just making your own projects millions of people use – like Apple, Google, Microsoft, and countless others you think of having the best and brightest. Those companies are full of people who aspired, as you do, to become software engineers at some point in their lives. Those companies were also started by software and hardware engineers. Heck, Apple practically invented the personal computer, and the software engineer that wanted to program it.
Gosh, that’s a lot, and I need another refill of coffee. I hope to discuss further, if you’d like.
Thanks and Best,
-Auri
Appending what a fellow developer and instructor answered to the same student:
What your career looks like in 5 or 10 years is a very personal choice.  If you are a guy looking for a desk job with great benefits in a big company, that’s going to look very different than if you have an entrepreneurial spark that leads you to develop your own products or freelance.  I can tell you that you need to talk to all types of software professionals to get this knowledge and find out what excites you most.  The best way to do so is to attend networking events.  Verge is a fun one for entrepreneurs.  I believe Auri can refer you to a few great .NET networking groups.
After 5 years of MY career, I found myself climbing a technical corporate ladder inside of Motorola and being very content with that.  But after 10 years (still at the same company), I grew restless and started my own freelance firm on the side while also transitioning from test to architecture within the big company.  And after 15 years, I found myself appreciating the big picture of software (sales / pm / business dev) more than I did the nitty gritty code and new technologies.
As far as highs and lows in a coding career… that’s a bit more finite.  There’s a huge high when you can point at something and say, “I did that! And it’s AWESOME!”  And an ever bigger high when your peers and mentors do the same.  And for every coder, there’s a dark dark low when you run into a problem that you just CAN’T figure out.  You feel alone, you feel stupid, and you feel like a failure.  As a coder, you’re going to need to expect those situations, not fear them, just grow and learn from them.
Hope this helps.  Feel free to find me & Auri at Eleven Fifty and chat about this stuff during the time you’re here.
Thanks,
Tiffany Trusty