|By Michael Zuskin||
|November 26, 2012 07:45 AM EST||
Give all entities mentioned in the code (DB tables, DB tables' fields, variables, classes, functions, etc.) meaningful, descriptive names that make the code easily understood. The names should be so self-explanatory that it eliminates the need for comments in most cases.
Use the words per and by as often as possible - they really simplify a developer's life. A variable's name li_cows_per_farm is better than li_total_cows, and a function name uf_retrieve_city_by_country tells us more than uf_retrieve_city, especially if it doesn't have parameters that supply the "by what" information.
Don't use abstract words like "actual" and "total' in variables names as they will madden you, forcing to spend extra time trying to understand what is "actual," what is "not actual" and which grouping level is "total" for. Is li_total_cows field total per barn? per farm? per village? per province? per country? per the Universe? If, for example, per farm, then how will you name the total per village? It's also "total"! So, don't write simply "total" - write total PER WHAT! Use only exact definitions that produce no (or minimum) questions, even if that results in longer variables names.
*** BAD code: ***
ldc_total_salary = ldc_actual_salary * ldc_total_hours
*** GOOD code: ***
ldc_salary_per_day = ldc_salary_per_hour * ldc_hours_per_day
Don't produce different versions of a same entity name (like emp_id / employee_id, inv_num / invoice_num).
When you use values retrieved from database tables, try to name the corresponding variables exactly by the DB fields (of course, adding naming convention prefixes where needed). But you can use local variables' names more freely, especially when the coded logic is complicated while the tables fields are not informative enough (see the previous rule).
Long, Descriptive Names
The common, obvious practice is to give variables and functions short names. But, sometimes, there are situations when it makes sense to break that rule and use long, "real-English" names that will clearly describe what they are for.
For example, it can be done when a variable is in a rare use (like an instance var, which is referenced only a couple of times), but not a local var which is mentioned in the code many times. Anyway, don't be afraid to give long names any time you feel it will simplify working with the code. See the difference between:
is_main_filter = uf_get_main_filter()
is_filter_by_selected_row_in_summary_win = uf_get_filter_by_selected_row_in_summary_win()
As you can see, names of variables can tell the whole story. Even if it makes a line too long, there is no problem breaking it into two lines - it's better than looking at a variable and having no idea what is stored in it (or to search its declaration in hopes that a clarifying comment exists). But remember - names of that style should be an exception, not a rule.
Exact Action Timing
Names describing actions must express if the action should be done in the future or was done in the past.
Giving names to variables, don't force readers to guess an action timing. A good example of a bad variable name is lb_is_calculation. How must the condition "if lb_is_calculation then..." be understood? As you can see, there is no problem exists understanding what it means if the variable is named lb_is_calculation_done (lb_is_calculated) or in the imperative form - lb_do_calculation (or simply lb_calculate).
The common advice is to use words do..., ...to_do, perform..., execute..., ...to_apply, etc., for stuff that should take place in the future, and ...done, ...performed, ...executed, ...occurred, ...passed, ...applied, etc., for things that have taken place in the past.
Constants for [Meaningless] Application Codes
Don't hard code numbers if they are not apparent - use constants instead.
Okay, it's still possible to understand what "if li_inv_year > 2011..." or "if li_month = 4..." is but what do you want to say to a programmer who has written "if li_window_mode = 3..." or "if li_inv_status = 8..."?
Local and Instance Constants Management
Giving names to local and instance constants, divide the family prefix from the mnemonic description by two underscores.
Now let's discuss local and instance-scope constants. Their names must consist of two parts:
- Group (or "family") - like "ORDER_STATUS" or "INVOICE_STATUS". A few constants of the same family can co-exist in the scope (for example, an order can have many statuses). In fact, it's a prefix before the main descriptive part.
- Description (or mnemonic part) - like "OPEN" or "CLOSED". There can be many constants with the same description (for example, both - an order and an invoice - can have the status "OPEN").
Using two underscores (instead of one) to connect both parts will allow code readers to easily distinguish between them, especially when each part consists of a number of words. For example:
constant string ORDER_STATUS__OPEN = "OPN"
constant string ORDER_STATUS__CLOSED = "CLS"
constant string ORDER_STATUS__CANCELED = "CNCL"
constant string INV_STATUS__OPEN = "OPN"
constant string INV_STATUS__CLOSED = "CLS"
constant string INV_STATUS__CANCELED = "CNCL"
Global Constants Management
Constants, used globally (in different parts of the application), must be declared in not-autoinstantiated NVOs - one NVO per each constants group (or "family") - and accessed via the automatically created global reference variable with the same name, without declaring additional variables and creating instances.
For example, you can have an NVO named n_color for color constants, n_order_status for order statuses constants, etc. It's a good idea to keep them all in one PBL so developers can easily check if the NVO for the group they need already exists or must be created. The constants are declared in the instance variables declaration section in a very straightforward way. Here is a possible set for n_order_status:
constant string OPEN = "OPN"
constant string CLOSED = "CLS"
constant string CANCELED = "CNCL"
If you open any not-autoinstantiated class in the "View Source" mode, you can see that PowerBuilder automatically creates a global variable of that object's type with the same name as the class (PB doesn't know that we add "g" to global vars! :-D ). For example, if you create n_order_status class (not-autoinstantiated, remember?) and look at its source, you'll see the following line:
global n_order_status n_order_status
That's exactly the mentioned declaration of the global var. You don't need to declare a variable of the object each time you need to use a constant in your script - you already have a variable ready for use. That's how you mention a constant in the code:
Looking pretty similar to enum of C# but, unfortunately, it's not an enumerated type; you cannot declare a function argument of type n_order_status and pass to that function one of the statuses (which is of type string) defined in the type - you can only pass a reference to n_order_status object, which doesn't solve the problem of passing type-safe arguments. You can make the argument of type string to pass a particular status, but this approach doesn't supply type safety - nothing prevents you from passing an invoice status or even the name of your cat...
Pay attention that PowerBuilder only declares a global variable; it doesn't create an object referenced by that variable. Practically it means that we can use only constants because they belong to a type (not an instance) definition (something similar to static data in C#). If you try to access an instance variable or a function of that global var, then you will get the "Null object reference" error. As opposed to C#, which will happen even if the function doesn't access instance data, so there is nothing like C#'s "static function" behavior in PowerBuilder.
For standalone constants (not belonging to any family) create one common NVO named, let's say, n_const.
@ThingsExpo has been named the Top 5 Most Influential Internet of Things Brand by Onalytica in the ‘The Internet of Things Landscape 2015: Top 100 Individuals and Brands.' Onalytica analyzed Twitter conversations around the #IoT debate to uncover the most influential brands and individuals driving the conversation. Onalytica captured data from 56,224 users. The PageRank based methodology they use to extract influencers on a particular topic (tweets mentioning #InternetofThings or #IoT in this ...
Oct. 22, 2016 01:00 AM EDT Reads: 8,117
SYS-CON Events announced today that Super Micro Computer, Inc., a global leader in Embedded and IoT solutions, will exhibit at SYS-CON's 20th International Cloud Expo®, which will take place on June 7-9, 2017, at the Javits Center in New York City, NY. Supermicro (NASDAQ: SMCI), the leading innovator in high-performance, high-efficiency server technology, is a premier provider of advanced server Building Block Solutions® for Data Center, Cloud Computing, Enterprise IT, Hadoop/Big Data, HPC and ...
Oct. 22, 2016 12:30 AM EDT Reads: 3,482
Cloud based infrastructure deployment is becoming more and more appealing to customers, from Fortune 500 companies to SMEs due to its pay-as-you-go model. Enterprise storage vendors are able to reach out to these customers by integrating in cloud based deployments; this needs adaptability and interoperability of the products confirming to cloud standards such as OpenStack, CloudStack, or Azure. As compared to off the shelf commodity storage, enterprise storages by its reliability, high-availabil...
Oct. 22, 2016 12:15 AM EDT Reads: 949
Explosive growth in connected devices. Enormous amounts of data for collection and analysis. Critical use of data for split-second decision making and actionable information. All three are factors in making the Internet of Things a reality. Yet, any one factor would have an IT organization pondering its infrastructure strategy. How should your organization enhance its IT framework to enable an Internet of Things implementation? In his session at @ThingsExpo, James Kirkland, Red Hat's Chief Arch...
Oct. 22, 2016 12:00 AM EDT Reads: 5,926
The IoT industry is now at a crossroads, between the fast-paced innovation of technologies and the pending mass adoption by global enterprises. The complexity of combining rapidly evolving technologies and the need to establish practices for market acceleration pose a strong challenge to global enterprises as well as IoT vendors. In his session at @ThingsExpo, Clark Smith, senior product manager for Numerex, will discuss how Numerex, as an experienced, established IoT provider, has embraced a ...
Oct. 22, 2016 12:00 AM EDT Reads: 933
We are reaching the end of the beginning with WebRTC, and real systems using this technology have begun to appear. One challenge that faces every WebRTC deployment (in some form or another) is identity management. For example, if you have an existing service – possibly built on a variety of different PaaS/SaaS offerings – and you want to add real-time communications you are faced with a challenge relating to user management, authentication, authorization, and validation. Service providers will w...
Oct. 21, 2016 11:45 PM EDT Reads: 3,185
When people aren’t talking about VMs and containers, they’re talking about serverless architecture. Serverless is about no maintenance. It means you are not worried about low-level infrastructural and operational details. An event-driven serverless platform is a great use case for IoT. In his session at @ThingsExpo, Animesh Singh, an STSM and Lead for IBM Cloud Platform and Infrastructure, will detail how to build a distributed serverless, polyglot, microservices framework using open source tec...
Oct. 21, 2016 11:45 PM EDT Reads: 4,408
November 1–3, 2016, at the Santa Clara Convention Center in Santa Clara, CA. Penta Security is a leading vendor for data security solutions, including its encryption solution, D’Amo. By using FPE technology, D’Amo allows for the implementation of encryption technology to sensitive data fields without modification to schema in the database environment. With businesses having their data become increasingly more complicated in their mission-critical applications (such as ERP, CRM, HRM), continued ...
Oct. 21, 2016 11:45 PM EDT Reads: 866
SYS-CON Events announced today that Cloudbric, a leading website security provider, will exhibit at the 19th International Cloud Expo, which will take place on November 1–3, 2016, at the Santa Clara Convention Center in Santa Clara, CA. Cloudbric is an elite full service website protection solution specifically designed for IT novices, entrepreneurs, and small and medium businesses. First launched in 2015, Cloudbric is based on the enterprise level Web Application Firewall by Penta Security Sys...
Oct. 21, 2016 11:45 PM EDT Reads: 982
The Open Connectivity Foundation (OCF), sponsor of the IoTivity open source project, and AllSeen Alliance, which provides the AllJoyn® open source IoT framework, today announced that the two organizations’ boards have approved a merger under the OCF name and bylaws. This merger will advance interoperability between connected devices from both groups, enabling the full operating potential of IoT and representing a significant step towards a connected ecosystem.
Oct. 21, 2016 11:15 PM EDT Reads: 1,137
A completely new computing platform is on the horizon. They’re called Microservers by some, ARM Servers by others, and sometimes even ARM-based Servers. No matter what you call them, Microservers will have a huge impact on the data center and on server computing in general. Although few people are familiar with Microservers today, their impact will be felt very soon. This is a new category of computing platform that is available today and is predicted to have triple-digit growth rates for some ...
Oct. 21, 2016 10:00 PM EDT Reads: 33,894
You think you know what’s in your data. But do you? Most organizations are now aware of the business intelligence represented by their data. Data science stands to take this to a level you never thought of – literally. The techniques of data science, when used with the capabilities of Big Data technologies, can make connections you had not yet imagined, helping you discover new insights and ask new questions of your data. In his session at @ThingsExpo, Sarbjit Sarkaria, data science team lead ...
Oct. 21, 2016 10:00 PM EDT Reads: 4,215
SYS-CON Events announced today that Roundee / LinearHub will exhibit at the WebRTC Summit at @ThingsExpo, which will take place on November 1–3, 2016, at the Santa Clara Convention Center in Santa Clara, CA. LinearHub provides Roundee Service, a smart platform for enterprise video conferencing with enhanced features such as automatic recording and transcription service. Slack users can integrate Roundee to their team via Slack’s App Directory, and '/roundee' command lets your video conference ...
Oct. 21, 2016 09:15 PM EDT Reads: 1,982
SYS-CON Events announced today that Enzu will exhibit at the 19th International Cloud Expo, which will take place on November 1–3, 2016, at the Santa Clara Convention Center in Santa Clara, CA. Enzu’s mission is to be the leading provider of enterprise cloud solutions worldwide. Enzu enables online businesses to use its IT infrastructure to their competitive advantage. By offering a suite of proven hosting and management services, Enzu wants companies to focus on the core of their online busine...
Oct. 21, 2016 09:15 PM EDT Reads: 1,198
SYS-CON Events announced today that SoftNet Solutions will exhibit at the 19th International Cloud Expo, which will take place on November 1–3, 2016, at the Santa Clara Convention Center in Santa Clara, CA. SoftNet Solutions specializes in Enterprise Solutions for Hadoop and Big Data. It offers customers the most open, robust, and value-conscious portfolio of solutions, services, and tools for the shortest route to success with Big Data. The unique differentiator is the ability to architect and...
Oct. 21, 2016 08:15 PM EDT Reads: 351
In past @ThingsExpo presentations, Joseph di Paolantonio has explored how various Internet of Things (IoT) and data management and analytics (DMA) solution spaces will come together as sensor analytics ecosystems. This year, in his session at @ThingsExpo, Joseph di Paolantonio from DataArchon, will be adding the numerous Transportation areas, from autonomous vehicles to “Uber for containers.” While IoT data in any one area of Transportation will have a huge impact in that area, combining senso...
Oct. 21, 2016 07:15 PM EDT Reads: 266
Why do your mobile transformations need to happen today? Mobile is the strategy that enterprise transformation centers on to drive customer engagement. In his general session at @ThingsExpo, Roger Woods, Director, Mobile Product & Strategy – Adobe Marketing Cloud, covered key IoT and mobile trends that are forcing mobile transformation, key components of a solid mobile strategy and explored how brands are effectively driving mobile change throughout the enterprise.
Oct. 21, 2016 07:15 PM EDT Reads: 1,617
"Matrix is an ambitious open standard and implementation that's set up to break down the fragmentation problems that exist in IP messaging and VoIP communication," explained John Woolf, Technical Evangelist at Matrix, in this SYS-CON.tv interview at @ThingsExpo, held Nov 4–6, 2014, at the Santa Clara Convention Center in Santa Clara, CA.
Oct. 21, 2016 07:00 PM EDT Reads: 8,932
The IoT has the potential to create a renaissance of manufacturing in the US and elsewhere. In his session at 18th Cloud Expo, Florent Solt, CTO and chief architect of Netvibes, discussed how the expected exponential increase in the amount of data that will be processed, transported, stored, and accessed means there will be a huge demand for smart technologies to deliver it. Florent Solt is the CTO and chief architect of Netvibes. Prior to joining Netvibes in 2007, he co-founded Rift Technologi...
Oct. 21, 2016 06:45 PM EDT Reads: 2,815
For basic one-to-one voice or video calling solutions, WebRTC has proven to be a very powerful technology. Although WebRTC’s core functionality is to provide secure, real-time p2p media streaming, leveraging native platform features and server-side components brings up new communication capabilities for web and native mobile applications, allowing for advanced multi-user use cases such as video broadcasting, conferencing, and media recording.
Oct. 21, 2016 06:15 PM EDT Reads: 3,023