Skip to main content

Add View Section to Blog

 Add View Section to Blog

Send Feedback

Let's add a view section ( using a div tag ) to our blog, which represents the number of visits to our blog.

Although it would be static for now, we can change it to dynamic later.

So, we will use some text formatting tags to add the views section. The instructions are provided below.

Note: The text formatting tags are always inline.


Instructions to follow -
1. Add a separate view section (using a div tag ) inside the article in the container (div tag )of the first image of the article.
2. Now, add 2 span's with content as: 'Views:' and '1,137'. Make these span's bold using the appropriate text formatting tag.


Expected Blog page is -


no image
<!DOCTYPE html>
<html>
    <head>
        <title>Best Coding Practices</title>
    </head>
    <body>

        <div>

            <header>
                <a href="http://blog.codingninjas.in/"><img src="https://ninjasfiles.s3.amazonaws.com/0000000000001394.png" alt="coding ninjas logo"></a>

                <div>
                    <p><a href="http://blog.codingninjas.in/">blog.codingninjas.in</a></p>
                    <p>Coding Ninjas Official Blog</p>
                </div>

                <a href="http://blog.codingninjas.in/"><img src="https://ninjasfiles.s3.amazonaws.com/0000000000001395.png" alt="coding ninjas love coding"></a>
            </header>

            <main>

                <header>
                    <h1>
                        Best Coding Practices for Hassle-free Programming
                    </h1>
                </header>

                <article>

                    <div>
                        <div>
                            <span ><b>Views:</b></span> <span> <b>1,137</b></span>
      
                        </div>
                        <img src="https://ninjasfiles.s3.amazonaws.com/0000000000001393.jpg" alt="best coding practices">
                    </div>

                    <p>
                        Just like with any other activity, the world of coding is also governed by informal rules. Most of these rules are formulated over decades. Programming languages often remain in usage for longer than their founders expect.
                    </p>

                    <p>
                        Programmers find innovative ways to recreate these languages for different purposes. Thus, some static do’s and don’ts are always of use in the fluid zone called coding. Normally, a great code has three common features: maintainability, dependability, and usability. It should also be adaptable enough to be efficient even in changing environments. However, before coding even begins, a few prerequisites need to be fulfilled in order to provide a solid foundation on which readable code can be written.
                    </p>

                    <h2>PREREQUISITES</h2>

                    <p>
                        This is easily the most important step of all. In absence of these, a code may be inefficient even if it is completed. The prerequisites that need to be in place for an efficient code covers matters like design and architecture. An important question is how development is structured. What is the specific purpose of the software? The problem that the code is meant to solve must be clear to the developer. What is the design of the individual components? Such basic requirements have to be fulfilled when a good code is being written.
                    </p>

                    <p>
                        Hoare makes a good point when it comes to assessing software design and architecture. Either a code is so simple that there are obviously no errors, or a code is so complex that there are no obvious errors. Software design is also of importance to clients, who can decide if their needs are being adequately addressed. If there are some things that architecture cannot take care of, then those are handled in the software design phase. A detailed design is a good guide for coding.
                    </p>

                    <p>
                        The next step is to measure existing programming languages against the requirements to decide on an appropriate one. If needed, a mixed routine can be adopted.
                    </p>

                    <p>
                        Once these are met, it becomes easier to follow some established good coding practices.
                    </p>
                    <ul>
                        <li>
                            <h3>COMMENTING</h3>
                            <p>
                                Commenting is one such practice that is often ignored by programmers, especially for codes that are written by multiple programmers. However, comments reduce the cost of knowledge transfer. Name of the module, purpose of the module, description of the module, original author, modifications and authors who modified code with a description on why it was modified were components of an early commenting practice.
                            </p>
                        </li>

                        <li>
                            <h3>GOOD NAMING CONVENTIONS</h3>
                            <p>
                                Using good naming conventions is the next step to good coding. Often developers use Y1 or X1 as variables, and then do not replace them with meaningful names. To prevent this confusion and utter waste of time, descriptive names should be used.
                            </p>
                        </li>

                        <li>
                            <h3>SIMPLICITY AND COMPACTNESS</h3>
                            <p>
                                The key to a good code is also simplicity. To achieve a certain result, developers may use complex logic but this should be minimised while writing a good code. The next developer who uses the code may use it for a different purpose and may not even completely understand or utilise the complex logic. Simple code does not always depend on the length of the code. The code must also be conceptually simple. An added advantage is if the code is also suitably compact. More code can be viewed on a page and programmer keystrokes can be reduced.
                            </p>
                        </li>

                        <li>
                            <h3>PORTABILITY</h3>
                            <p>
                                Another feature of a good code is portability. If the code contains values referring to ‘absolute parameters’ such as file names, URLs or IP addresses, it will not run on a host that is of a different design. A good programmer will parametrize these variables and configure them so the application can also be run and maintained in a different environment.
                            </p>
                        </li>

                        <li>
                            <h3>TESTING</h3>
                            <p>
                                Testing is also a necessary part in the process of coding. Test cases must be planned while the code is being written, and they are developed while an application is coded.
                            </p>
                        </li>

                        <li>
                            <h3>DEBUGGING THE CODE</h3>
                            <p>
                                While writing a code, it is necessary to check for errors throughout. Though it is fine for smaller programs to be debugged after they have been written, this becomes a bottleneck for longer programmes. The best practice, therefore, is to debug each module as soon as it has been created.
                            </p>
                        </li>

                        <li>
                            <h3>DEPLOYMENT</h3>
                            <p>
                                Once the code has been written, it has to be deployed. The installation files should be kept to a minimum and updated regularly. Unused code or anything that is not necessary should not be installed.
                            </p>
                        </li>
                    </ul>

                    <p>
                        The best practices for coding are, most of all, designed to reduce risk whenever there are chances of it. For a beginner, a few of these will not be completely applicable. But as a hard-boiled programmer writing numerous codes, all these guidelines will come in handy. Since codes can run up to millions of lines at times, outdated advice like ‘keep it simple’ or ‘less is more’ is priceless and should always be remembered.
                    </p>

                </article>

            </main>

        </div>

    </body>
</html>

Comments

Popular posts from this blog

Code: Form Input Types

  Code: Form Input Types Send Feedback For now, we have created a simple form. But there is a problem that the inputs can take any value other than what they are meant to be. So, we need to change the type of the input element for proper functioning. Your task is to change the type of input according to the meaning of each of them. The meaning of each input element is provided below - 1. Comment - to provide a comment for the blog 2. Name - the name of the person who wants to comment on the blog. 3. Email - to provide the email id of the person. 4. Website - to provide the link to a website that belongs to the above said person. The expected output is - code for this  <!DOCTYPE html> <html>     <head>         <title>Best Coding Practices</title>     </head>     <body>         <div>             <header>       ...

Acer Nitro V ANV15-51 2023 Gaming Laptop: A Comprehensive Review

Acer Nitro V ANV15-51 (2023): A Capable Contender in the Mid-Range Gaming Arena (2000 Words) Acer Nitro V ANV15-51 2023 Gaming Laptop (13th Gen Core i5/ 16GB/ 512GB SSD/ Win11/ 6GB Graph) price in India starts from ₹77,790 It is available at lowest price on Amazon in India as on Apr 24, 2024. Take a look at Acer Nitro V ANV15-51 2023 Gaming Laptop (13th Gen Core i5/ 16GB/ 512GB SSD/ Win11/ 6GB Graph) detailed specifications and features. Acer Nitro V ANV15-51 2023 Gaming Laptop (13th Gen Core i5/ 16GB/ 512GB SSD/ Win11/ 6GB Graph) Quick Specifications Specification Value Display 15.6 inches CPU 13th Gen Intel Core i5 13420H GPU NVIDIA GeForce RTX 4050 RAM 16 GB DDR5 SDRAM Brand Acer Model Name ANV15-51 Screen Size 15.6 Inches Colour Black Hard Disk Size 512 GB CPU Model Core i5 RAM Memory Installed Size 16 GB Operating System Windows 11 Home Special Feature Backlit Keyboard The world of gaming laptops is a constant battleground, with manufacturers vying for dominance with ever-more pow...