First 250 days of software dev - Part 5

12 min read

Day 41

Today, we examined and did the conversion of a program we worked on before and coded in JavaScript into PHP. To be honest, it was not difficult to convert it to PHP. In fact, nothing is difficult (at least from what we saw). I think it was only difficult because we were still new and we were seeing terms for the first time. The best part of today was that we contributed to something we had done before. If we were expected to build a structure from scratch, it would have been more difficult. I think it will be harder from now on, of course, because it was just like an exercise. It was like getting familiar with the terms, getting familiar with writing in PHP. Like practicing what, what does it do. After the server side (no matter how questionable the optimization is), I tried to combine it with HTML-CSS-JavaScript. Before the JavaScript part, I was a bit stuck on how to do the form operations. Then I solved that problem with your help. Although I don't encounter any problems when I process on the server side, there are some problems when processing data from the client. I thought of it as "future development" (when I say future, I wouldn't be surprised if it happens tomorrow).

What have I learned today?

I learned the basic functions in PHP. I used array_search(), isset(), array_push(), in_array(), count(), array_diff(), unset(), array_values(), array_column(). Did I learn them all completely because I want to do a bit more? I need to do some more repetition. But I did it by understanding why, where, with what and how to use everything.

I used switch-case, if-else-else if, for, foreach. The only difference with JavaScript is in foreach. The other structures are exactly the same. I created associative array, class, functions in PHP.

Finally, I added the HTML part to my code to connect the server side with the client in a more elegant way.

My main thoughts are: I need to do a lot more work or repetition. Even though I don't know the limits of what I can do with Javascript, I'm still at a very limited and shallow point. In PHP, yes, I tried to do something, but I definitely need to repeat it and do a good study for our future work.

Day 42

I was getting an error somewhere in the code, I was trying to fix it, I tried, I tried, but I still couldn't fix it. I guess I'll have to look at it again with a fresh head, but I was sad not to do that. What was it? We received the data from the user with the "POST" method. We wrote it to a file with a ".txt" extension. I can write to and read from the file. The elements written to the file jump to a new line with each new element "constellation" entry; I created a new array from each of the rows (multidimensional in total, of course), and from there I completed the part we want with array_column and in_search. Maybe it was a long way, but it worked. But I think I made some logical mistakes in the rest of the process and it didn't work. I will try to solve this first thing tomorrow.

What I learned today: I can say that I learned that GET and POST methods are used to retrieve data from a user and send a response to his request. I felt the benefit of my HTML and CSS practices today, because I can design things quickly (I only did the parts that will be useful in appearance, since our goal is PHP).

Day 43

What I am about to write may take up your time unnecessarily, I understand if you don't read it or criticize it internally/externally. I wanted to write something a little more information-heavy, but since I think that I provide information and interpretation-based outputs during the work and I keep my "cheatsheets" that summarize or exemplify the things we use in the tasks we do, I am writing an end-of-day report with a little too much commentary for today. Also, when we first started, you said to look at SEO for an hour a day, but it has been a long time since I looked at that, because we were thinking about coding. That's always on my mind too.

First of all, today was very productive. I was able to solve the problem I had yesterday much more easily in the morning with a relaxed mind. After completing what I needed to do in PHP, with your guidance, I researched topics such as SQL, MySQL, communication between PHP and Database. Honestly, I was going to try to combine it with the code we wrote directly on top of it, but I left it for tomorrow. The only bad thing about today was that I had a little cold last night and felt weak during the day. I took it upon myself today to query the database, connect to the database from PHP, basically open PHPMyAdmin and play around with it a bit. I looked at examples of how to create and keep cookies, how to save user information to the database after pulling it from the incoming form information. I think I was able to get the concept down a bit (reading and studying will only go so far of course, tomorrow will be practice time on the job). Before I came to the company, I had also looked a little bit about connecting to a database, mostly by watching youtube and trying something myself. Of course that works too, but reading and understanding from documents and written sources and trying to work on it also contributed a lot. Even though there were books and questions in the university, sometimes I would listen to Indian or Western lecturers or knowledgeable people and learn from them. I don't think it was necessary to explain this, but I wanted to add it. Since this is what we are doing now, I don't think I have much difficulty, especially in this abundance of information. Sometimes I might get a little bit carried away, but that's what drives me. Honestly, everything that I've been going through for 1.5 months is whipping me up to work. I feel like I'm looking for a place to be whipped, the process before work, the process at work, the people, the work that I love (which I don't feel like work, I feel like a hobby. This is of course not only because we are working on software, but also because of what the environment, i.e. you, has to offer), the money earned (it ends the dependence or burden on the family), thoughts about the future and the past, the contributions of world-class people in the field I work in and the fact that I can smile when I see what they are doing, the possibility of improving myself and making a contribution to this "community", both to myself, to the people I work for and earn money from and am responsible for, and also to the people who invest in me, and to other developers who specialize in their field. In a positive way, of course.

Towards the end of the day today, all I could think about was "Buğra, before the end of the day, you should learn how to write SQL queries enough to be useful in the short term and you should connect to the database from PHP and keep the data coming from the client. On top of that, you should send cookies to the client and keep its id or session information". But since it's not something to rush, I wanted to start calmly tomorrow.

That's all for today.

Day 44

I actually think that I am a slow learner. I mean, I am not very smart, but I believe that I can reach the results I want by working hard. Anyway, let me get to the point without writing anything about the human factor. Because there are so many parameters when human beings are involved, and this is not my specialty right now, but the specialty of sociologists, psychologists, and other social scientists.

Today was mostly research. Actually, I could have connected to the database very quickly with PHP, but I read a bit too much. I researched. I didn't understand why deleting a row from the database and then adding the next rows is the number after the primary key of the deleted row. It still makes little sense. If I deleted a user, another user should be able to get that id instead. But if this is the system, maybe we should work accordingly and not question it too much.

The topic I was most impressed by today was not about database or PHP, but about the concept of "metaverse" that I looked at after work. I don't know if it will lead to a utopian or dystopian universe like Black Mirror, but it was fun to read the articles, dreams and investments.

What I enjoyed the most today was that I could access the database in PHP and do whatever I wanted. SQL query is actually something that can be done easily with a little practice because each query is like a sentence. It is very simplified for the user (us). So I don't think we will have much difficulty. I saved the user data. I was able to compare the data coming from the client with the data in the database and make transactions. Then I was going to get into issues like updating information, but I realized that I needed to send the user a session id or cookies in general. Then I did some research on that, the reasons, how it is used, and examples. It's something I've looked at before, but I wanted to take it slow because I didn't need to do it at a super fast pace right now.

The most comforting thing today was this: It was much easier than two days ago when we used a ".txt" file as a database and saved the data. I didn't know there was such a difference. Getting data from a ".txt" file was a bit more challenging. But there was nothing to fuss about here. The SQL query was much easier to write because it was already a simple sentence.

If I'm not given a different task tomorrow, I'll try to send a cookie (more precisely session id) to the client, recognize it (stretching the stateless concept) and try to do transactions with the database.

Day 46

Today was spent working on the database and PHP. We added the product information and the category information of the products to the database and did some work with them. I really lived the concept called over-engineering in switch-case to the fullest. It was a mistake not to see this. It was also a mistake to relate to the database in both object oriented and procedural way. I did that because I thought it would be necessary to establish only prepare and object-oriented structure in data exchange from the user, but from now on I will definitely pay attention to this and try not to make the same mistake. Apart from these, I think I was able to fulfill the task given today. I also think my code literacy has improved. Since the courses at the university are generally based on just giving the lecture and passing the course, and if the person does not have a special interest in the subject by studying the questions, he usually completes the process without learning or acquiring anything because he only memorizes. However, I think I learned a lot of things in these 2 months because there were no questions or problems of passing the course. Tasks were given. Necessary things to know were explained. And I tried to produce. Of course, there were copy-pastes and benefiting from other people's work in this process. I didn't reinvent the wheel, but I learned how the wheel is attached to which car, which wheel is attached to which car, and what the wheel does. And I am very pleased with this. I hope it's not an illusion because I feel that the labor and work really pays off.

Day 47

Today was really the most unproductive day. Because of the problems that were on my mind. I'm glad we talked. What I did during the day. Since there was no task, I generally did a lot of research, anything I came across that I didn't know about PHP and that I could understand. For example, when adding users' passwords to the database, I encrypted it with the password_hash() structure. Then I corrected every part of my code that is used everywhere about the password accordingly. If you ask why you used this, among all the structures; I researched structures such as sha1, sha2, md5, crypt() and many more. I learned that different libraries related to cryptography created with hashing can also be used for PHP. But in the most general sense, since the hash structure contained in md5 or sha1 is much easier to decode, I learned that with today's technology and equipment, something called "salt" is also added to the hash structure. While it is possible to enter or create this manually, for PHP, I found out that password_hash(), which is built-in in PHP, automatically assigns a random salt structure and uses it. And since it is one of the most recommended encryption methods both in the PHP manual and on different sites, I used it. At first, I thought that it would be much more secure if I used different hash structures together, but I was told that there were damages to this in a few good sources. To tell you the truth, I read about those drawbacks too, but it was a bit up in the air.

For part of the day, I thought I would investigate the MVC structure, but since what I have read and understood about the subject is not complete, I will look at this topic again later and write it nicely.

Another part of the day was trying to use PHP to show the client a photo whose name I had saved in a database and the image itself in a file. I couldn't do it, I tried a little bit, but I'll try again.

Thank you again, even though you didn't really need to, for taking an interest and talking to us in detail about the issues that were on our minds today in the meeting room.

Day 48

In the first part of the day, I looked at hash methods again, and how to show the client the file whose name was added to the database. I completed these, and then I wanted to give myself a task. If the user wants to select a product and add it to the cart, I was going to show the products in the cart with the "mycard.html" file and also look at how to do operations on the total amount and the products in the cart. I searched a little and found a very nice example on the subject. It was an example where operations were done in a class-object structure. While I was going to analyze the concept and examine that example, I was given a new task. I thought a lot about what to do next. I rearranged the header I made in the previous assignments because I didn't like it very much. Again, I didn't feel completely comfortable with it, but I think it's enough for now. Tomorrow I want to enter the content section and get the main concept of the html and CSS parts. So I can rearrange the parts I don't like. After creating a skeleton, and if the design looks good, I will leave adding something with JavaScript for the next day. In short, my biggest goal tomorrow is to create the skeleton of the structure I want in general. Then making improvements on that skeleton.

I spent today looking at how to do design in general and how it's done on different websites. I was surprised that Amazon, the world's largest e-commerce site, may have a good design, but the content is too complicated. Both amazon.com and amazon.com.tr feel like they are now eating bread from pr, credibility and recognition. My favorite design on different sites was obviously hepsiburada's. But what trendyol did in some places was also good. Obviously, it is obvious that it is necessary to appeal to the general user base. Rather than achieving perfectionism with an artistic approach, I should actually understand how the user will comfortably "shop with us" and will not have any difficulty.

That's all for today.

Day 49

I only tried to make two carousels today. The first one worked because it was just directional arrows, bookmark style dots on the bottom and of course photos. But the second one, I wanted to try something different. I had never made a draggable carousel, so I tried it this time. Did it work? Partially yes, but it still doesn't work completely. Because of time constraints, I'll leave it there for now and do the rest of your page.

Briefly what was done today: With the first hull, I wanted to show current and interesting products, brands, or what we wanted to list. With the second hull, I thought we could show the user discounted and popular products. And finally, I created a 'div' with only the logos of the brands. I wanted to list the most popular, the most profitable, the most trending, or the most frequently searched brands by the user, even if there are no transitions or other features.

What will be done tomorrow?

I will add filter tools like category, price, brand and then of course our products. Since we have learned many things and Google provides a huge resource, I will try to design something simple so that I don't get even more confused while I get different answers to the question of what kind of design it should be. After creating the most basic skeleton, I will try to make additions and corrections.

Day 50

Today I finished the design of the parts for filtering the products. Small problems in some places took me a lot of time, but at the end of the day I was personally satisfied with the result. I used the flex structure almost everywhere I needed to use it. In some places I had to use the 'position' attribute. I created the skeleton of one of the "cards" where the products are shown. Tomorrow I want to go over it and collect the whole image and everything that is missing. Even though I struggled a lot with the carousel yesterday and didn't get the result I wanted, today's parts were easier and finished faster.

JavaScript was used only in one place in the design of the filtering part. Obviously, I took copy paste because it was too complicated, but I can say that all the rest is my own labor. I rewrote the header part the first day I was given the task. But I will create the footer part with the code I wrote in the past. There may be a lot of unnecessary details in that part because it was one of our first CSS HTML examples. If I can find the opportunity, I will fix it, but my priority is the part that is actually requested from us.