Wednesday, 29 November 2023

Let Me Tell You About Them Coding Black Females!

 I know you have NOT been wondering where I’ve been these past few months or why I haven’t been posting. 

I have spent the past 6 months completing a Java course with and amazing organization called Coding Black Females founded by the one and only Charlene Hunter. After life took an unexpected turn at the end of last year, I slowed down on attending tech events, my first one was in April 2023 for Coding Black Females launch event for ‘Entry to Tech’ with the UBS Bank. Little did I know when I arrived at the event that we were there to listen to the fantastic program that they were running that would teach an in-depth guide to Java over 28 weeks. I decided to throw my hat in the ring and see what happened. Stepping out of our comfort zone remember. I was blessed enough to be one of the few amazing women to win a place on the course and have been on a journey ever since. The course is taught with the help of an amazing group of teachers, with self-learning, lessons from the sponsored employer and assessments that showcase live learning throughout. 


I have previously learned JavaScript MERN with another amazing group of people and if you don’t know by now, check out Leon Noel and his 100Devs. But allow me to tell you that Java is a bigger Badder older brother, going from JS to Java was like hitting a wall, but I climbed it and still continue to do so. I’ve had one hell of a journey over the last 6 months so let me tell you a little bit about it. 

JavaScript / Java only difference is the name, right? 

So coming from a JavaScript to Java background let me tell you, they sound alike but are actually very different especially when it comes to handling data types. Java prefers the elegance of static typing. Picture this: in Java, you define your variables and their types upfront and stick to them throughout. See Java is statically typed, meaning variables must be declared with a specific data type that cannot change during execution. This ensures strict adherence to data types—integers, strings, etc.—right from the start. For example, when creating a variable to hold an integer in Java, you explicitly define it as an int. Think of it like picking a lane and staying in it. This rigid structure at the start helps catch errors early and keeps the codebase sturdy. 

On the other hand, JavaScript loves the freedom of dynamic typing. You want a variable to hold a number? Great! 10 minutes later, it can be a string or an array—no rules. JavaScript is dynamically typed, allowing variables to hold different types of data over time. This flexibility can make coding faster and more adaptable initially, as variables can be assigned any type without strict predefinition. However, this dynamic nature can lead to unexpected errors during execution, especially when handling complex programs where data types might change unexpectedly. 

What are you even Talking About? 

In Java, think of data types as labels for different kinds of information. Integers, strings, and booleans—each has its own box. Then come collections. You've got your ArrayLists, Stacks, HashMaps—collections are like containers holding a bunch of items. 


ArrayList? It's a type of collection that can change size as you add or remove things, but Java wants you to specify what goes in there. No one-size-fits-all here. If you want a more fixed collection, there's an array, but it's less flexible once declared.

Lets have a look using that classic interview question FizzBuzz. You know the problem count the numbers from 1 to ‘n’, if number is divisible by 3 type “Fizz”, is its divisible by 5 type “Buzz” and if divisible by both 3 and 5 type “FizzBuzz”, otherwise type the relevant number. 

So in JavaScript its relatively simple              

  1.  Line 3 - Create a method for our puzzle to go in. 
  2. Line 4 - We declare our array and initialize it with variable. 
  3. Line 5 - We start our loop declaring ‘i’ with ‘let’, detailing our end point and conditional increment. 
  4. Lines 6, 8, 10, 12 - I've decided to use an if else conditional so it's easier to see. Depending on what our conditions are. 
  5. Notice when labelling our conditionals, we use 2 ‘==’ and not 3, why? Because Java isnt programmed to have 3 ‘===’ so if you use it your IDE will start complaining. 
  6. Lines 7, 9, 11, 13 - We push the relevant outcome that meet the terms of our conditional to our array. 
  7. Line16 - We console log our result. 
  8. Notice here that although it is better practice, the semi colons at the end of each line of code baring those with a curly brace is kind of optional and our code will still execute with or without them. 
  9. console.log(arr)

Output:  [1, 2, 'Fizz', 4, 'Buzz', 'Fizz', 7, 8, 'Fizz', 'Buzz', 11, 'Fizz', 13, 14, 'FizzBuzz', 16, 17, 'Fizz', 19, 'Buzz'] 


Now let's do the same thing but in Java
 

  1. Line 1 – we declare out package, this is essential in making this work. 
  2. Line 6 – declare your class and label its visibility, this class is public so it can be reached from anywhere inside of the package, but we also have private classes 
  3. Line 8 – so here we declare the access level of the method and the return type. Then we tell the program that it’s the main method entry point for Java to do its thing and we take an array of strings as an input. 
  4. Line 11 - We once again declared our array and created a new one.  This time I have chosen a List of type ArrayList  
  5. (lines 3 &4 - We have to import List and ArrayList in order for us to use “import java.util.ArrayList; import java.util.List;” 
  6. While we declare our ArrayList we also have to tell it what type of data it will hold. So FizzBuzz means that it will hold integers and strings, since Java doesn’t allow you to be able to have a ‘one size fits all type of array like JavaScript, we have to use an Object type. <Object> 
  7. Line 12 - Once again, we start our loop, instead of ‘let’ we use ‘int’ so we let Java know we are incrementing through and index of integers. 
  8. Lines 13, 15 , 17, 19 - We set out our terms in our if else conditional. 
  9. Lines 14, 16, 18, 20 - We ‘add’ the relevant outcome to our array. Now depending on what type of collection I chose some of them could still accept pushing and popping as with JavaScript. An ArrayList is not one of the ones that accept this. 
  10. Line 23 - Lastly, we System.out.println(arr); our outcome and when we compile it runs in our terminal. 
  11. *Note*that all lines of code not ending with curly braces MUST have semicolons or your code doesn’t run
  12. Now to be fair lines 11 – 24 – could and should be wrapped in a static method that allows main to access it when called, but we have done this in such a way that it isn't needed. Our outputs for both of these are very much the same and can be condensed down into shorter code but the way that you get there is a little bit different. 


Output: [1, 2, Fizz, 4, Buzz, Fizz, 7, 8, Fizz, Buzz, 11, Fizz, 13, 14, FizzBuzz, 16, 17,  Fizz, 19] 

28 weeks ago I was OBLIVIOUS to this, but CBF and UBS have sparked my imagination and taught me so many new lessons. I can’t wait to share more with you! 

If youre a coding black female in, this is our tribe! Join us!!!



Wednesday, 11 October 2023

Mastering MVC: Demystifying the Model-View-Controller Paradigm



So, let's talk MVC - the Model-View-Controller architectural paradigm. You've probably heard of it, and maybe you've even encountered it in your coding journey. But what exactly is it, and why is it so crucial in the world of software development?
MVC, which stands for Model-View-Controller, is an architectural paradigm introduced in 1979. It's a framework that separates the critical components of a software application: the Model, the View, and the Controller. This separation abstracts their inner workings from each other, and it serves some profound purposes.


A Team Player 

MVC is a game-changer for developers, especially those working in teams. It enables different team members to work on different aspects of an application without stepping on each other's toes. In essence, it enables collaboration.


Taming Complexity

One of MVC's superpowers is that it neatly divides application functionality. The 'Model' handles everything related to the database, serving as the middleman between the database and the 'Controller.' In some frameworks, it also communicates directly with the 'View,' though that's not the case with Node.js.

Who the heck is Mongoose??

To facilitate the interaction between Node.js and databases, we have 'Mongoose.' Mongoose is an Object Document Mapper (ODM) built on top of the MongoDB driver. It streamlines the coding process by simplifying validation code, making your code shorter and more manageable, and providing boilerplate business logic by creating schemas.


Sche-who? Schema

A schema, in Mongoose's terms, is a blueprint for your data. It defines the structure of your data, including the types of data (like strings, numbers, objects) and their arrangement. A schema is the scaffolding that outlines what your database will hold and how it'll be laid out.
    Everything in Mongoose begins with a schema. This schema maps directly to MongoDB collections and defines the structure of the documents within the collection.


The Visual Interface

The 'View' is the user interface, it's what the user interacts with. It listens to the 'Controller' but never communicates back to it. The 'View' doesn't engage directly with the 'Model' either. However, it can receive dynamic values from the 'Controller' and template engines. In simpler terms, the 'View' encompasses the front end of your application. It's all about what the user sees and interacts with – HTML, CSS, JavaScript, React, EJS, Bootstrap, and Tailwind.


The Middleman: Controller

The 'Controller' plays the role of a middleman, orchestrating the movement of actions. It's a key player that receives input from the 'View,' processes GET, POST, PUT, and DELETE requests, fetches data from the 'Model,' and passes data back to the 'View.' In essence, it's the conductor of this symphony, ensuring that everything flows smoothly.




Routing the Way

And to make sure everything is directed correctly, we have the 'Router.' It sends requests to the appropriate 'Controller,' defining the endpoints for each action. Think of it as the map guiding requests to their destinations.


With this taster of MVC, we've uncovered a world of separation, organization, and collaboration in software development. It's the architecture that keeps everything in its place and ensures that the pieces of the puzzle fit perfectly.

Wednesday, 24 August 2022

5 great blogging pointers from some of your twitter space favourites.

 


1. What do you want to write about? if you have an idea but aren't sure where to start sometimes its best to Just start writing. It may seem crazy but taking the first step may be the trigger that you need to unleash the ideas and remove any writers block that you may be experiencing. 

2. Change your environment. If going through a bout of writers block, being stuck in the same environment for hours may not be helping. By temporarily removing yourself from your office can encourage your creative juices and move forward in your writing.


3. What you may want to say might have been written already but it hasn’t been written in your words. One subject can be taught by thousands of people but how it is worded may make the difference in your understanding. Your words may be what somebody out there needs to help them understand the topic that you are trying to discuss. Eddie Jaoude

*Please note that if your facts are incorrect, prepare to be corrected by whomever finds fault in your article.* On the bright side you’ll find growth from the correction or maybe even a new friend. GrahamTheDev

4. Make sure its searchable and leads back to you. Good blogging platforms for people in the tech realm happen to be dev.to and Hashnode but as per Graham's  advice. These are public platforms are easily accessible to your target community in tech and gain you further reach than you’re your local blog can do. Make sure that the main article links back to your own site, so the reader can find more of your own content. GrahamTheDev

 
5. Your blog may start off small, but with time, if published to the right forums your community that you involve yourself in from the likes of dev to and Hashnode can eventually increase and become your loyal following. Like most things you only see true growth with consistency.

 
Bonus pointer inspired by the great Danny Thompson himself

* Remember your content is a story, so give it a beginning, middle and end.
Draw people in with an informative title that informs them about what they expect to see in your article.
You have their attention, now give them the what they came for! 
Conclude your article, don’t leave your audience hanging. Make sure they leave with the information that they came for.

when you will publish your next post? 

Monday, 11 July 2022


So if you haven’t gathered from my previous post I’m a software engineer….. in transition.
Nobody saw that coming this time last year, least of all me. But after a lockdown few years I needed a change there are so many sayings about the possibilities of what could happen at the edge of said comfort zone, I’m about finding out  for myself. The change of direction actually comes by way of my current job. I work in a very successful global logistics operation, labelled a great place to work in several countries and the services that we offer are innovative and competitive. However, we have a problem. A small enough problem but having to deal with it on a daily basis myself, it’s a very irritating issue and not just for myself but for other colleagues in my line of work and customers alike. So I set about developing a solution to rectify that issue. I had the idea, I just didn’t have the knowledge or experience of where or even how to start, and so began my re-education as a software engineer. 

“The real trick to life is to turn hindsight into foresight that reveals insight” Robin Sharma 


With that allow me to use the hindsight of my past missteps to be your foresight that reveals insight.

 

Dear me of 3 months ago, let’s make this less traumatic then it needs to be.

 

here’s some advice you’ll need to deploy your first website.

 

First things first, this is not going to be as easy as you thought it would be. Learning to become a developer is time intensive and a real labour of love. When things just don’t click… and you will have days when they just don’t click you have to have the tenacity to keep pushing until it does.

Before I started learning how to write code and develop programmes, had you asked me how to deploy a website I’d have said,:

1.       Buy the ‘name site’,

2.       Push a button to launch it and

3.       Then move on with your life.

I regret to inform you that I was  wrong, see what I didn’t know about back then was:

·         Domain names

·         Hosting a site,

·         Linking the two

·         The product testing that goes into it,

·         The checking for optimal performance,

 Put short, none of those things were in my head at all. My first website deploy was a lesson on those issues in just about every way. Sure the initial deploy went well, the site was live on netlify and looked great to me. The tweaks that I had made to the site while it was live looked amazing and I was so excited! There was only one problem, the website wasn’t under the domain name that I had purchased and there wasn’t a ‘type your purchased domain name here and we’ll link it for you!’ button. I had to learn how to do that myself and ended up going to a developers best friend ‘Google’ to find out how to make that happen.

Truth is I was blissfully ignorant, and had a very quick lesson to learn. If you done it all a bit backwards like I did, let me help you dig yourself out of my first coding hole.


It’s all in the name!

Firstly purchasing a domain name probably means that you’ve purchased the literal address of where your client software is due to be, nothing else really comes with that. Domain names can help to link your website to your website identity. Good places to purchases those include  www.namecheap.com and google domains, be sure to check what support they offer in case you need a helping hand for any unexpected mishaps in the future.. But remember, there are more steps to take if you intend to build a website that other members of the public can visit rather than just on your personal computer.


Congratulations! You’ve bought the name, your worries are not over. What do you know about website hosting options?

When you purchased your website name did you think about how you would be hosting your site? A website host is the place where your website is housed think of it as buying or renting a house to put all of your carefully crafted code.  Depending on what you plan to use your website for, your hosting options may differ. If you do not expect your site to have a lot of traffic and are okay with the occasional advert appearing on it a free hosting platform may be just what you need.  Netlify, Heroku and GitHub all offer free hosting to their users and are great for smaller quieter sites.

They may not be such a great option if your site will be high traffic as you may have a cap on your bandwidth or face your site being disabled if you abuse the terms of your contract. If your website requires a back end, some free hosting options may not be suitable for you, as always, research is key.


So you remember that fancy domain name that you bought, now it’s time to attach it to the website that you’ve deployed. This is where you put the domain name that you have purchased and link it to the platform hosting your site. Depending on the hosting platform and the place that you have leased your domain name from you’ll probably be looking through your documentation to find your CNAME. A CNAME is a type of DNS domain name server, where you’ll need to enter this and the IP addresses associated with your site. There are dozens of literature and videos out there that all explain how best to go about adding your custom domain name to your site, Tony Teaches Tech, does a great job of explaining how to add your custom domain name to your Github page.


WHATEVER YOU DO, DO NOT FORGET TO ADD SECURITY!

This was pretty simple but easy to forget, hosting a site on GitHub allows you to quickly check a tick box that allows your site to be secure, please note this option is not auto selected and therefore you will have to manually add it yourself. In google a padlock icon to the left of the address bar indicates that your website is safe and can therefore be trusted. In some cases if site security is not offered by your hosting site, you may need to purchase a certificate if not available for free online.

Now its up, don’t forget to test it and make sure that it runs well across all browsers and its performance is optimised. Some search engines will penalise your search rankings if your website is not fully accessible and under performs, so this is actually important if you intend your website to show up in search engines and establish your web presence.


That’s your first deploy of many complete.


That wasn’t so bad, but I'm glad I prepared you not to walk into this blindly.

Sunday, 26 June 2022

I made my first contribution to Open Source. It was slightly more stressful than I thought it would be… but I’m going to do it again.

Open Source written on a typewriter


So after hesitating about getting involved in the world of open-source contribution for a while, I finally decided to actually do it. I wanted to join a community where I could help solve problems and become a better developer at the same time but didn't know where to start or what projects I could contribute to.


Contributing to an open-source project is usually ranked semi-highly especially on a new devs to-do list but do we even know what it is or why we want to do it?

"Open-Source Software is a type of software whose code is publicly available to use and modify. Open-Source Contribution involves contributing to the development or improvement of open-source software...

Open Source is something each one of us is inevitably using every day, possibly without being aware of it. Interestingly the code that resulted in the first manned mission to the moon is also open-sourced."

By definition of Work@tech

Why did I want to contribute to open source?


Personally for the reasons I previously mentioned and also to find a way to build my confidence when dealing with projects other than my own, not to mention to learn and connect with some other great members of the tech community whom I might not meet otherwise.
Knowing I wanted to contribute but not knowing where to begin was slightly overwhelming and an issue that I’d have to overcome if I was to do it. In truth, contributing doesn’t necessarily mean writing lines of code to solve a crisis. In fact, it can be something as small as fixing a typo, updating a ReadMe file or editing that line of code mentioned before.

Three ways I got involved?

During the course of one very busy yet productive weekend I joined a new but rapidly growing community on meetup 'Together We Opensource.’ It's the perfect community for beginners and those needing some direction. Each week founder Nikita, runs through his top tips covering how to find the right open source project for you, then together with the cohort contribute to them, he also speaks on the dangers of juggling too many open source projects at once.



That weekend I also joined a Twitter space, the subject happened to be ‘getting into open sourcing for the first time.’ It was almost like a sign now, I had to contribute somewhere!

During the twitter space, I was afforded the opportunity to join the amazing discord community of Eddiehub.org. EddieHub, has many fantastic projects for contributors of all experience to get involved with including the 'hacktoberfest practice' to sink your teeth into. In the task, you run through forking a repo, adding your name and linking your GitHub profile to the list of contributors in alphabetical order, then raise a pull request.
If successful, your pull request will be merged and your name will appear in the list.



How to contribute to open source within 10 minutes - start now!


It was a pretty easy task, I gained my Pull-Shark badge on GitHub and made a small passing tweet about it that got a lot of likes… but I hadn't really done anything, I hadn’t made significant meaningful change with my input.

'OpenSauced.Pizza’ was then recommended to me by way of Twitter, in their own words:
'Open Sauced provides guidance onboarding for new contributors. Their approach towards open-source onboarding offers a way to track contributions through GitHub GraphQL API powered dashboard.'
Here I was able to scroll through a number of issues posted and pick out ‘first-timers only’ issues until I found one that I felt comfortable with. And just like that, I had found the perfect first-timer issue! I created the pull request, found the page and issue that had been referenced and worked on my forked copy to fix the problem. However, my lack of confidence kept me from pushing my fixed version ‘what if I had done it wrong? What if I had read the issue wrong?’ so many what-ifs! Seeking help from the person that posted the issue for advice, I ended up waiting too long and missing out on my first opportunity. The moderator reiterated this to me, insisting I have confidence in myself. The very next issue I saw was going to be mine, I was laying my claim on it and nobody would stop me.Two days later that second chance came around, I was ready!
  • Repo forked,
  • Changes made,
  • Pushed to my GitHub,
  • GitPod test ran and passed,
  • Pull request submitted
  • Happy dance complete!

It was done, or so I thought. I woke up to a message that the issue had been closed and that my pull request had been declined. That was disappointing….

Lessons to be learned

An unsatisfactory few hours later, another email arrived in my inbox. After reviewing my pull request with another moderator, it was decided that my original request did meet the required changes and would be accepted if I could update my request and link to the new issue... Great, how do I do that? At that moment I turned bad at googling, assuming that I had a very short window to update my request before someone else jumped on it, I hurriedly updated my link and managed to inadvertently submit the wrong thing. Here it was, the face-palm moment that I had dreaded!

See what I learned at that moment was that the moderators are actually alright, they’re not as scary as I thought! They wanted to guide me in the right direction but also wanted for me to learn, they wanted me to succeed just as much as I wanted to. In between my other commitments and learning how to fix the re-opened issue the moderators patiently waited for me telling me to ‘take my time,’ dropping hints where needed until I finally updated my request. They even congratulated me when it was merged and left me with some advice for future contributions.

My takeaways from the experience:

  • Great places that support people looking to contribute to open source include EddieHub, Topether we Opensource, Open Sauce Pizza and so many more. It’s all about looking and finding them.

  • Look for a good first issue that you know you can handle. If it’s going way above your head this may not be the issue for you, another will come along.

  • Read the ReadMe file, it’s named so for a reason, there’s probably information/rules in there that will help you.

  • Ask questions! If you are asking questions you are also expressing your interest in working on that issues. Likewise, if you are stuck, nobody is likely to help you if they can’t tell that you need help. There’s that saying
"The man who asks a question is a fool for a minute, the man who does not ask is a fool for life." — Confucius
  • Don't make more work for the moderators than necessary because you were too stubborn to ask for help.

  • Make any required changes on a separate branch rather than the main branch.

  • Calm down and take your time, because pushing panic-induced pull requests is not what we are trying to achieve here! Contributing to open-source isn’t as scary as you think.

So here’s to 'third times a charm!’


And to anyone reading this for inspiration, happy open sourcing!

Let Me Tell You About Them Coding Black Females!

  I know you have NOT been wondering where I’ve been these past few months or why I haven’t been posting.  I have spent the past 6 months co...