22
Wed, May
2 New Articles

Oops! Five Common Mistakes Newbie Mobile Web App Developers Make

Mobile - Other
Typography
  • Smaller Small Medium Big Bigger
  • Default Helvetica Segoe Georgia Times

 

Transform yourself, but watch out for the pitfalls.

This article is not a big pointing finger to shame you about errors you make when you start creating your first mobile apps. This article is meant as a guideline to help you avoid some pitfalls in your work.

As you might know, I am an “old” RPG programmer who has learned some PHP and JavaScript and other web techniques along the way. I do not do Java or Objective-C. I am not very good at object-oriented programming, so my profile would not get me an interview, never mind a job, at Google or Apple.

“But what can you do then?” you might ask. Well, I can read data from an IBM i (DB2), MySQL, or MS SQL database, combine the data, and by using some general tools, publish it in a web browser running on some device. My users can then use the information daily, saving them both time and money.

I have written quite a few articles in MC Press Online about jQuery, Bootstrap, and other web tools over the years, so I will use this article to sum up some of the things I have struggled with along the way.

One comment before I start: Numerous tools are out there that can help you do most of the work, so you do not have to learn all the nuts and bolts of HTML, CSS, and JavaScript. But that requires a budget, as these are not free. In my case, there was no budget, so that was not an option; I had to dig into learning something. Also, as a programmer, I wanted to learn some new tricks.

First Mistake to Avoid: HTML Is Not That Difficult to Master

Learning a new language (if you can call HTML that) can be a challenge, but you should spend some time learning HTML. The fun thing about learning it is that you can enter some code and right away you can see the result in your browser. Learn the tables (take divs later) and the ways to add pictures, links, iframes—all the basic stuff to place data on a website.

Many great sites out there offer the basic knowledge to learn HTML. One of the ones I can recommend is w3schools.com. They offer tutorials as well as quizzes to test your skills. If you want to lean back and enjoy a film, YouTube of course is the place. Do a search for “HTML basic” or “learn HTML,” and you will find a lot of nice people just sitting there waiting to teach you.

Second Mistake to Avoid: Cascading Style Sheets (CSS) Is a Must These Days

CSS is not really a language. It is more the glue that makes your HTML elements display correctly on the page or even in print. Using CSS, you can control where HTML elements can be placed and what size and color they have.

CSS should be stored in external stylesheets and can then serve as the layout master for various webpages, so you’ll be more productive and it will be easy to maintain the layout of the page.

CSS has classes, not like in an OO language, but still it is a way of adding layout properties to various HTML elements in an easy way.

Again, there are many places to learn it. And again, w3schools does a great job. Please note that I have no interest in the site for personal reasons. I just find it very easy to use, and it has a good way of explaining things. Of course, both YouTube and Google can point you to the right CSS place for you.

I repeat: In my opinion, CSS is essential if you want to create a nice-looking webpage in 2017.

Third Mistake to Avoid: JavaScript Adds Dynamic Functionality to Your Page

You must learn and understand JavaScript!

Facebook, Google, and MC Press Online (just to mention a few) would not be working if it weren’t for JavaScript.

If you want to do things like real-time field validation, setting colors, making changes to HTML elements, and making dynamic pages, JavaScript is the language to use.

JavaScript is big, and it has a pretty loose syntax, which sometimes makes it hard to read and understand.
This means that you should carefully plan a programming standard for things that you just not are used to if you are an RPG programmer.

The reason is that JavaScript is interpreted at runtime by the browser, so you do not have a compiler in front of you to catch syntax errors and such, like you have with a compiled programming language.

As an example, you do not have to end a JavaScript line with a semicolon (;). The line will be nicely understood by the browser. That might not seem like a big thing, but it sure can complicate things when it comes to readability and debugging.

One thing that you will notice very soon is that variables and function names are case-sensitive. This means that “customerName” and “CustomerName” are two different variables. In my world, there is no right or wrong on how you decide to construct your variable names. In the old days, I used to underscore (_) my variables, but these days I use camelCase. I have stolen this habit from when I am looking around the Internet for help; it seems to be what most JavaScript programmers do, and I do not want to invent the wheel myself again. JavaScript is not very strict about variables and their types, because you simply do not declare the type of a variable when you start to use it. You can assign a date in one line, a string in the next, and a numeric in the third, and you can work with the variable just fine; that is something very new for an RPG programmer, but when you get started you will soon get the hang of it.

Again, there are many pages to learn from, and again I really think that w3school does a very good job, so have a look here: JavaScript Style Guide and Coding Conventions and JavaScript Tutorial. Also, Stack Overflow is a page you will stumble across. It has answers to almost anything, and Google will help you find the correct page.

Fourth Mistake to Avoid: Your DB Skills Can Serve Data to Web Apps

You need data for your web apps. Not so long ago, the data on your IBM i was all you needed, but that sure is not the case anymore. Today, data is spread all around, in MySQL or MS SQL databases, in Excel files, in CSV files, in XML files, in JSON objects, in web services…and you need to master them all in order to provide your users with the needed information. So you need some tools in your tool belt to bring the data to the web page surface.

The way I do it is very simple. On the IBM i, I use RPG CGI. I use the web APIs provided by IBM to read data from the database and then transform it into either HTML or XML, and I let Apache do the job of sending the data to the requester and then let the web page handle the result and present the data to the user. To me, writing to a display file or to the browser is the same thing. Although the output format is different, it is the same cycle: get some input, read data, process it, and output.

When it comes to the other DB sources mentioned above, you must learn a language that can act the same way as RPG. In my case, PHP was the one. It is pretty easy to learn the basics, and there are so many examples of all you can ever think of on the Internet and even on MC Press Online. Our own David Shirey has written some great tips about the secrets of PHP.

I use PHP the same way as I use RPG: get some input, read the data, process it, and output. This way, the retrieving of data will be transparent to the web app.  “Why is that important?” you might ask. Well, that way, you can change the database layer very easily and even have the same web app running on various databases.

Fifth Mistake to Avoid: Libraries and Frameworks Are Not Bad Things

When you get the hang of JavaScript and CSS, start using frameworks and libraries.

Until now, I have just mentioned “basic” stuff that you must learn and pitfalls to avoid in order to show some data on a webpage. But when it comes to mobile devices like smartphones and tablets, things change radically.  You are now facing things like responsive design, small bandwidth signals, different web browser engines, and all kinds of display sizes.

I once tried to make my pages fit the requirements by hand-coding it, but it was such a daunting task that I never got it to work the correct way. Then I got involved in a project where somebody spoke about something called jQuery, and that became my savior when it came to creating dynamic functionality.

One of the most important things to learn when starting to use jQuery is AJAX. To me, that is the cornerstone in all web programming, and it is a must to master (in my opinion).

To handle all the responsive tasks, Bootstrap is the one for me. It takes a little effort to get the hang of, but when you learn the grid system and the main classes, you are on your way.

I have also written articles about jQuery Mobile, and I like that very much, but the thing about it is that it fits only mobile devices and does not look very good on a PC.

So, to avoid any mistakes, I have a golden rule: If your web app is to run just on a mobile device, jQuery Mobile is a great solution, but if you want to use it on both PCs and mobile devices, Bootstrap is a very good solution.

Let’s Sum It Up

I know this has been a very long article, and I really hope that you still are with me to this point. Creating web apps and trying to avoid mistakes are not as easy as it might seem.

To me, it has been a journey of transforming myself from a green-screen programmer who (still) loves DDS and RPG and the way the IBM i just helps you do things in an easy and structured way to a web/mobile programmer in a world of various databases, web technologies, new ways of designing screens, and security issues you never have to deal with in a IBM i world.

It might sound like a lot of work, and sure it is, but I tell you it is all worth it. And the first time you enter a URL that fetches data from various platforms and you see the result on your smartphone, your heart will make an extra beat.

Jan Jorgensen

Jan Jorgensen is one of the owners of www.reeft.dk, which specializes in mobile and i5 solutions. He works with RPG, HTML, JavaScript, Perl, and PHP. You can reach him at This email address is being protected from spambots. You need JavaScript enabled to view it.

 

BLOG COMMENTS POWERED BY DISQUS

LATEST COMMENTS

Support MC Press Online

$0.00 Raised:
$

Book Reviews

Resource Center

  • SB Profound WC 5536 Have you been wondering about Node.js? Our free Node.js Webinar Series takes you from total beginner to creating a fully-functional IBM i Node.js business application. You can find Part 1 here. In Part 2 of our free Node.js Webinar Series, Brian May teaches you the different tooling options available for writing code, debugging, and using Git for version control. Brian will briefly discuss the different tools available, and demonstrate his preferred setup for Node development on IBM i or any platform. Attend this webinar to learn:

  • SB Profound WP 5539More than ever, there is a demand for IT to deliver innovation. Your IBM i has been an essential part of your business operations for years. However, your organization may struggle to maintain the current system and implement new projects. The thousands of customers we've worked with and surveyed state that expectations regarding the digital footprint and vision of the company are not aligned with the current IT environment.

  • SB HelpSystems ROBOT Generic IBM announced the E1080 servers using the latest Power10 processor in September 2021. The most powerful processor from IBM to date, Power10 is designed to handle the demands of doing business in today’s high-tech atmosphere, including running cloud applications, supporting big data, and managing AI workloads. But what does Power10 mean for your data center? In this recorded webinar, IBMers Dan Sundt and Dylan Boday join IBM Power Champion Tom Huntington for a discussion on why Power10 technology is the right strategic investment if you run IBM i, AIX, or Linux. In this action-packed hour, Tom will share trends from the IBM i and AIX user communities while Dan and Dylan dive into the tech specs for key hardware, including:

  • Magic MarkTRY the one package that solves all your document design and printing challenges on all your platforms. Produce bar code labels, electronic forms, ad hoc reports, and RFID tags – without programming! MarkMagic is the only document design and print solution that combines report writing, WYSIWYG label and forms design, and conditional printing in one integrated product. Make sure your data survives when catastrophe hits. Request your trial now!  Request Now.

  • SB HelpSystems ROBOT GenericForms of ransomware has been around for over 30 years, and with more and more organizations suffering attacks each year, it continues to endure. What has made ransomware such a durable threat and what is the best way to combat it? In order to prevent ransomware, organizations must first understand how it works.

  • SB HelpSystems ROBOT GenericIT security is a top priority for businesses around the world, but most IBM i pros don’t know where to begin—and most cybersecurity experts don’t know IBM i. In this session, Robin Tatam explores the business impact of lax IBM i security, the top vulnerabilities putting IBM i at risk, and the steps you can take to protect your organization. If you’re looking to avoid unexpected downtime or corrupted data, you don’t want to miss this session.

  • SB HelpSystems ROBOT GenericCan you trust all of your users all of the time? A typical end user receives 16 malicious emails each month, but only 17 percent of these phishing campaigns are reported to IT. Once an attack is underway, most organizations won’t discover the breach until six months later. A staggering amount of damage can occur in that time. Despite these risks, 93 percent of organizations are leaving their IBM i systems vulnerable to cybercrime. In this on-demand webinar, IBM i security experts Robin Tatam and Sandi Moore will reveal:

  • FORTRA Disaster protection is vital to every business. Yet, it often consists of patched together procedures that are prone to error. From automatic backups to data encryption to media management, Robot automates the routine (yet often complex) tasks of iSeries backup and recovery, saving you time and money and making the process safer and more reliable. Automate your backups with the Robot Backup and Recovery Solution. Key features include:

  • FORTRAManaging messages on your IBM i can be more than a full-time job if you have to do it manually. Messages need a response and resources must be monitored—often over multiple systems and across platforms. How can you be sure you won’t miss important system events? Automate your message center with the Robot Message Management Solution. Key features include:

  • FORTRAThe thought of printing, distributing, and storing iSeries reports manually may reduce you to tears. Paper and labor costs associated with report generation can spiral out of control. Mountains of paper threaten to swamp your files. Robot automates report bursting, distribution, bundling, and archiving, and offers secure, selective online report viewing. Manage your reports with the Robot Report Management Solution. Key features include:

  • FORTRAFor over 30 years, Robot has been a leader in systems management for IBM i. With batch job creation and scheduling at its core, the Robot Job Scheduling Solution reduces the opportunity for human error and helps you maintain service levels, automating even the biggest, most complex runbooks. Manage your job schedule with the Robot Job Scheduling Solution. Key features include:

  • LANSA Business users want new applications now. Market and regulatory pressures require faster application updates and delivery into production. Your IBM i developers may be approaching retirement, and you see no sure way to fill their positions with experienced developers. In addition, you may be caught between maintaining your existing applications and the uncertainty of moving to something new.

  • LANSAWhen it comes to creating your business applications, there are hundreds of coding platforms and programming languages to choose from. These options range from very complex traditional programming languages to Low-Code platforms where sometimes no traditional coding experience is needed. Download our whitepaper, The Power of Writing Code in a Low-Code Solution, and:

  • LANSASupply Chain is becoming increasingly complex and unpredictable. From raw materials for manufacturing to food supply chains, the journey from source to production to delivery to consumers is marred with inefficiencies, manual processes, shortages, recalls, counterfeits, and scandals. In this webinar, we discuss how:

  • The MC Resource Centers bring you the widest selection of white papers, trial software, and on-demand webcasts for you to choose from. >> Review the list of White Papers, Trial Software or On-Demand Webcast at the MC Press Resource Center. >> Add the items to yru Cart and complet he checkout process and submit

  • Profound Logic Have you been wondering about Node.js? Our free Node.js Webinar Series takes you from total beginner to creating a fully-functional IBM i Node.js business application.

  • SB Profound WC 5536Join us for this hour-long webcast that will explore:

  • Fortra IT managers hoping to find new IBM i talent are discovering that the pool of experienced RPG programmers and operators or administrators with intimate knowledge of the operating system and the applications that run on it is small. This begs the question: How will you manage the platform that supports such a big part of your business? This guide offers strategies and software suggestions to help you plan IT staffing and resources and smooth the transition after your AS/400 talent retires. Read on to learn: