<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Iyvonne Bett</title>
    <description>The latest articles on DEV Community by Iyvonne Bett (@iyvonnebett).</description>
    <link>https://dev.to/iyvonnebett</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F469978%2Fe0ed2811-5369-469a-bda8-275fff09b854.jpg</url>
      <title>DEV Community: Iyvonne Bett</title>
      <link>https://dev.to/iyvonnebett</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/iyvonnebett"/>
    <language>en</language>
    <item>
      <title>Use OAuth 2.0 and Open ID Connect in a Custom Application</title>
      <dc:creator>Iyvonne Bett</dc:creator>
      <pubDate>Fri, 17 Mar 2023 08:38:27 +0000</pubDate>
      <link>https://dev.to/iyvonnebett/use-oauth-20-and-open-id-connect-in-a-custom-application-1l8l</link>
      <guid>https://dev.to/iyvonnebett/use-oauth-20-and-open-id-connect-in-a-custom-application-1l8l</guid>
      <description>&lt;p&gt;In this post, we'll explore secure authentication and authorization for custom applications by configuring Federated Single Sign-On (Federated SSO) between Oracle Identity Cloud Service and your app with OAuth 2.0 and OpenID Connect. We'll cover industry-standard protocols, provide step-by-step instructions, and highlight improvements to the &lt;a href="https://www.oracle.com/webfolder/technetwork/tutorials/obe/cloud/idcs/idcs_clientapp_obe/clientapp.html" rel="noopener noreferrer"&gt;original tutorial&lt;/a&gt;. Whether you're an experienced developer or just starting, this post is your guide to enhanced app security and a seamless user experience. Let's begin the journey together.&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;Background&lt;/strong&gt;&lt;br&gt;
Oracle Identity Cloud Service supports the following frameworks for federated SSO and authorization integration with custom applications:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;OAuth 2.0:&lt;/strong&gt; Framework for authorization, commonly used for third-party authorization requests with consent. See OAuth for more information.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;OpenID Connect:&lt;/strong&gt; Authentication protocol that provides Federated SSO leveraging the OAuth 2.0 authorization framework. See OpenID Connect for more information.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These standards provide the following benefits:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Federated SSO between custom applications and Oracle Identity Cloud Service. Resource owners (users accessing the Customer Quotes application) need a single login to access Oracle Identity Cloud Service plus all applications integrated. Oracle Identity Cloud Service handles the authentication and credentials themselves, insulating custom applications.
This capability is provided by OpenID Connect with OAuth 2.0.&lt;/li&gt;
&lt;li&gt;Authorization to perform operations on third-party servers with consent. Resource owners can decide at runtime whether the application should have the authorization to access data or perform tasks for them.
This capability is provided by OAuth 2.0.&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;&lt;strong&gt;Scope&lt;/strong&gt;&lt;br&gt;
In this tutorial, you implement Federated SSO between Oracle Identity Cloud Service and Customer Quotes, a sample client application that serves as a hub for sales quotations. The authentication has the following flow:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fl1cvgt2jc0fez2oblut6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fl1cvgt2jc0fez2oblut6.png" alt="OpenID Connect Authentication flow"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The Customer Quotes application, after integration:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Requires just one login from the resource owner to access both Oracle Identity Cloud Service and the custom application.&lt;/li&gt;
&lt;li&gt;Displays information about the resource owner (name and email), provided by Oracle Identity Cloud Service. (Customer Quotes does not store that information).&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;&lt;strong&gt;What Do You Need?&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Experience developing in Java.&lt;/li&gt;
&lt;li&gt;Access to Oracle Identity Cloud Service with authorisation to manage applications. (Identity Domain Administrator, Security Administrator, or Application Administrator).&lt;/li&gt;
&lt;li&gt;Netbeans IDE 16 (bundle All or Java EE).&lt;/li&gt;
&lt;li&gt;An Oracle IDCS account with an OAuth 2.0 client configured for your custom application.&lt;/li&gt;
&lt;li&gt;Access to the custom application's codebase and the ability to modify it.&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

C:\Users\Iyvonne&amp;gt;git clone https://github.com/oracle-samples/idm-samples.git


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;ul&gt;
&lt;li&gt;The IDCS OAuth 2.0 client ID and client secret, are used to authenticate the custom application with IDCS.&lt;/li&gt;
&lt;li&gt;The IDCS authorization server URL is used to initiate the OAuth 2.0 authorization flow.&lt;/li&gt;
&lt;li&gt;The IDCS token URL is used to exchange an authorization code for an access token.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Import the Oracle Identity Cloud Service Certificate in Glassfish
&lt;/h2&gt;

&lt;p&gt;In this section, you export the SSL certificate from the Oracle Identity Cloud Service UI and import it into NetBeans Glassfish Server trust store. This step is required for the custom application to communicate with Oracle Identity Cloud Service via HTTPS.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Export Certificate from Oracle Identity Cloud Service&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Launch your browser. (in this tutorial, we are using Google Chrome on Windows)&lt;/li&gt;
&lt;li&gt;Access the Oracle Identity Cloud Service UI.&lt;/li&gt;
&lt;li&gt;In the browser address bar, click view website information (locker icon), and then click Details.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6drun5eq3y1qmpnqcanp.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6drun5eq3y1qmpnqcanp.png" alt="Website Information"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Click View Certificate.&lt;/li&gt;
&lt;li&gt;Click Details then click Copy to File.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjtcvzeccc2rwrxoinrkg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjtcvzeccc2rwrxoinrkg.png" alt="Certificate"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Click Next, select Base-64 encoded X.509 (.CER), and then click Next.&lt;/li&gt;
&lt;li&gt;Save the certificate as oracle.cer in a temporary folder such as C:\temp, click Next and then Finish.&lt;/li&gt;
&lt;li&gt;Click OK, close the certification pop-up and your browser.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Import Oracle Identity Cloud Service Certificate in Glassfish&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Launch NetBeans.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5m4klu2lvjcx1b96as9p.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5m4klu2lvjcx1b96as9p.png" alt="NetBeans"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Click Services, expand Servers, right-click Glassfish Server, and then click Properties.&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbpmmtxft91rns7m8zeol.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbpmmtxft91rns7m8zeol.png" alt="click Properties"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Record the Glassfish domains folder.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjvbxo9tj3rhne96o43n3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjvbxo9tj3rhne96o43n3.png" alt="domains folder"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Close NetBeans.&lt;/li&gt;
&lt;li&gt;Launch a command prompt as administrator.&lt;/li&gt;
&lt;li&gt;Enter where keytool to confirm that the key tool utility is available from your OS classpath.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Feztc2u0hj47fgg27cihp.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Feztc2u0hj47fgg27cihp.png" alt="Command Prompt"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Navigate to NetBeans Glassfish domain folder and run the keytool command.
&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F84shzl874fgg7gxc6qrl.png" alt="Command Prompt"&gt;
&lt;/li&gt;
&lt;li&gt;In the confirmation prompt, enter yes.
&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9mngok0xxmz5dus63nq6.png" alt="Command Prompt"&gt;
&lt;/li&gt;
&lt;li&gt;To confirm the import was a success, enter the command:
&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzgl43krt057h4531747f.png" alt="Command Prompt"&gt;
&lt;/li&gt;
&lt;li&gt;Close the command prompt.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Configuring a Client Application in Oracle Identity Cloud Service
&lt;/h2&gt;

&lt;p&gt;In this task, you configure and activate the Customer Quotes application in Oracle Identity Cloud Service.&lt;br&gt;
During configuration, you define how Oracle Identity Cloud Service integrates with your application.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;In the Identity Cloud Service console, expand the Navigation Drawer, click Applications, and then click Add.
&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fy2srbgjq9wa2kujar3ne.png" alt="Applications"&gt;
&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fr1xbusj1g9wgk0m0vwhr.png" alt="Applications"&gt;
&lt;/li&gt;
&lt;li&gt;Select Confidential Application.
&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkuwwt0g5nh1z4wtpcsas.png" alt="Dialog box"&gt;
&lt;/li&gt;
&lt;li&gt;Enter Customer Quotes as the Name, a Web application that works as a hub for all of your quotations. Access quotes and insights from customers from your browser as the Description, and then click Next.
&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzx7o7egec64f0m8cc20v.png" alt="Customer Quotes"&gt;
&lt;/li&gt;
&lt;li&gt;Select Configure this application as a client now.
&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdpziqzn4uia3pzgc6fdw.png" alt="Customer Quotes"&gt;
&lt;/li&gt;
&lt;li&gt;Click Configure this application as a client now, select Authorization Code as Allowed Grant Types, and enter the information according to the table, and then click Next.
&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fyk920kqyitdv22o33tux.png" alt="Customer Quotes"&gt;
&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F76o21ganeqddfebj2i20.png" alt="Customer Quotes"&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Attribute&lt;/th&gt;
&lt;th&gt;Value&lt;/th&gt;
&lt;th&gt;Description&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Redirect URL&lt;/td&gt;
&lt;td&gt;&lt;code&gt;http://localhost:38187/cquotes/return&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;URL where users will be redirected to cquotes after authentication/authorization in Oracle Identity Cloud Service&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Logout URL&lt;/td&gt;
&lt;td&gt;&lt;code&gt;http://localhost:38187/cquotes/logout&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;URL that should be called by Oracle Identity Cloud Service during the logout process. When this URL is called, the resource owner session is terminated in Customer Quotes.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Post Logout Redirect URL&lt;/td&gt;
&lt;td&gt;&lt;code&gt;http://localhost:38187/cquotes&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;URL where the resource owner should be redirected after the Oracle Identity Cloud Service logout.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;ul&gt;
&lt;li&gt;Click Next in the following panes until you reach the last pane. Then click Finish.&lt;/li&gt;
&lt;li&gt;Save the Client ID and the Client Secret, and then click Close.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Flj9gieecxghlys16mpn1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Flj9gieecxghlys16mpn1.png" alt="Keys"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Click Activate, and then click Activate Application. Oracle Identity Cloud Service displays a confirmation message.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8gpcd5oqke2tmo68e2dd.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8gpcd5oqke2tmo68e2dd.png" alt="Activate"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;At this point, you have an application entry with a client ID and a client secret for integrating your application with Oracle Identity Cloud Service. In the next steps, you integrate your application with Oracle Identity Cloud Service.&lt;/p&gt;




&lt;h2&gt;
  
  
  Integrating Customer quotes with IDCS
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Return to Netbeans and open the file cquotes &amp;gt; Source Packages &amp;gt; com.example.utils &amp;gt; ClientConfig.java.
Tip: The ClientConfig.java file contains settings that the Customer Quotes application uses during runtime to connect to Oracle Identity Cloud Service.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F69f79qvkioeqhtd3kgh1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F69f79qvkioeqhtd3kgh1.png" alt="Select ClientConfig.java"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Update the CLIENT_ID, CLIENT_SECRET, and IDCS_URL as follows:&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbilqu84e1rhgr82anbji.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbilqu84e1rhgr82anbji.png" alt="Update credentials"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Save the ClientConfig.java file.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Testing the Integration
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Return to your browser and make sure that you are not logged in to Oracle Identity Cloud Service.&lt;/li&gt;
&lt;li&gt;In NetBeans, right-click cquotes, and then click Run. Your web browser displays the Customer Quotes application.
&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fntgqv5u6rdnu0nump21b.png" alt="Run Glassfish"&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Access &lt;code&gt;https://localhost:38187/cquotes/&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fc8u0fbtfgtk106oizz84.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fc8u0fbtfgtk106oizz84.png" alt="Copy link, make sure port is correct"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Click Login with Identity Cloud Service.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fo5cuf8hprsa891hr3bcy.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fo5cuf8hprsa891hr3bcy.png" alt="Launch"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Authenticate with your credentials.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frjww7bnim1qwgu1sia5k.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frjww7bnim1qwgu1sia5k.png" alt="Login"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;After successful authentication, Oracle Identity Cloud Service redirects you back to the Customer Quotes application, which displays a welcome message.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Feqlx0o5msassjsm72hmm.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Feqlx0o5msassjsm72hmm.png" alt="Homepage"&gt;&lt;/a&gt;&lt;br&gt;
This indicates that the Federated SSO between Oracle Identity Cloud service and your application works.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;In the upper-right corner, expand the menu and click &lt;strong&gt;My Profile&lt;/strong&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ff3bpgjf5wydjxzl6wjai.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ff3bpgjf5wydjxzl6wjai.png" alt="Click My profile"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Return to the Customer Quotes window, expand the upper-right corner menu and then click Logout. You should be redirected to the Oracle Technology Network website.&lt;/li&gt;
&lt;li&gt;Access &lt;code&gt;https://localhost:38187/cquotes/&lt;/code&gt;, and then Oracle Identity Cloud Service. You should not be recognized as a logged-in user in both places. This indicates that the logout worked.&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;&lt;strong&gt;Modifications Required&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;One important change you need to make is in the Servlet files.&lt;/li&gt;
&lt;li&gt;For instance, in the ReturnServlet.java file replace Javax.
&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frxid1j19tkkzjiter1df.png" alt="Replace"&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;With Jakarta.&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1f7gnxikq4888hbw9ecc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1f7gnxikq4888hbw9ecc.png" alt="Replace"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Do the same with all the Servlet files, for example, the AccessResourceServlet.java file.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fs6h62wcccbvsnrouuxct.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fs6h62wcccbvsnrouuxct.png" alt="Replace"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1hkmfvmvmm1mzezhbzmn.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1hkmfvmvmm1mzezhbzmn.png" alt="Replace"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;In the Pom.xml file under dependencies add the below snippet.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frpnf0m0kn1g1zq5zkvyp.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frpnf0m0kn1g1zq5zkvyp.png" alt="Add this dependency"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;In the same file under plugins, add the following snippet.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ff3n383g62r9u2b3xb3gi.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ff3n383g62r9u2b3xb3gi.png" alt="Plugin"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;It is important to note that you must have Java JDK 8 installed and available via your Operating System. Under properties make sure the Java platform used to compile the project is JDK 8.&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>oauth</category>
      <category>idcs</category>
      <category>security</category>
      <category>oraclecloud</category>
    </item>
    <item>
      <title>Using the Oracle Identity Cloud Service REST APIs with Postman</title>
      <dc:creator>Iyvonne Bett</dc:creator>
      <pubDate>Thu, 16 Mar 2023 10:46:16 +0000</pubDate>
      <link>https://dev.to/iyvonnebett/using-the-oracle-identity-cloud-service-rest-apis-with-postman-10gn</link>
      <guid>https://dev.to/iyvonnebett/using-the-oracle-identity-cloud-service-rest-apis-with-postman-10gn</guid>
      <description>&lt;p&gt;This tutorial incorporates the latest improvements to Postman and builds upon the fundamental principles detailed in the blog &lt;a href="https://www.oracle.com/webfolder/technetwork/tutorials/obe/cloud/idcs/idcs_rest_postman_obe/rest_postman.html" rel="noopener noreferrer"&gt;Using the Oracle Identity Cloud Service REST APIs with Postman&lt;/a&gt;.&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;Background&lt;/strong&gt;&lt;br&gt;
The Oracle Identity Cloud Service REST APIs provide a way to integrate Oracle Identity Cloud Service with REST clients so that they can;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Manage users and groups,&lt;/li&gt;
&lt;li&gt;Manage application and resource access,&lt;/li&gt;
&lt;li&gt;Perform federated single sign-on (SSO) and authorization in the cloud,&lt;/li&gt;
&lt;li&gt;Managing multi-factor authentication (MFA),&lt;/li&gt;
&lt;li&gt;Managing identity federation and integration with other identity systems.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The APIs support OAuth 2.0, OpenID Connect, and System for Cross-Domain Identity Management.&lt;/p&gt;

&lt;p&gt;Postman is a tool used to test and develop APIs. It provides a graphical user interface (GUI) that makes it easy to construct and send HTTP requests, as well as view the responses returned by the API.&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;What Do You Need?&lt;/strong&gt;&lt;br&gt;
To use Oracle Identity Cloud Service REST APIs with Postman, you will need the following:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;An Oracle Identity Cloud Service tenancy:&lt;/strong&gt; You will need access to IDCS in order to use the REST APIs. You can sign up for a free trial at 
```
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://cloud.oracle.com/tryit" rel="noopener noreferrer"&gt;https://cloud.oracle.com/tryit&lt;/a&gt;&lt;/p&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;- **A Postman account:** You can create a Postman account for free at 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://www.postman.com/" rel="noopener noreferrer"&gt;https://www.postman.com/&lt;/a&gt;&lt;/p&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;- Access to Oracle Identity Cloud Service with the Identity Domain Administrator or Application Administrator roles.
- Familiarity with the REST architecture style.
- **API keys:** You will need to obtain API keys in order to authenticate your API requests.
- **Oracle Identity Cloud Service API documentation:** You will need to refer to this in order to learn about the available APIs and how to use them. The documentation is available at 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://docs.oracle.com/en/cloud/paas/identity-cloud/index.html" rel="noopener noreferrer"&gt;https://docs.oracle.com/en/cloud/paas/identity-cloud/index.html&lt;/a&gt;&lt;/p&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;- **Postman client:** You will need to install the Postman client on your computer in order to make API requests. You can download the Postman client for free at 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://www.postman.com/" rel="noopener noreferrer"&gt;https://www.postman.com/&lt;/a&gt;&lt;/p&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
---

## Step 1: Register a Client Application

In this section, you register an application in Oracle Identity Cloud Service. This task is required to obtain the credentials (Client ID and Client Secret) used for authentication in REST API calls. The credentials are equivalent to service credentials (ID and password) that your client uses to communicate with Oracle Identity Cloud Service. This task also helps you determine which requests are authorized through the REST API.

1. In the Oracle Identity Cloud Service administration console, expand the Navigation Drawer, click Applications, and then click Add application.
![Navigation Drawer](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/85dhfu2e9b71bt3poq3f.png)
![Add application](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/57suqr704tpb20oqcuz1.png)
2. In the Add Application dialogue box, select Trusted Application or Confidential Application. Click launch workflow.
![Dialogue Box](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/o2y3rv769ykyoyv3s2kb.png)
3. In the App Details section on the Add Trusted Application page, enter an application name and description, and then click Next.
![Enter App details](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lqtg8uxy931goaasq9b7.png)
4. Select Configure this application as a client now, and then, in the Authorization section that appears, select only Client Credentials as the Allowed Grant Type.
![Configure Application](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bt1eff2ndqy2r2lttrmp.png)
5. Scroll down, and click the Add button below Grant the client access to Identity Cloud Service Admin APIs.
![Configure Application](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/st247lhamof2rdq8qkgd.png)
6. In the Add App Role dialogue window, select Identity Domain administrator in the list and click Add.
![dialogue window](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mu3x5ycwbloddykzw882.png)
7. Click Next in the Client pane and in the following panes until you reach the last pane. Then click Finish.
8. In the Application Added dialogue box, copy the Client ID and the Client Secret to a text file, and then click Close.
![Copy Client ID and Secret](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/sktl56e8z7jmswi78psr.png)
9. Click Activate, and then click Activate Application.
![Activate](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/sf8070yc5z8zbkdkiggk.png)

---

## Step 2: Set the Environment Parameters in Postman

1. Open Postman, and click Import.
![Open File](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kjr3egxvw1jbca9uzfp7.png)
2. In the Import dialogue box, select Import From Link, paste the following GitHub environment variables URL into the box and then click Import: `https://github.com/oracle/idm-samples/raw/master/idcs-rest-clients/example_environment.json`
![Import](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/sg7b7y3n4rn9racltzzx.png)
3. Click the Environment option, and then select Manage Environments.
4. In the Manage Environments dialogue box, to the right of the example.identity.oraclecorp.com environment, click Duplicate Environment.
![Duplicate Environment](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/acb5g9ccyzx17pcsdesc.png)
5. Click the example.identity.oraclecorp.com copy, which appears below the original environment.
6. To update the environment variables, enter the following values, and then click Update.

- _**NAME:**_ Environment A for REST API Testing
- _**HOST:**_ Oracle Identity Cloud Service UI address; for example, `https://example.identity.oraclecorp.com`
- _**CLIENT_ID**_ and _**CLIENT_SECRET**_: The Client ID and the Client Secret that you copied into a text file from your Oracle Identity Cloud Service trusted application
- _**USER_LOGIN**_ and _**USER_PW**_: Your user login and password
![Enter variables](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wz5y99hmawu4txkzxwxz.png)
7. Click the Environment drop-down list, and then select the updated environment from the list.
![select the updated environment](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8uxt26cd6h1ipodp3e5u.png)

---

## Step 3: Import the Postman Collection and Global Variables

1. To import the Oracle Identity Cloud Service REST API Postman collection, on the Postman main page, click Import.
2. In the Import dialogue box, select Import From Link, paste the following GitHub Postman collection URL into the box, and then click Import:`https://github.com/oracle/idm-samples/raw/master/idcs-rest-clients/REST_API_for_Oracle_Identity_Cloud_Service.postman_collection.json`
![click Import](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8td2h1rpy40aepqttkqk.png)
3. To import the global variables file, click Import.
4. In the Import dialogue box, select Import From Link, paste the following GitHub Postman Globals URL into the box, and then click Import:`https://github.com/oracle/idm-samples/raw/master/idcs-rest-clients/oracle_identity_cloud_service_postman_globals.json`
![click Import from link](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/slofpk9sbapbvnayaflp.png)
5. To view the imported variables, click the Environment options, and then select Manage Environments from the drop-down list.
6. In the Manage Environments dialogue box, click Globals.

---


## Step 4: Request an Access Token
To make API calls to Oracle Identity Cloud Service, you must authenticate your client against Oracle Identity Cloud Service, and then obtain an OAuth access token.

The access token provides a session between a client (in this tutorial, Postman) and Oracle Identity Cloud Service. By default, the access token has a timeout interval of 60 minutes, and then you must request a new access token to perform additional REST API calls.

1. On the Collections tab, expand OAuth, and then OAuth Tokens - Get (Authorize).
2. Select Obtain access_token (client credentials), and then click Send. The access token is returned in the response from Oracle Identity Cloud Service.
3. Highlight the access token content between the quotation marks, and then right-click. In the shortcut menu, select Set: example.identity.oraclecloud.com. In the secondary menu, select access token. The highlighted content is assigned as the access token value.
![copy access token then paste under access token variable](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8ghdpn3isbh4yrrp9kcm.png)
Subsequent REST API calls to Oracle Identity Cloud Service contain the access token as well as additional information about the request. The additional information is sent through a request Universal Resource Identifier, a header, parameters, or JSON code, and varies according to the REST API call and method that you request.

---

## Step 5: Create a User

1. On the Collections tab, expand Users, and then Create.
2. Select Create a user. The requested information appears.
3. Click Body, and then click Send.
![click Send](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/i62y3pve4wuzmemqrzs8.png)
4. In the response, confirm that the status 201 Created appears and that the response body displays details about the user that was successfully created in Oracle Identity Cloud Service.
![Confirm its created](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jk21zjzmzs8c2ac33a1w.png)

---

## Step 6: Test Other User API Calls
To test other user calls, you can set the user as a variable for reference.

1. In the response body, select and right-click the id. In the shortcut menu, select Set: Globals, and then select userid. The unique id is assigned as the userid value.
![Set: Globals](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rqfu7ypmvb0p3qa7gkhz.png)
2. On the Collections tab, expand Users, and then Search.
3. Select Search specific user, and click Send.
![verify it displays status 200 Ok ](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mdsr304u4sr1t79ybmbp.png)
4. Scroll down and verify that the response body displays the status 200 Ok and details about the user.








&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

</description>
      <category>oraclecloud</category>
      <category>idcs</category>
      <category>api</category>
      <category>postman</category>
    </item>
    <item>
      <title>Code Complete 2: Table Driven Methods (Part 4)</title>
      <dc:creator>Iyvonne Bett</dc:creator>
      <pubDate>Wed, 23 Sep 2020 20:33:49 +0000</pubDate>
      <link>https://dev.to/iyvonnebett/code-complete-2-table-driven-methods-part-4-3od9</link>
      <guid>https://dev.to/iyvonnebett/code-complete-2-table-driven-methods-part-4-3od9</guid>
      <description>&lt;p&gt;A table-driven method is a scheme that allows you to look up information in a table rather than using logic statements (if and case) to figure it out. &lt;br&gt;
Virtually anything you can select with logic statements, you can select with tables instead. In simple cases, logic statements are easier and more direct. As the logic chain becomes more complex, tables become increasingly attractive.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F744byqn7cjpw5h3f97m4.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F744byqn7cjpw5h3f97m4.jpg" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Chapter 18: Table-Driven Methods&lt;/strong&gt;
&lt;/h2&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;General Considerations in Using Table-Driven Methods&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;With a table-driven method, you must address how to look up entries, and what data should be stored in the table.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Direct Access Tables&lt;/strong&gt;&lt;br&gt;
A table-driven approach generates less code and is easier to change without the need to recompile.&lt;br&gt;
Put a lookup key transformation in its own method to guard against different transformations in different places.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Stair-Step Access Tables&lt;/strong&gt;&lt;br&gt;
This puts the upper end of consecutive ranges into a table and works well with a binary search for larger lists.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Indexed Access Tables&lt;/strong&gt;&lt;br&gt;
Indexed access schemes offer two main advantages. First, if each of the entries in the main lookup table is large, it takes a lot less space to create an index array with a lot of wasted space than it does to create a main lookup table with a lot of wasted space.&lt;br&gt;
The second advantage, even if you don’t save space by using an index, is that it’s sometimes cheaper to manipulate entries in an index than entries in a main table.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Key Points in this Chapter&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Tables provide an alternative to complicated logic and inheritance structures. If you find that you’re confused by a program’s logic or inheritance tree, ask yourself whether you could simplify by using a lookup table.&lt;/li&gt;
&lt;li&gt;One key consideration in using a table is deciding how to access the table. You can access tables by using direct access, indexed access, or stair-step access.&lt;/li&gt;
&lt;li&gt;Another key consideration in using a table is deciding what exactly to put into the table.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Chapter 19: General Control Issues&lt;/strong&gt;
&lt;/h2&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Boolean Expressions&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Even if a complicated conditional expression is only used once, moving it into its own method is useful for improving readability.&lt;br&gt;
Organize numeric tests so that they follow points on a number line.&lt;br&gt;
Comparing a character against \0 instead of 0 reinforces that the expression works with character data instead of logical data.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Null Statements&lt;/strong&gt;&lt;br&gt;
Null statements are uncommon, so make them obvious, such as a comment inside the braces explaining why one is used.&lt;br&gt;
&lt;strong&gt;Taming Dangerously Deep Nesting&lt;/strong&gt;&lt;br&gt;
Use a break block, try to flatten, move some of the nested blocks into their own methods, or use polymorphism.&lt;br&gt;
Complicated code is a sign that you don't understand your program well enough to make it simple.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;A Programming Foundation: Structured Programming&lt;/strong&gt;&lt;br&gt;
The core of structured programming is a simple idea that a program should use single-entry, single-exit control constructs.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Key Points in this Chapter&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Making boolean expressions simple and readable contributes substantially to the quality of your code.&lt;/li&gt;
&lt;li&gt;Deep nesting makes a routine hard to understand. Fortunately, you can avoid it relatively easily.&lt;/li&gt;
&lt;li&gt;Structured programming is a simple idea that is still relevant: you can build any program out of a combination of sequences, selections, and iterations.&lt;/li&gt;
&lt;li&gt;Minimizing complexity is a key to writing high-quality code.&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>codenewbie</category>
      <category>computerscience</category>
      <category>codequality</category>
    </item>
    <item>
      <title>Code Complete 2: Loops (Part 4)</title>
      <dc:creator>Iyvonne Bett</dc:creator>
      <pubDate>Wed, 23 Sep 2020 17:22:26 +0000</pubDate>
      <link>https://dev.to/iyvonnebett/code-complete-2-loops-part-4-453e</link>
      <guid>https://dev.to/iyvonnebett/code-complete-2-loops-part-4-453e</guid>
      <description>&lt;p&gt;Loop is an informal term that refers to any kind of iterative control structure—any structure that causes a program to repeatedly execute a block of code. &lt;/p&gt;

&lt;p&gt;Common loop types are for, while, and do-while in C++ and Java, and For-Next, While-Wend, and Do-Loop-While in Microsoft Visual Basic. Go has only one looping construct, the for loop. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fp3yqw1sa2ox9nt6l5a84.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fp3yqw1sa2ox9nt6l5a84.jpg" alt="Alt Text" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Chapter 16: Controlling Loops&lt;/strong&gt;
&lt;/h2&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;Selecting the Kind of Loop&lt;/strong&gt;
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;If you don't know ahead of time exactly how many times you’ll want the loop to iterate, use a while loop.
&lt;/li&gt;
&lt;li&gt;Don't code a "loop and a half"; instead, loop forever and break in the middle.
&lt;/li&gt;
&lt;li&gt;Keep for loops simple; if you're explicitly changing the index value, consider a while loop.

**Controlling the Loop**
&lt;ul&gt;
&lt;li&gt;Put initialization code immediately before the loop.&lt;/li&gt;
&lt;li&gt;Use for (;;) or while (true) to write an infinite loop; don't fake it by iterating to a large number.&lt;/li&gt;
&lt;li&gt;Reserve the for loop header for initializing the loop, terminating it, and moving toward termination.&lt;/li&gt;
&lt;li&gt;Keep statements that control the loop, or move it toward termination, near its beginning or end.&lt;/li&gt;
&lt;li&gt;Don't change the index of a for loop to make it terminate.
Avoid using the loop index value after the loop; instead, assign a final value to a variable at the appropriate point inside the loop.&lt;/li&gt;
&lt;li&gt;Using a break forces the person reading your code to look inside the loop for an understanding of the loop control.&lt;/li&gt;
&lt;li&gt;Inefficient programmers experiment randomly until they find something that works, perhaps replacing a bug with a more subtle one.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Chapter 17: Unusual Control Structures&lt;/strong&gt;
&lt;/h2&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Recursion&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;For most situations, recursion produces very complicated solutions that chew up stack space. Use it selectively, and prefer iteration.&lt;br&gt;
For local variables in recursive functions, use new to create objects on the heap as opposed to on the stack.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Goto&lt;/strong&gt;&lt;br&gt;
The use of a goto statement defeats some compiler optimizations, which rely on orderly flow control.&lt;br&gt;
The try-finally construct can sometimes be used to perform the error cleanup that a goto sometimes performs.&lt;br&gt;
Measure the performance of any goto statement used to improve efficiency.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Key points to note;&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Loops are complicated. Keeping them simple helps readers of your code.&lt;/li&gt;
&lt;li&gt;Techniques for keeping loops simple include avoiding exotic kinds of loops, minimizing nesting, making entries and exits clear, and keeping housekeeping code in one place.&lt;/li&gt;
&lt;li&gt;Loop indexes are subjected to a great deal of abuse. Name them clearly, and use them for only one purpose.&lt;/li&gt;
&lt;li&gt;Think through the loop carefully to verify that it operates normally under each case and terminates under all possible conditions.&lt;/li&gt;
&lt;li&gt;Multiple returns can enhance a routine’s readability and maintainability, and they help prevent deeply nested logic. They should, nevertheless, be used carefully.&lt;/li&gt;
&lt;li&gt;Recursion provides elegant solutions to a small set of problems. Use it carefully, too.&lt;/li&gt;
&lt;li&gt;In a few cases, gotos are the best way to write code that’s readable and maintainable.&lt;/li&gt;
&lt;li&gt;Such cases are rare. Use gotos only as a last resort.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>codenewbie</category>
      <category>codequality</category>
      <category>computerscience</category>
    </item>
    <item>
      <title>Code Complete 2: Statements (Part 4)</title>
      <dc:creator>Iyvonne Bett</dc:creator>
      <pubDate>Wed, 23 Sep 2020 16:55:14 +0000</pubDate>
      <link>https://dev.to/iyvonnebett/code-complete-2-statements-part-4-1d51</link>
      <guid>https://dev.to/iyvonnebett/code-complete-2-statements-part-4-1d51</guid>
      <description>&lt;p&gt;A statement is an instruction for the computer program to perform an action. There are many different types of statements that can be given in a computer program in order to direct the actions the program performs or to control the order that the actions are carried out in.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Chapter 14: Organizing Straight-Line Code&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Statements That Must Be in a Specific Order&lt;/strong&gt;&lt;br&gt;
Organize code so that dependencies are obvious; if one method initializes data, create and call an Initialize() method.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Statements Whose Order Doesn't Matter&lt;/strong&gt;&lt;br&gt;
Statements that operate on the same data, perform similar tasks or have ordering dependencies should appear together.&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fs8liygqnwjmumaz192cf.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fs8liygqnwjmumaz192cf.jpg" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Chapter 15: Using Conditionals&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;if statements&lt;/strong&gt;&lt;br&gt;
For both readability and performance, write the nominal path through the code first, then the unusual cases.&lt;br&gt;
Simplify complicated conditional expressions with calls to methods that return boolean values.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Case statements&lt;/strong&gt;&lt;br&gt;
Some case statements only work on data of certain types; don't create a "phoney variable" to use a case statement.&lt;br&gt;
Use the default statement to detect legitimate defaults, or to detect errors, and nothing else.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;My Key takeaways in these two chapters are;&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The strongest principle for organizing straight-line code is ordering dependencies.&lt;/li&gt;
&lt;li&gt;Dependencies should be made obvious through the use of good routine names, parameter lists, comments, and—if the code is critical enough—housekeeping variables.&lt;/li&gt;
&lt;li&gt;If code doesn’t have order dependencies, keep related statements as close together as possible.&lt;/li&gt;
&lt;li&gt;For simple if-else statements, pay attention to the order of the if and else clauses, especially if they process a lot of errors. Make sure the nominal case is clear.&lt;/li&gt;
&lt;li&gt;For if-then-else chains and case statements, choose an order that maximizes readability.&lt;/li&gt;
&lt;li&gt;To trap errors, use the default clause in a case statement or the last else in a chain of if-then-else statements.&lt;/li&gt;
&lt;li&gt;All control constructs are not created equal. Choose the control construct that’s most appropriate for each section of code.&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>codenewbie</category>
      <category>codequality</category>
      <category>computerscience</category>
    </item>
    <item>
      <title>Code Complete 2: Fundamental Data Types (Part 3)</title>
      <dc:creator>Iyvonne Bett</dc:creator>
      <pubDate>Wed, 23 Sep 2020 16:30:34 +0000</pubDate>
      <link>https://dev.to/iyvonnebett/code-complete-2-fundamental-data-types-part-3-47op</link>
      <guid>https://dev.to/iyvonnebett/code-complete-2-fundamental-data-types-part-3-47op</guid>
      <description>&lt;p&gt;In this blog post, I'll discuss the fundamental Data types in Steve McConnell's book Code Complete. &lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Chapter 12: Fundamental Data Types&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Numbers in General&lt;/strong&gt;&lt;br&gt;
By replacing magic numbers with constants, changes are reliable, changes can be made easily, and your code is more readable.&lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F321y7qsfvmfpml83988t.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F321y7qsfvmfpml83988t.jpg" alt="Alt Text" width="388" height="388"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Floating-Point Numbers&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;To increase accuracy when adding numbers with differing magnitudes, add them starting with the smallest values.&lt;/li&gt;
&lt;li&gt;Avoid equality operations and anticipate rounding errors; cope by switching to greater precision, BCD, or integer variables.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Characters and Strings&lt;/strong&gt;&lt;br&gt;
To avoid endless strings in C, initialize strings to null, and use strncpy() instead of strcpy().&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Enumerated Types&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Use enumerated types for more type-checking, and as a richer alternative to boolean variables.&lt;/li&gt;
&lt;li&gt;Explicitly assign their values to specify first and last values for iteration, and an invalid or "null" type.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Arrays&lt;/strong&gt;&lt;br&gt;
In C, use or define an ARRAY_LENGTH() macro as #define ARRAY_LENGTH(x) (sizeof(x) / sizeof(x[0])).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Creating Your Own Types&lt;/strong&gt;&lt;br&gt;
Don't name a type created using typedef after the underlying data type, and don't refer to predefined types.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Chapter 13: Unusual Data Types&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Structures&lt;/strong&gt;&lt;br&gt;
By passing only one or two fields from a structure into a method, you promote information hiding from the method.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Pointers&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Symptoms of pointer errors tend to be unrelated to causes of pointer errors.&lt;/li&gt;
&lt;li&gt;By isolating pointer operations to methods, you minimize the possibility of propagating careless mistakes through your program.&lt;/li&gt;
&lt;li&gt;Allocating dog tags allow you to check for freeing memory twice or overwriting memory beyond the last byte.&lt;/li&gt;
&lt;li&gt;Free pointers at the same scoping level as they were allocated, such as in the same method, or a constructor/destructor pair.&lt;/li&gt;
&lt;li&gt;Set a pointer to NULL after deallocation; writing to it produces an error, and deallocating twice is more easily caught.
&lt;/li&gt;
&lt;li&gt;In C++, a reference cannot point to NULL and the object it refers to cannot be changed.&lt;/li&gt;
&lt;li&gt;In C, you can use char or void pointers for any type of variable.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Global Data&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Passing a global variable to a method, and then referring to both the parameter and global variable is especially tricky.&lt;/li&gt;
&lt;li&gt;Initialization order among different "translation units," or files, is not defined in languages like C++.&lt;/li&gt;
&lt;li&gt;Try to contain a global variable as a class variable, and provide an accessor for any other code that needs it.&lt;/li&gt;
&lt;li&gt;Replace global data with access methods to centralize control over it and protect yourself against changes.&lt;/li&gt;
&lt;li&gt;Build access methods at the level of the problem domain rather than at the level of the implementation details.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;My Key takeaways in these two chapters are;&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Working with specific data types means remembering many individual rules for each type.&lt;/li&gt; 
&lt;li&gt;Creating your own types makes your programs easier to modify and more self-documenting, if your language supports that capability.&lt;/li&gt;
&lt;li&gt;When you create a simple type using typedef or its equivalent, consider whether you should be creating a new class instead.&lt;/li&gt;
&lt;li&gt;Structures can help make programs less complicated, easier to understand, and easier to maintain.&lt;/li&gt;
&lt;li&gt;Whenever you consider using a structure, consider whether a class would work better.&lt;/li&gt;
&lt;li&gt;Pointers are error-prone. Protect yourself by using access routines or classes and defensive-programming practices.&lt;/li&gt;
&lt;li&gt;Avoid global variables, not just because they’re dangerous, but because you can replace them with something better.&lt;/li&gt;
&lt;li&gt;If you can’t avoid global variables, work with them through access routines.&lt;/li&gt;
&lt;li&gt;Access routines give you everything that global variables give you, and more.&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>codenewbie</category>
      <category>codequality</category>
      <category>productivity</category>
    </item>
    <item>
      <title>Code Complete 2: Variables (Part 3)</title>
      <dc:creator>Iyvonne Bett</dc:creator>
      <pubDate>Wed, 23 Sep 2020 13:02:54 +0000</pubDate>
      <link>https://dev.to/iyvonnebett/code-complete-2-variables-part-3-306p</link>
      <guid>https://dev.to/iyvonnebett/code-complete-2-variables-part-3-306p</guid>
      <description>&lt;p&gt;Variables are a foundational piece to any programming languages. Declaring variables is probably one of the first things you learn in any language after Hello world!&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Chapter 10: General Issues in Using Variables&lt;/strong&gt;
&lt;/h3&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;Guidelines for Initializing Variables&lt;/strong&gt;
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;Ideally, declare and define each variable close to where it's used, following the principle of proximity.&lt;/li&gt;
&lt;li&gt;Initialize named constants once; initialize variables with executable code, such as in a Startup() method.&lt;/li&gt;
&lt;li&gt;Initialize each variable as it’s declared Initializing variables as they’re declared is an inexpensive form of defensive programming.&lt;/li&gt;
&lt;li&gt;Initialize each variable close to where it’s first used Some languages, including Visual Basic, don’t support initializing variables as they’re declared.&lt;/li&gt;
&lt;li&gt;Use final or const when possible By declaring a variable to be final in Java or const in C++, you can prevent the variable from being assigned a value after it’s initialized.&lt;/li&gt;
&lt;li&gt;The final and const keywords are useful for defining class constants, input-only parameters, and any local variables whose values are intended to remain unchanged after initialization.&lt;/li&gt;
&lt;li&gt;Pay special attention to counters and accumulators The variables i, j, k, sum, and total are often counters or accumulators. A common error is forgetting to reset a
counter or an accumulator before the next time it’s used.&lt;/li&gt;
&lt;li&gt;Initialize a class’s member data in its constructor Just as a routine’s variables should be initialized within each routine, a class’s data should be initialized within its constructor.&lt;/li&gt;
&lt;li&gt;Check the need for reinitialization-  Ask yourself whether the variable will ever need to be reinitialized, either because a loop in the routine uses the variable many times or because the variable retains its value between calls to the routine and needs to be reset between calls. &lt;/li&gt;
&lt;li&gt;Initialize named constants once; initialize variables with executable code If you’re using variables to emulate named constants, it’s OK to write code that initializes them
once, at the beginning of the program. &lt;/li&gt;
&lt;li&gt;Initialize true variables in executable code close to where they’re used. One of the most common program modifications is to change a routine that was originally called once so that you call it multiple times. &lt;/li&gt;
&lt;li&gt;Use the compiler setting that automatically initializes all variables If your compiler supports such an option, having the compiler set to automatically initialize all variables
is an easy variation on the theme of relying on your compiler. &lt;/li&gt;
&lt;li&gt;Take advantage of your compiler’s warning messages Many compilers warn you that you’re using an uninitialized variable.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Scope&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;A span is the number of lines between successive variable uses; live time is the number between its first use and its last.&lt;br&gt;
To help minimize scope, begin with most restricted visibility, and expand the variable's scope only if necessary.&lt;/p&gt;

&lt;p&gt;A maximizing scope may make programs easy to write, but a program in which any method can use any variable at any time is harder to understand.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Binding Time&lt;/strong&gt;&lt;br&gt;
The earlier the binding time, the lower the flexibility and the lower the complexity. So add only as much flexibility as needed.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Using Each Variable for Exactly One Purpose&lt;/strong&gt;&lt;br&gt;
Use variables for only one purpose; avoid having different values for the variable mean different things (like negative values).&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Ffapqng2qb3xyy0rgb0ao.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Ffapqng2qb3xyy0rgb0ao.jpg" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Chapter 11: The Power of Variable Names&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Considerations in Choosing Good Names&lt;/strong&gt;&lt;br&gt;
A good name tends to express the "what" more than the "how."&lt;br&gt;
To avoid numSales versus saleNum confusion, consider variable names like salesTotal, salesCount, and salesIndex.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Naming Specific Types of Data&lt;/strong&gt;&lt;br&gt;
Intermediate variables do not warrant a name like temp. Such a name may indicate that we aren't sure of their real purposes.&lt;br&gt;
Give boolean variables names that imply true or false, like sourceFileFound or isStatusOk instead of sourceFile and status.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Informal Naming Conventions&lt;/strong&gt;&lt;br&gt;
Variable names can contain; The variable contents, the kind of data, and the scope or visibility of the variable.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Creating Short Names That Are Readable&lt;/strong&gt;&lt;br&gt;
When shortening variable names, don't remove just one letter, be consistent, create pronounceable names, and avoid mispronunciation.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Kinds of Names to Avoid&lt;/strong&gt;&lt;br&gt;
Avoid names with similar meanings, like fileNumber and fileIndex.&lt;br&gt;
Avoid names with different meanings but similar names, like clientRecs and clientReps.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;My Key takeaways in this chapter are;&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Data initialization is prone to errors, so use the initialization techniques described to avoid the problems caused by unexpected initial values.&lt;/li&gt;
&lt;li&gt;Minimize the scope of each variable. Keep references to a variable close together.&lt;/li&gt;
&lt;li&gt;Keep it local to a routine or class. Avoid global data.
&lt;/li&gt;
&lt;li&gt;Keep statements that work with the same variables as close together as possible.&lt;/li&gt;
&lt;li&gt;Early binding tends to limit flexibility but minimize complexity. Late binding tends to increase flexibility but at the price of increased complexity.&lt;/li&gt;
&lt;li&gt;Use each variable for one and only one purpose. Good variable names are a key element of program readability. Specific kinds of
variables such as loop indexes and status variables require specific considerations.&lt;/li&gt;
&lt;li&gt;Names should be as specific as possible. Names that are vague enough or general enough to be used for more than one purpose are usually bad names.&lt;/li&gt;
&lt;li&gt;Naming conventions distinguish among local, class, and global data. They distinguish among type names, named constants, enumerated types, and variables.&lt;/li&gt;
&lt;li&gt;Regardless of the kind of project you’re working on, you should adopt a variable naming convention. The kind of convention you adopt depends on the size of your program and the number of people working on it.&lt;/li&gt;
&lt;li&gt;Abbreviations are rarely needed with modern programming languages. If you do use abbreviations, keep track of abbreviations in a project dictionary or use the standardized prefixes approach.&lt;/li&gt;
&lt;li&gt;Code is read far more times than it is written. Be sure that the names you choose favour read-time convenience over write-time convenience.&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>codenewbie</category>
      <category>codequality</category>
      <category>computerscience</category>
    </item>
    <item>
      <title>Code Complete 2: High-Quality Routines (Part 2)</title>
      <dc:creator>Iyvonne Bett</dc:creator>
      <pubDate>Wed, 23 Sep 2020 12:15:31 +0000</pubDate>
      <link>https://dev.to/iyvonnebett/code-complete-2-high-quality-routines-part-2-2kb0</link>
      <guid>https://dev.to/iyvonnebett/code-complete-2-high-quality-routines-part-2-2kb0</guid>
      <description>&lt;p&gt;Here I will dive deeper into the next three chapters of part two code complete. &lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Chapter 7: High-Quality Routines&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;A bad routine has bad names, a bad layout, multiple purposes, too many parameters, poor documentation, uses global variables, and doesn't defend against bad data.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Valid Reasons to Create a Routine&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;The most important reason to create a routine is to reduce complexity; using a routine doesn't require knowing its inner workings.&lt;br&gt;
Introduce an intermediate, understandable abstraction Putting a section of code into a well-named routine is one of the best ways to document its purpose.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Avoid Duplicate code&lt;/strong&gt; &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Creation of similar code in two routines implies an error in decomposition. Pull the duplicate code from both routines, put a generic version of the common code into a base class, and then move the two specialized routines into subclasses.&lt;/li&gt;
&lt;li&gt;Routines can encapsulate or hide the assumption about the order in which operations must be performed or routines are called.&lt;/li&gt;
&lt;li&gt;Putting complicated boolean tests in routines hides the details, summarizes its purpose, and emphasizes its significance.&lt;/li&gt;
&lt;li&gt;No block of code is too small to put into a routine, especially if it improves readability.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Design at the Routine Level&lt;/strong&gt;&lt;br&gt;
A cohesive routine contains operations that are related; otherwise, it probably does more than one thing.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Functional cohesion&lt;/strong&gt; is the strongest and best kind of cohesion, occurring when a routine performs one and only one operation. Examples of highly cohesive routines include sin(), GetCustomerName(), EraseFile(), CalculateLoanPayment(), and AgeFrom-Birthdate().&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Good Routine Names&lt;/strong&gt;&lt;br&gt;
A routine with a long, complicated name may stem from the routine doing too much; break the routine into multiple routines.&lt;br&gt;
Name functions after the returned value; name procedures with a strong verb and an object to provide its context.&lt;/p&gt;

&lt;p&gt;Don’t differentiate routine names solely by the number, To name a function, use a description of the return value and use opposites precisely.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How to Use Routine Parameters&lt;/strong&gt;&lt;br&gt;
Put parameters in input-modify-output order; if several routines use similar parameters, order the parameters consistently.&lt;br&gt;
If you consistently pass too many arguments to a function, the coupling among your routines is too tight.&lt;br&gt;
Pass the variables or objects that a routine needs to maintain its interface abstraction.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Chapter 8: Defensive Programming&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Protecting Your Program From Invalid Inputs&lt;/strong&gt;&lt;br&gt;
To handle "garbage-in," check values from external sources, values of method parameters, and then decide how to handle bad inputs.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Defensive programming&lt;/strong&gt; is useful as an adjunct to the other quality-improvement techniques described in the book. The best form of defensive coding is not inserting errors in the first place. &lt;/p&gt;

&lt;p&gt;Using the iterative design, writing pseudocode before code, writing test cases before writing the code, and having low-level design inspections are all activities that help to prevent inserting defects. &lt;/p&gt;

&lt;p&gt;They should thus be given a higher priority than defensive programming. Fortunately, you can use defensive programming in combination with the other techniques.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Assertions&lt;/strong&gt;&lt;br&gt;
Use error handling code for conditions you expect to occur; use assertions for conditions that should never occur.&lt;br&gt;
Use assertions to document precondition and postconditions. Don't put executable code in one.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Error Handling Techniques&lt;/strong&gt;&lt;br&gt;
Correctness means never returning an inaccurate result; robustness means always trying to do something that allows the program to keep running.&lt;br&gt;
Beware using a neutral value, substituting the next valid data, returning the last result, or substituting the closest legal value.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Exceptions&lt;/strong&gt;&lt;br&gt;
Exceptions weaken encapsulation by requiring the caller to know which exceptions might be thrown from the code that's called.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F8ktde0obqhqk0xxn8n3c.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F8ktde0obqhqk0xxn8n3c.jpg" alt="Alt Text" width="388" height="388"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Barricade Your Program to Contain the Damage Caused by Errors&lt;/strong&gt;&lt;br&gt;
If public methods of a class checking and sanitizing data, then private methods can assume it is safe.&lt;br&gt;
Convert data to the proper type ASAP; otherwise, you increase complexity and increase the chance that someone can crash your program.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Determining How Much Defensive Programming to Leave in Production Code&lt;/strong&gt;&lt;br&gt;
Remove code that results in hard crashes in production; but during development, this is invaluable for debugging.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Chapter 9: The Pseudocode Programming Process&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Pseudocode for Pros&lt;/strong&gt;&lt;br&gt;
When writing pseudocode, avoid syntactic elements from the target programming language.&lt;br&gt;
Catching errors at the "least-value stage," or when the least effort has been invested, contributes to success.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Constructing Routines by Using the PPP&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Design the Routine - Once you’ve identified a class’s routines, the first step in constructing any of the class’s more complicated routines is to design it.&lt;/li&gt;
&lt;li&gt;Check the prerequisites Before doing any work on the routine itself, check to see that the job of the routine is well defined and fits cleanly into the overall design.&lt;/li&gt;
&lt;li&gt;Define the problem the routine will solve State the problem the routine will solve in enough detail to allow the creation of the routine.&lt;/li&gt;
&lt;li&gt;Research the algorithms and data types If functionality isn’t available in the available libraries, it might still be described in an algorithms book. Before you launch into writing complicated code from scratch, check an algorithms book to see what’s already available.&lt;/li&gt;
&lt;li&gt;Write the pseudocode You might not have much in writing after you finish the preceding steps. The main purpose of the steps is to establish a mental orientation that’s useful when you actually write the routine.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Alternatives to the PPP&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Test-first development&lt;/strong&gt;- Test-first is a popular development style in which test cases are written prior to writing any code. &lt;br&gt;
&lt;strong&gt;Refactoring&lt;/strong&gt; is a development approach in which you improve code through a series of semantic preserving transformations. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Design by contract&lt;/strong&gt; is a development approach in which each&lt;br&gt;
routine is considered to have preconditions and postconditions. &lt;/p&gt;

</description>
      <category>codequality</category>
      <category>codenewbie</category>
      <category>computerscience</category>
    </item>
    <item>
      <title>Code Complete 2: Creating High-Quality Code (Part 2)</title>
      <dc:creator>Iyvonne Bett</dc:creator>
      <pubDate>Wed, 23 Sep 2020 11:18:02 +0000</pubDate>
      <link>https://dev.to/iyvonnebett/code-complete-2-creating-high-quality-code-part-2-fcp</link>
      <guid>https://dev.to/iyvonnebett/code-complete-2-creating-high-quality-code-part-2-fcp</guid>
      <description>&lt;p&gt;Welcome to the second part of my review of Steve McConnell’s influential text Code Complete (2nd Edition). If you haven’t already, please first read my &lt;a href="https://dev.to/iyvonnebett/code-complete-2-book-review-series-laying-the-foundation-part-1-1lb1"&gt;Laying the Foundation Part 1&lt;/a&gt; post. In this post, we will dig into the second part and continue with the fifth chapter. I hope you enjoy it!&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Chapter 5:Design in Construction&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;The phrase “software design” means the conception, invention, or contrivance of a scheme for turning a specification for computer software into operational software.&lt;/p&gt;

&lt;p&gt;Design is also marked by numerous challenges, which I will outline here:&lt;/p&gt;
&lt;ul&gt;

&lt;li&gt;Design is a wicked problem: You must solve the problem once in order to define it, and then solve it again to create a solution that works.&lt;/li&gt;

&lt;li&gt;Design is a Heuristic process: Design relies on heuristics, and relies on trial-and-error.&lt;/li&gt; &lt;/ul&gt;
&lt;h3&gt;
  
  
  &lt;strong&gt;Key Design Concepts&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;My takeaways in this subtopic were;&lt;/p&gt;
&lt;ul&gt;




&lt;li&gt;Managing complexity is the most important technical topic in software development.&lt;/li&gt;

&lt;li&gt;Complexity is reduced by dividing a system into subsystems that are ideally independent.&lt;/li&gt;

&lt;li&gt;Desirable characteristics of design include;&lt;ul&gt;

    &lt;li&gt;Minimal complexity - make simple and easy-to-understand designs.&lt;/li&gt;

    &lt;li&gt;Loosely-coupled -this means designing so that you hold connections among different parts of a program to a minimum. Minimal connectedness minimizes work during integration, testing, and maintenance.&lt;/li&gt;

    &lt;li&gt;Extensibility- this means that you can enhance a system without causing violence to the underlying structure.&lt;/li&gt;

    &lt;li&gt;Reusability- means designing the system so that you can reuse pieces of it in other systems.&lt;/li&gt;

    &lt;li&gt;Ease of maintenance - means designing for the maintenance
programmer.&lt;/li&gt;

    &lt;li&gt;Portability means designing the system so that you can easily move it to another environment.&lt;/li&gt;

    &lt;li&gt;Standard techniques The more a system relies on exotic pieces, the more intimidating. It will be for someone trying to understand it the first time&lt;/li&gt;
&lt;/ul&gt;

&lt;/li&gt;
&lt;li&gt;Make subsystems meaningful by restricting communications and preventing cycles.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Design Building Blocks: Heuristics&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Real-World Objects: Identify objects' public/protected/private attributes, then public/protected interfaces.&lt;/li&gt;
&lt;li&gt;Form abstractions at the right level, allowing you can ignore irrelevant details.&lt;/li&gt;
&lt;li&gt;Encapsulate- abstraction provides a high level of detail, while encapsulation says you can't change levels.&lt;/li&gt;
&lt;li&gt;Hide secrets: Information hiding is part of the foundation of both structured design and object-oriented design. In structured design, the notion of black boxes comes from information
hiding. In object-oriented design, it gives rise to the concepts of encapsulation and modularity and it is associated with the concept of abstraction.&lt;/li&gt;
&lt;li&gt;Information hiding is one of the seminal ideas in software development, and so this subsection explores it in depth. Hiding complexity for easier understanding, or hiding sources of change so its effects are localized.&lt;/li&gt;
&lt;li&gt;Asking what a class should hide cuts to the heart of interface design.&lt;/li&gt;
&lt;li&gt;Identify and isolate areas likely to change, like nonstandard language features, bad design or construction, or data-size constraints.&lt;/li&gt;
&lt;li&gt;Keep coupling loose; one module using some semantic knowledge of a module's inner workings is especially bad.&lt;/li&gt;
&lt;li&gt;Coupling Criteria includes;&lt;/li&gt;
&lt;/ul&gt;


&lt;ul&gt;
&lt;li&gt;Size - Size refers to the number of connections between modules. With coupling, small is beautiful because it’s less work to connect other modules to a module that has a smaller interface.&lt;/li&gt;

     &lt;li&gt;Visibility- Visibility refers to the prominence of the connection between two modules.&lt;/li&gt;

Programming is not like being in the CIA; you don’t get credit for being sneaky.
     &lt;li&gt;Flexibility -Flexibility refers to how easily you can change the connections between modules.&lt;/li&gt;
&lt;/ul&gt;

&lt;ul&gt;
&lt;li&gt;Design patterns provide a vocabulary for efficient communication and embody accumulated wisdom over years.&lt;/li&gt;
&lt;li&gt;Other heuristics: aim for strong cohesion, use preconditions and postconditions, design for test, and keep design modular.&lt;/li&gt;
&lt;li&gt;Don't get stuck on a single approach; if you are stuck on all approaches, step away for a bit.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;
  
  
  &lt;strong&gt;Design Practices&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Iterate; when you come up with something that seems good enough, don't stop, but instead apply what you learned on a second design.&lt;/li&gt;
&lt;li&gt;Top-down design is a decomposition strategy, while the bottom-up design is a composition strategy.&lt;/li&gt;
&lt;li&gt;Top-down design is easy and you can defer construction details.&lt;/li&gt;
&lt;li&gt;Bottom-up design typically results in early identification of needed utility functionality.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Prototyping fails when developers don't write the absolute minimum code, and so don't treat the code as throwaway.&lt;/p&gt;

&lt;p&gt;Big design problems found not to come from bad designs, but from areas deemed too easy for any design at all.&lt;/p&gt;

&lt;p&gt;Capture design work in code comments, on a Wiki, with photos of whiteboards, or UML diagrams.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Chapter 6: Working Classes&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;A class is a collection of data and routines that share a cohesive, well-defined responsibility.&lt;br&gt;
A class might also be a collection of routines that provides a cohesive set of services even if no common data is involved. A key to being an effective programmer is maximizing the portion of a program that you can safely ignore while working on any one section of code. Classes are the primary tool for accomplishing that objective.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Class Foundations: Abstract Data Types (ADTs)&lt;/strong&gt;&lt;br&gt;
An abstract data type is a collection of data and operations that work on that data.&lt;/p&gt;

&lt;p&gt;ADTs hide implementation details, isolate changes, promote informative interfaces, highlight correctness, provide a private namespace, and build on lower-level data.&lt;br&gt;
A class is an ADT with inheritance and polymorphism added in.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Good Class Interfaces&lt;/strong&gt;&lt;br&gt;
Each class should implement only one ADT; mixed abstractions move implementation details to the public interface and complicate understanding.&lt;br&gt;
If a subset of a class' methods operate on a subset of its data, move the data and methods into a new class.&lt;/p&gt;
&lt;ul&gt;

&lt;li&gt;Minimize assumptions by the programmer to use an interface; have the compiler or its own form enforce the requirements.&lt;/li&gt;

&lt;li&gt;Only add public members to a class that are consistent with its abstraction, even if a convenient utility method.&lt;/li&gt;

&lt;li&gt;Abstraction provides models allowing you to ignore implementation details, while encapsulation enforces this principle.&lt;/li&gt;
&lt;/ul&gt;
&lt;br&gt;
Looking at a class' implementation to determine its use breaks encapsulation, and breaking abstraction isn't far behind.

&lt;p&gt;&lt;strong&gt;Design and Implementation Issues&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;

&lt;li&gt;Don't re-use names of non-overrideable methods from the base class in a derived class.&lt;/li&gt;

&lt;li&gt;Move common interfaces, data, and behaviour as high as possible in the inheritance tree.&lt;/li&gt;

&lt;li&gt;Be wary of classes with only one instance (excluding singletons), and base classes with only one subclass.&lt;/li&gt;

&lt;li&gt;A subclass overriding a method to do nothing violates the interface contract and should be addressed in the base class.
Inheritance works against managing complexity and so you should bias against it.&lt;/li&gt;
&lt;/ul&gt;
&lt;br&gt;
Keep class interfaces small, the implementations insulated, and minimize its collaboration with other classes.

&lt;p&gt;&lt;strong&gt;Reasons to Create a Class&lt;/strong&gt;&lt;br&gt;
The best reason to create a class is to hide information, thereby reducing complexity.&lt;br&gt;
Classes also isolate complexity, hide implementation details, streamline parameter passing, promote code reuse, and package related operations.&lt;br&gt;
Avoid god classes; if a class retrieves its data from and stores its data in a god class, move that data.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Summary of Reasons to Create a Class&lt;/strong&gt;&lt;br&gt;
Here’s a summary list of the valid reasons to create a class:&lt;br&gt;
■ Model real-world objects&lt;br&gt;
■ Model abstract objects&lt;br&gt;
■ Reduce complexity&lt;br&gt;
■ Isolate complexity&lt;br&gt;
■ Hide implementation details&lt;br&gt;
■ Limit effects of changes&lt;br&gt;
■ Hide global data&lt;br&gt;
■ Make central points of control&lt;br&gt;
■ Facilitate reusable code&lt;br&gt;
■ Plan for a family of programs&lt;br&gt;
■ Package related operations&lt;br&gt;
■ Accomplish a specific refactoring&lt;/p&gt;

</description>
      <category>productivity</category>
      <category>computerscience</category>
      <category>codequality</category>
    </item>
    <item>
      <title>What is Graph Databases? A better way to store connected data</title>
      <dc:creator>Iyvonne Bett</dc:creator>
      <pubDate>Mon, 21 Sep 2020 09:59:39 +0000</pubDate>
      <link>https://dev.to/iyvonnebett/what-is-graph-databases-a-better-way-to-store-connected-data-46ee</link>
      <guid>https://dev.to/iyvonnebett/what-is-graph-databases-a-better-way-to-store-connected-data-46ee</guid>
      <description>&lt;p&gt;Here in this article, I’ll discuss some ideas and concepts of graph databases, what they are, What you should know in order to pick the correct data store for your application(s) and how they can help us in our daily tasks. &lt;/p&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;What is a Graph?&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;A graph is a set of discrete objects, each of which has some set of relationships with other objects.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F4f54mfsqkhpgfkkah974.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F4f54mfsqkhpgfkkah974.png" alt="Alt Text" width="351" height="173"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;What is a Database?&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;From techopedia:&lt;br&gt;
A database, in the most general sense, is an organized collection of data. More specifically, a database is an electronic system that allows data to be easily accessed, manipulated and updated.&lt;/p&gt;

&lt;p&gt;In other words, a database is used by an organization as a method of storing, managing and retrieving information. Modern databases are managed using a database management system (DBMS).&lt;/p&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;What is a Graph Database?&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;A graph database contains a collection of nodes and edges. A node represents an object, and an edge represents the connection or relationship between two objects. Each node in a graph database is identified by a unique identifier that expresses key-value pairs. Additionally, each edge is defined by a unique identifier that details a starting or ending node, along with a set of properties.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fvbwsyqdt83rereofyn8f.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fvbwsyqdt83rereofyn8f.png" alt="Alt Text" width="700" height="514"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Designed for working with highly interconnected data, Graph databases shine when the goal is to capture complex relationships in vast webs of information.&lt;br&gt;
There are three types of graph database: true graph databases, triple stores and conventional databases that provide some graphical capabilities. Triple stores are often referred to as RDF databases.&lt;br&gt;
Examples:&lt;br&gt;
– Neo4j, OrientDB, InfiniteGraph, AllegroGraph.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Neo4j Databases&lt;/strong&gt;&lt;br&gt;
Neo4j offers a graph database that helps organizations make sense of their data by revealing how people, processes and systems are related. Neo4j natively stores interconnected data so it’s easier to decipher data. The property graph model also makes it easier for organizations to evolve machine learning and AI models. The platform supports high-performance graph queries on large datasets as well.&lt;br&gt;
Neo4j can import tables into nodes from CSV files, create indexes on the nodes, create uniqueness constraints, and construct relationships using the Cypher query language.&lt;/p&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;Graph Databases: Pros and Cons&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;Pros:&lt;/p&gt;
&lt;ul&gt;

&lt;li&gt;Powerful data model, as general as RDBMS.&lt;/li&gt;

&lt;li&gt;Connected data locally indexed.&lt;/li&gt;

&lt;li&gt;Easy to query.&lt;/li&gt;
&lt;/ul&gt;
&lt;br&gt;
Cons:&lt;ul&gt;

&lt;li&gt;Difficult to scale. Sharding ( lots of people working on this)&lt;/li&gt;

&lt;li&gt;No standard language. Every graph database vendor has defined a unique syntax or language for updates and queries.&lt;/li&gt;

&lt;li&gt;Requires rewiring your brain&lt;/li&gt;
&lt;/ul&gt;
&lt;h4&gt;
  
  
  &lt;strong&gt;Why You Should Care about Graph Database Technology?&lt;/strong&gt;&lt;ul&gt;
&lt;/ul&gt;
&lt;/h4&gt;

&lt;p&gt;Performance:&lt;br&gt;
&lt;/p&gt;
&lt;li&gt;Your data volume will definitely increase in the future, but what’s going to increase at an even faster clip is the connections (or relationships) between your data. Big data will definitely get bigger, but connected data will grow exponentially.&lt;/li&gt;


&lt;li&gt;With traditional databases, relationship queries come to a grinding halt as the number and depth of relationships increase. In contrast, graph database performance stays constant even as your data grows year over year.&lt;/li&gt;

&lt;p&gt;Flexibility:&lt;br&gt;
&lt;/p&gt;
&lt;li&gt;With graph databases, your data architecture teams move at the speed of business because the structure and schema of a graph data model flex as your solutions and industry change. Your team doesn’t have to exhaustively model your domain ahead of time (and then exhaustively remodel and migrate the DB after some exec asks for a change); instead, you can add to the existing structure without endangering current functionality.&lt;/li&gt;


&lt;li&gt;With the graph database model, you are the one dictating changes and taking charge; whereas the RDBMS data model dictates it’s requirements to you, forcing you to adapt to its tabular way of seeing the world.&lt;/li&gt;

&lt;p&gt;Agility:&lt;br&gt;
&lt;/p&gt;
&lt;li&gt;Developing with graph technology aligns perfectly with today’s agile, test-driven development practices, allowing your graph-database-backed application to evolve with your changing business requirements. Your agile team now has a database that keeps up with your daily demands.&lt;/li&gt;
&lt;h4&gt;
  
  
  &lt;strong&gt;Graph database vs. relational database&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;Relational databases are not well suited to capturing ad hoc relationships that are not consistent across all records: You wind up with sparsely populated rows and way too many indexes, both of which slow down the database performance. Remember, the relational schema is fixed, so every record in a given table contains every field, whether or not the field is populated.&lt;br&gt;
Moreover, In a conventional database, queries about relationships can take a long time to process. This is because relationships are implemented with foreign keys and queried by joining tables. As any SQL DBA can tell you, performing joins is expensive, especially when you must sort through large numbers of objects—or, worse, when you must join multiple tables to perform the sorts of indirect (e.g. “friend of a friend”) queries that graph databases excel at. &lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Ftsyb70pi09fqn36z242i.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Ftsyb70pi09fqn36z242i.png" alt="Alt Text" width="800" height="698"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Graph databases work by storing the relationships along with the data. Because related nodes are physically linked in the database, accessing those relationships is as immediate as accessing the data itself. In other words, instead of calculating the relationship as relational databases must do, graph databases simply read the relationship from storage.&lt;/p&gt;

&lt;p&gt;It also allows you to build a knowledge graph. Because they are graphs, knowledge-graphs are more intuitive. People don’t think in tables, but they do immediately understand graphs. When you draw the structure of a knowledge graph on a whiteboard, it is obvious what it means to most people.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fbmzfiwzmv29fe6ivapz7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fbmzfiwzmv29fe6ivapz7.png" alt="Alt Text" width="640" height="557"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;How to choose the Right Data Management Solution&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;When Is a Graph Database the Right Fit?&lt;/strong&gt;&lt;br&gt;
Graph databases are hardly a "one size fits all" solution. The type of data, use cases, and available resources should all be considered when deciding to move forward with the graph model or a more traditional data management solution, like the relational database.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Graph databases are suited to handle the volume, variety, and velocity.&lt;/strong&gt;&lt;br&gt;
Managing data as graphs is a particularly good fit when the use case involves modifying schemas and accommodating new features, data points, or sources.&lt;/p&gt;

&lt;p&gt;Graph databases are ideal for instances where elements will need to simultaneously relate to each other, be easily accessible, and query millions of relationships per second. Such data and data management systems are needed to integrate information for chatbots, conversational systems, social applications, recommendation algorithms, optimization applications, routing, and maps — all real-world interactions that need to be stored as densely connected structures and navigated seamlessly.&lt;/p&gt;

&lt;p&gt;AI and machine learning applications tremendously increase in value when configured to work against graph databases, because they can now understand and analyze the edges, or relationships, between entities within the dataset or the content set in the graph form.&lt;br&gt;
Graph databases also run more efficiently across highly-connected datasets. Other data management solutions usually cost more to run.&lt;/p&gt;

&lt;p&gt;Relational database: deal with more simple data models and connections for less connected static data.Example tabular data such as inventories, financial records.&lt;/p&gt;

&lt;p&gt;Graph database: deal with complex data models and processing of large dynamic networks of relationships Example social networks, content management.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;In Conclusion&lt;/strong&gt;&lt;br&gt;
In this article, we have learned about graph databases. In the future, I’ll discuss how graph databases can help us do machine learning and data science in general. If you are interested in building a graph database or reading more I would suggest you start with the Neo4j website as they have excellent documentation in the area. Stay tuned for more.&lt;/p&gt;

</description>
      <category>database</category>
      <category>computerscience</category>
      <category>machinelearning</category>
    </item>
    <item>
      <title>Code Complete 2 Book Review Series: Laying the Foundation (Part 1)</title>
      <dc:creator>Iyvonne Bett</dc:creator>
      <pubDate>Wed, 16 Sep 2020 16:41:34 +0000</pubDate>
      <link>https://dev.to/iyvonnebett/code-complete-2-book-review-series-laying-the-foundation-part-1-1lb1</link>
      <guid>https://dev.to/iyvonnebett/code-complete-2-book-review-series-laying-the-foundation-part-1-1lb1</guid>
      <description>&lt;p&gt;The book Code Complete by Steve McConnell is acclaimed as one of the must-reads for all developers and is extremely well known. It is comparable to a practical handbook full of tips and learning examples to develop more robust programs, and also introduces lots of concepts throughout that can be used to improve the development workflow as it evolves for projects. &lt;/p&gt;

&lt;p&gt;Hence this is the first part of a seven-part book review series where I will be sharing my key takeaways, I strongly believe that this is a book you read once, learn a stack from and when you revisit it with more experience down the line, you'll learn even more.&lt;/p&gt;

&lt;h1&gt;
  
  
  &lt;strong&gt;Chapter 1: Welcome to Software Construction&lt;/strong&gt;
&lt;/h1&gt;

&lt;p&gt;Construction refers to the process of building. The construction process might include some aspects of planning, designing, and checking your work, but mostly “construction” refers to the hands-on part of creating something. &lt;/p&gt;

&lt;p&gt;Software Construction mainly includes; Requirements development, Planning, Software architecture/high-level design, Detailed design, Coding and debugging, Unit testing, Integration testing, System testing and  Corrective maintenance.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;So why is construction/programming an important focus?&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;




&lt;li&gt;Firstly, construction is a large part of software development – coding typically takes 30 to 80 per cent of the total time spent on a project.&lt;/li&gt;

&lt;li&gt;Steve also adds that programming is the central activity in software development where other tasks largely occur before or after the construction phase.&lt;/li&gt; 
&lt;li&gt;With a focus on construction, the individual programmer’s productivity can improve enormously. Lastly, construction’s product, the source code, is often the only accurate description of the software.&lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;
  
  
  &lt;strong&gt;Chapter 2: Metaphors for a Richer Understanding of Software Development&lt;/strong&gt;
&lt;/h1&gt;

&lt;p&gt;A metaphor serves more as a heuristic than it does as an algorithm. An algorithm is a set of well-defined instructions for carrying out a particular task while a heuristic is a technique that helps you look for an answer.&lt;br&gt;
The main difference is that an algorithm gives you the instructions directly while a heuristic tells you how to discover the instructions for yourself, or at least where to look for them.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1 Penmanship: Writing Code&lt;/strong&gt;&lt;br&gt;
Developing a program is likened to writing a letter whereas writing is a one-person thing, software projects most likely involve a lot of people. In writing, a high premium is placed on originality whereas in software construction trying to create trull original work is less effective. Nonetheless, none of these associations translates well to the software development process.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2 Construction: Building Software&lt;/strong&gt;&lt;br&gt;
Here is a list of some similarities between building construction and software development:&lt;/p&gt;
&lt;ul&gt;

&lt;li&gt;Size of the project increases the amount of planning needed.&lt;/li&gt;

&lt;li&gt;Foundation and framework come first.&lt;/li&gt;

&lt;li&gt;One doesn't need to recreate things that are already built. In software, eg. prebuilt libraries.&lt;/li&gt;
&lt;/ul&gt;
&lt;h1&gt;
  
  
  &lt;strong&gt;Chapter 3:Measure Twice, Cut Once: Upstream Prerequisites&lt;/strong&gt;
&lt;/h1&gt;

&lt;p&gt;No matter what the project, the preparation is tailored to the project’s specific needs and done conscientiously before construction begins.&lt;br&gt;
This chapter describes the work that must be done to prepare for software construction.&lt;br&gt;
The carpenter’s saying, “Measure twice, cut once” is highly relevant to the construction part of software development, which can account for as much as 65 per cent of the total project costs. Doing the most expensive part of the project twice is as bad an idea in software as it is in any other line of work.&lt;br&gt;
The overarching goal of preparation is risk reduction: a good project planner clears major risks out of the way as early as possible so that the bulk of the project can proceed as smoothly as possible. &lt;br&gt;
By far the most common project risks in software development are poor requirements and poor project planning, thus preparation tends to focus on improving requirements and project plans.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Causes of Incomplete Preparation&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;

&lt;li&gt;A common cause of incomplete preparation is that the developers who are assigned to work on the upstream activities do not have the expertise to carry out their assignments.&lt;/li&gt;




&lt;li&gt;Moreover, the skills needed to plan a project, create a compelling business case, develop comprehensive and accurate requirements, and create high-quality architectures are far from trivial, but most developers have not received training in how to perform these activities.&lt;/li&gt;




&lt;li&gt;A final reason that programmers don’t prepare is that managers are notoriously unsympathetic to programmers who spend time on construction prerequisites.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;em&gt;Software development is more than coding.&lt;/em&gt;&lt;br&gt;
Studies over the last 25 years have proven conclusively that it pays to do things right the first time. Unnecessary changes are expensive.&lt;br&gt;
One of the key ideas in effective programming is that preparation is important. It makes sense that before you start working on a big project, you should plan the project.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Architecture Prerequisite: Typical Architecture Components include;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Program Organization&lt;/strong&gt;&lt;br&gt;
Without such an overview, you’ll have a hard time building a coherent picture from a thousand details or even a dozen individual classes. The architecture should define the major building blocks in a program. Depending on the size of the program, each building block might be a single class or it might be a subsystem consisting of many classes.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Major Classes&lt;/strong&gt;&lt;br&gt;
The architecture should specify the major classes to be used. It should identify the responsibilities of each major class and how the class will interact with other classes.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Data Design&lt;/strong&gt;&lt;br&gt;
The architecture should describe the major files and table designs to be used. It should describe alternatives that were considered and justify the choices that were made.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Resource Management&lt;/strong&gt;&lt;br&gt;
The architecture should describe a plan for managing scarce resources such as database connections, threads, and handles.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Security&lt;/strong&gt;&lt;br&gt;
The architecture should describe the approach to design-level and code-level security. If a threat model has not previously been built, it should be built at architecture time.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Scalability&lt;/strong&gt;&lt;br&gt;
Scalability is the ability of a system to grow to meet future demands.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Interoperability&lt;/strong&gt;&lt;br&gt;
If the system is expected to share data or resources with other software or hardware, the architecture should describe how that will be accomplished.&lt;/p&gt;

&lt;h1&gt;
  
  
  &lt;strong&gt;Chapter 4: Key Construction Decisions&lt;/strong&gt;
&lt;/h1&gt;

&lt;p&gt;My key takeaways in this chapter are;&lt;/p&gt;
&lt;ul&gt;




&lt;li&gt;Every programming language has strengths and weaknesses. Be aware of the specific strengths and weaknesses of the language you’re using.&lt;/li&gt;

&lt;li&gt;Establish programming conventions before you begin programming. It’s nearly impossible to change code to match them later.&lt;/li&gt;

&lt;li&gt;More construction practices exist than you can use on any single project. Consciously choose the practices that are best suited to your project.&lt;/li&gt;

&lt;li&gt;Ask yourself whether the programming practices you’re using are a response to the programming language you’re using or controlled by it. Remember to program into the language, rather than programming in it.&lt;/li&gt;

&lt;li&gt;Your position on the technology wave determines what approaches will be effective— or even possible. Identify where you are on the technology wave, and adjust your plans and expectations accordingly.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In the second part of this seven-part book series, I will dive in the next chapters of the book fully.&lt;/p&gt;

</description>
      <category>productivity</category>
      <category>programming</category>
      <category>computerscience</category>
    </item>
  </channel>
</rss>
