This morning started off with a lecture about security, namely preventing SQL injections. The whole concept is very simple and the way to prevent this is to just wrap it in a function that will make any inputs into Strings and not be read as a SQL query. However the funny part is that some studies say that 80% of web applications do not protect from SQL injection. Seriously? I was shocked.
After putting in at least 15 hours of coding over the weekend, I ended up being quite ahead of most of my classmates so I began working on an optional assignment. This assignment was to take a CSV file and make it print to a nice table.
In addition to presenting the information on a nice table, we also had to paginate the data. This is a view that's limited to 50 pages. You can also see the link on the top left. The pagination was made possible without using a database by using the $_GET superglobal that you can see on the URL. By passing in what page we wanted to see, I used that variable to get the right scope of data. This assignment took so much longer than I expected. Although CSV files are not a common thing to see, developers may be given a task like this and are expected to know how to extract the data so it can be put to use.
Another quick thing to note is that I once again used Bootstrap to make the form look nice. There's a group of 3 of us in the class that literally use Bootstrap for every assignment. Me and my fellow 'bootstrappers' really see the value and the power of this library and definitely try to get as much practice as possible.
Up next we have Object-Oriented Programming. Now before we started this chapter, we have been doing things "procedurally". Although Object-Oriented Programming might take a little longer, this method saves us much more time and lines of code once our applications become much more sophisticated.
I did wonder why we didn't introduce this concept much earlier, but I trust in the curriculum. I already have a solid understanding of classes so it wasn't hard to pick this up.
Here is an example of the power of OOP. The Dog class below doesn't have to repeat all the code that the Animal class has. Instead it can just inherit all the data. From that point on, you can modify and make changes as necessary.
That's it for today. On Friday of next week, I'll be taking my green belt exam. However I do have the option of taking the red belt exam. If I am able to take that exam and pass, I'll be given a green belt as well. Students can get a black belt as soon as week 8 and a "2nd degree" by the end of the program. I'm shooting for it all!
No comments:
Post a Comment