Tuesday, 23 October 2018

WPF and why it kinda suits me

When I first started up a new WPF Project I sorta panicked. This was strange and new and I didn't like it! It had more than one window and there was text and sliders and tabs and oh my god noooooooo! Fear of the new is strong with this one! Once I calmed down and actually got to explore the program a little, it turns out it's not that different from when you make a console program. Sure it has fancy tabs and toolboxes on the sides, but they're actually helpful.

After exploring the layout and buttons a bit more and after checking the code section of it all I.....I have a confession to make. I actually like it! While you're working on a console program, it is quite important where your code is placed as the program generally reads the code from top to bottom. And while WPF follows the same principle, it still works a bit differently. See, the big different between console apps and WPF apps is that WPF actually has a sorta proper user interface. With buttons and textboxes and labels and things that make it all look nice and pretty. I'll show you!


This is what a console application looks like while it's running. It's a black window with a little bit of text in it (provided you have coded the text. At the same time a WPF application may look like this (ignore the warning at the bottom, I fixed it!):


I don't know about other people, but I am a visual person. I like seeing what I'm doing and what I can do. This app is already more user friendly than the console in that it has buttons for people to press, sliders to pull and boxes to type in.

This also makes it a bit different to code. Like I mentioned earlier, in a console app you kinda want to code from top to bottom, in the order you want the program to execute the code in. There are ways to jump from code bit to code bit but from what I've heard, that's a bit of a no-no coding practice. However, with a WPF app, you only have to code the bits you use, and only the ones that are actually going to do something. Well... the truth is a bit more complex than that, you DO actually have to add codes that run when the program runs but let's just ignore that for now (because this is more convenient for me 😜)!

So what are the things that do something in the program I showed you above? It's the buttons, the sliders and the tiny box with a line around it above that one button. There are also hidden boxes that show text only at certain points. This means that when you're programming those things that actually DO something, you can focus solely on that task, almost without a need to worry for anything around those things. Take for example the Exit button. That button is connected to nothing else, but when you click it, it closes the program. That means that the code for that button can be almost anywhere in the.....uuh.....code window thingie. You could put it at the top as the first coding you do, or you can put it closer to the bottom or smack dab in the middle and it would make no difference to the program, it would still work. THAT is what I like about programming in WPF! I can focus on one thing and connect the pieces with one another. And I can easily pre-plan what the program is going to look like, how many buttons and trinkets I need to put into it to make it work like it is supposed to. It's like a piece of puzzle that doesn't just break because somewhere along the line you did something unrelatedly silly or you accidentally deleted a piece of code. Well....I mean....it DOES break but not EVERYTHING breaks. If I did something wrong with HELP button, the Close button would still work.

The challenge in WPF lies in how to connect all the pieces together. And it's easier to visualize which pieces belong to which pieces, which buttons affect which text boxes and so on. And having different parts of the programming code be in different tabs makes it so much easier to find it too. And the fact that you can sorta sort the code however you please is an added bonus to a person like me who sorta likes the saying "A place for everything and everything in its place" (but who doesn't actually practice what she preaches when it comes to her own home😅).

Anyway, that's my impression of making a WPF app. The coding itself isn't any easier as you still gotta know the language, but the way you code it is nicer.

Monday, 15 October 2018

Depression

I notice I haven't written anything in over a month. That's not how it was supposed to go, I was supposed to write something at least once a week. However, for a while now I've been feeling both happy and sad, but mostly I've just been out of energy. It has all culminated into today (starting with yesterday really). 

For a few weeks now I've been sleeping a lot. Almost all day, every day. I'm so tired, I just want to continue sleeping. Even now I find it hard to find the energy to even write this. I find it hard to press down my fingers on the keys because it's just so much effort. I try to smile and laugh and pretend to be happy when I'm with other people. And part of it is genuine, I DO feel happier when I can take my mind off.....whatever this is. But not today. Today I just want to go back to bed.

I've started to lag behind in my studies. I'm lucky that the things we do aren't that difficult yet, so I've been able to rush the assignments and still understand at least some of it. But I am not prepared for tomorrows lessons. I don't even know if I can find the energy TO prepare. 

I need to get back on track, I need to get my energy and enthusiasm about programming back. I need to find that spark again, the onethat made me stay up late, thinking about all the things I wanted to make. C'mooon Jess, pull yourself together! Sigh......