Tumgik
Text
Us making a microwave meal
Son: I knew it! Staring at the timer makes it go faster!
Me: no it doesn’t, looking at it won’t make it go faster or slower
Son: ... your wrong! Dad, just look!
0 notes
Text
Automatic vs. Manual Code
I was working on some code the other day, when i noticed an interesting pattern when designing class implementation.  From what i can tell, there are 3 types, Automatic, Manual, and a mix of the two.
Automatic Classes are very autonomous.  The idea is that only the constructor methods are public while everything else is private and handled internally.  The class registers itself to the events it needs to operate on (available in the objects passed into it through the constructor call) and it will act accordingly as they are fired.  The main component of automatic classes is that they require no method calls to the object itself.  Once its initialized, it just works. 
A good example of an automatic class would be when designing a dragging feature of a square on the screen.  When designing this feature, you have to register to three key events, mouse down, mouse move, mouse up.  Originally i had the window class register itself to all three with a specific event handler call, which is great and it works, but i did find it annoying having to see those three methods every time i had to work with the class (the class got big and those along with a bunch of other methods got in the way).  So since those three methods are concise and can operate away from the class, i figured, why not put them in their own class.  Originally, all i did was move the event handlers, which meant i still had to register them form the window class.  After moving the registration to the new class, i realized there’s no real need to have any method be public other than the constructor.  I would initialize the object, and the feature would just work.
Manual Classes don’t do anything.  They essentially need to be told what to do.  A good example of this would be the Linked List class.  Yes this object solves a specific problem, and yes it can be incredibly useful, but it can’t do anything on its own.  It needs to be told to add a child, told to remove a child, told to really do anything.  Because of this, when handling the object, you have to take a more manual approach and tell it what to do every single time you use it.
I’m still in the process of researching this approach of coding classes.  From what i can tell, manual classes are better suited for internal roles that help the developer code faster like the standard abstract data types, while Automatic classes seem to be better suited for accomplishing a certain feature that will be available in the program for the user.  It also seems that automatic classes use manual classes to accomplish their task.
I’m a little confused as to any available use of the mixed type of the two.  i don’t know if this is an actual good class implementation, or a class that is waiting to be split into two, each being an automatic class and the other being manual.
3 notes · View notes
Photo
Tumblr media
I managed to find an example query to show you.  the top is the old way of querying a table that has a column and matching value.  the bottom is the new way of querying the same information.
I also included a brief description of the changes line by line.
0 notes
Text
From the Bottom, Now we’re Here!
2 Weeks! Its taken 2 weeks to re-write my SQLite framework dll.  I honestly thought it had taken longer for some reason... but then again, in general, things that suck always feel like they take forever.  Anyways, I have now successfully re-created the framework, and not only that, I managed to rewrite everything to get me to the point where I was with my original code.   
The framework has some nifty features.  The table aliases are handled by the table now instead of a separate class, the query class can display the query text before it is ran, and probably the most important is that each table has the opportunity to implement the Record class, which essentially handles all the database calls in a general way.
For example, remember when I was all “okay let’s create a table interface for the database and call it ‘stored procedure’ that just reads from the database... never mind, scratch that... lets create a more generic one and call it ‘DatabaseInterface’ that handles reads  *and writes*, haha, MAN i’m smart!... crap... what about updates and deletes... and I have to create one for each flipping table...”
Well... the Record class essentially fixes all of this.  it provides a general way for you to read from a table with a general read query where if a column specified matches the value specified, the records for that table are returned.  the query returns a DataTable class that the Record class can interpret, instantiate a new Record class of the calling table, and insert the values into the table object itself.  this way the table class also doubles up as a basic model for the record.  Why is this cool?  Having this setup also eliminates having to create a corresponding model for each table, take that brain!  I outsmarted you.  Lastly, if the generic read query isn’t enough, the Record class also exposes a Read query that lets you run your own custom query (provided that it returns only *that* table’s fields).
The Write took a little bit of debugging, but it writes what the table class (which acts as a model for the record) contains into the database.  this works the same for Update and Delete.  What does this mean, you may ask?  it means that if you have a table, and you implement the Record class, all you essentially have to do is expose the methods, and your table (/model) can now read, write, delete, and update itself.
How. Cool. Is. That. (Mic-Drops)
I think these 2 weeks were well worth it.  Every class I essentially define can read, write, delete, and update itself right out of the box.  I really wanted to show you the difference in code between the old way of querying and the new way of querying (because they are *that* different and the new way is much cleaner) but I deleted all the old code before I thought to show you :[
0 notes
Text
6 Layers of Abstraction
So... After a while I started getting lost, literally lost in my code. I found myself not know what class was in charge of what and how they were suppose to be organized so they could call each other. I've worked on plenty of complex projects before, but this is the first time my focus was to organize the classes in a clear manner. Which... I thought was ironic since I've never felt completely lost in my code before. But, at this point I did the only thing I could think of, I drew out my class organization. Turns out the reason I was getting lost was because there are currently 6 layers of abstraction. First is my SQLite framework, then the database, third is the database interfaces, fourth are the models, fifth are the viewmodels, and finally, sixth are the UI Windows and pages. Now that I've drawn then out, I feel like I have a map of where everything goes, so in the event that I ever feel lost again, I can look at that map and remember which layer I'm on, and what that layer is responsible for. It sounds stupid, but it's help implement some features because I know I have to touch each layer in order to load and display the information correctly.
1 note · View note
Text
SQLite Framework!
i’m happy to report that I had some time to work on the milestone project this week.  i’m talking about 2, 8 hour days worth of work, and boy did those hours go by fast!
There are two things I want to mention.  As I work on this project, I am also working on an SQLite framework.  The idea is to make accessing the database easier, which I think is worth exploring.  unfortunetly, this does mean that when I find a better way to do things, or when I try something for a while and end up realizing its not the best way to accomplish the task, I re-write a portion of the application.  this, obviously, delays the project, but I like to think of it as an investment for future applications.
So here’s what I rewrote, I have the database and the tables as objects already in place.  My problem is, I didn’t know where to handle the database calls to populate the model’s information.  So I created a StoredProcedure abstract class that is basically a query that accepts inputs and returns a datatable as a result.  This worked fine until it got me thinking... where is this Stored Procedure supposed to be called?  And not just that, Stored Procedure reads data from the database, how am I suppose to write to the database, and where is that code going to be housed and called?
What i had so far were just a few Stored Procedure classes (really it was like 8) that were being called by their respective Models.  This meant that the model had knowledge of how the database operated.  now since i’m still learning how to separate concerns, I knew this was bad, but I didn't know a good solution. 
I decided to draw it out.  I had the stored procedure in one hand, and the model in the middle, and the save procedures (that's what I started calling the write-to-database classes) on the left.  Now if I could just marry the two cleanly, this could work, right?
Not exactly :[ 
so I came up with a database interface abstract class, that essentially replaced both stored procedures and save procedures.  what this class does is handle the go-betweens of the database data and the models. which meant I had to re-write and move the functionality over to the new class.
It worked beautifully.
The second thing i want to talk about is the centralization of the database calls and how they populated the models.  After about 4 database interface classes deep, I noticed something...  the queries used to read from the database are really reading from EXACTLY one table with EXACTLY one where condition that checks EXACTLY one column that matches EXACTLY one value.  Since this pattern emerged 4 times in my 4 classes (all my classes, really)  I think it really would be worth exploring the concept of a common query,  that returns the entire table’s columns when one of its columns matches a certain value. 
I already have a few common queries in my SQLite framework, some are used as default data inserts for debugging.  But, I think this one would be a nice addition to the set.  Since all 4 essentially follow the pattern above, I can create simple database interfaces quicker with this new common query in place.
That will be my next task.  i’ll let you know how it worked.
0 notes
Text
its *INTEGER* PRIMARY KEY
I have shed blood, sweat, and tears trying to figure out this incredibly simple problem: why is the ROWID not being populated in my database.
So what happened was... if a table’s column is set as INTEGER PRIMARY KEY, then that column becomes an alias for its ROWID, which acts like a unique id for each column, which I need.  everyone knows this... apparently, because everywhere I looked, everyone parroted this back to me like I somehow wasn’t getting it.  my stupid column was INT PRIMARY KEY for flip sake, why isn’t this piece of SHIT WORKING!
Then I stumbled across a stack overflow post where some other poor idiot had the same problem as me, YAY!  I say yay because I had searched for a while now, and kept finding parrots.  the kind man who knew the answer said to explicitly say INTEGER PRIMARY KEY, not INT PRIMARY KEY.  what kind of stupid suggestion was that?  its leviOsa, not leviosAR? what an idiot
it worked.
It worked... I'm so tired and frustrated, I almost don’t have the energy to be happy that this piece of shit finally works.  now I can continue with the project.  its been close to two weeks I haven’t made progress because I couldn’t figure out what this stupid database needed to give me a unique rowid.
I should have some actual progress made soon.
0 notes
Text
Back To The Database
Okay, so remember how I was all “yeah I did it! the set up is complete, I just need to create the classes! I totally rock! WOO!”
I was wrong...
there are still some initial setups i need to create that I just ran into...  so the first thing in the application that you are suppose to see, after you log in, are your active tickets... well... I have to add test tickets to the damn database...
then on top of that, I have to make sure I only get active tickets... which, after a few minutes of soul searching, i realized would take a completely new table i flipping missed.  this new table, called AssigneeStatusCodes, will keep track of which codes are for the assignee statuses along with whether they are active or not.  this should let me filter out which tickets the user is working on, and which ones he isn’t.
But wait! There’s more! :[
each ticket keeps track of multiple lists, for example a category list, a point of contact list, an assignee list which also keeps lists inside that like assignee status list and assignee milestones lists.
what does this mean?  it means I'm boned.  i can’t return all of this information in one query, otherwise i’m going to end up in a cartesian product mess.  so i’m going to have to query these lists one at a time... which... will impact performance on the queries...
hopefully not too much... but idk, right now i’m using SQLite, so i’m expecting it to be a hit, but hopefully a proper sql database can handle the multiple hits per ticket.
now that i think about it... maybe it can hit the list once! i mean... it doesn’t have to hit the list once per ticket, what if i get a list of all tickets i’m looking for, and hit the list so i get the results of all of them in one shot, i’ll just have to sort through them in code, which is fine, i’ll have to do that anyways!
hmm...  i think I've taken enough steps for today
0 notes
Text
I forgot something :[
So I thought I had done everything I needed to do with the damn log in screen. The cancel button works, the OK button takes you to the main window. The default focus is the username text box, if you hit enter, the application attempts to log you in. Everything sounds accounted for, right? Nope :[ I just realized that everybody can still see your password. I'm not masking the text to show •••••• when you type your super secret password :[ it's plain as day for prying eyes to pry over it. I hope I can get some sleep after shaming my family with this huge oversight. Hopefully I won't have to commit sudoku. I've been thinking. Issue ticket system sounds too... Limiting. Like this is only for when things mess up. I think it would be better if it tracks work being completed, not issues. So say for instance that you want some work done, but it's not an issue. That doesn't really belong in this 'issue ticket system'. Issue ticket system sounds more reactive, like you do stuff based on something that happened. What if you want to do something proactive? So I'm changing this from an issue ticket system to a work ticket system to track progress and deadlines. Same thing really, but now it's about work, not issues.
0 notes
Photo
Tumblr media
LOGIN COMPLETE.
Mostly...  the cancel button doesn’t work and the ok button doesn’t really take you anywhere... a-and the password text box doesn’t hide the password...
BUT!  this actually does some very important things.  First, this piece uses my SQLite classes that I created to help me create queries using objects.  This means that they work.  The classes help me create the database and the tables I need.  The cool part is that if I need to modify the tables, I can just add or delete a column, and the changes are automatically reflected.  I even added an option to allow you to populate the table with dummy data.  So to make sure that I was able to read from the database, I added dummy data and was able to successfully “log in” and successfully “not log in” with valid and invalid credentials.  Pretty shweeat!
This means that going forward, talking to the database (which is arguably more or less about half of this application’s logic) is going to be a lot easier.  now that this is complete.  next up is the overview window.
SUPER EXCITED!
0 notes
Photo
Tumblr media
Here’s another step.  This is the new entity model for the program.  I think it makes sense that the first thing the application will do when you launch it, is load all the tickets that are currently active.  The idea is that the model and the MVVM will load the information once.  then the window will determine how to display the information.
I’m working on the windows right now, so hopefully I should have something to work with next time.  I'm creating the databases in sql so that individuals can track it, but I'm hoping to expand it to a full sql server.
quick post, but I don’t have much time, I'm putting in some work tonight
0 notes
Photo
Tumblr media Tumblr media
Taking another step today.  I know its been a while, but life keeps happening and I have to sacrifice sleep for this project.  and lord knows, I love my sleep.
anywhoozies, i focused on coding today.  i learned i little bit about wpf and how the framework handles windows and pages, pretty nifty stuff.  I also incorporated some old code i worked on for the groceries app i had in mind.  the code allows me to talk to the database, which will be internal.  this means that there won’t be some server running taking request, the database will be housed within the application itself.  I'm using SQLite to accomplish this, its a tool that some geeks developed to embed a database like file into the application.  you can see the classes in the picture.
The classes i created allow me to create queries through objects in c#.  meaning instead of creating the queries in plain text, i have a Query class that i instanciate, which holds a list of QueryItems.  Those QueryItems are things like the Query Clauses (Select, From, Where keywords), Tables and Columns, Joins and Conditions.  i’ll have to show you an example in a later post (when i make one) so you can get a better idea.
The information i want to capture can be summed up in a few tables.  to be honest, i thought i was going to have a lot more tables... but... idk, i feel like I'm either missing something critical, or this application isn’t as ambitious as i thought.
oh well, we’ll see how what happens.  if anything this means ill finish sooner, which means i can add extra features people might need.  for example, i just realized today that i will need a few configuration windows which will allow users to add other users into the system.  maybe incorporate a wheel to fairly assign work to individual in a group like developers or the server team.
0 notes
Photo
Tumblr media
I didn't have enough time to create the Assignee window, I could only build the summary in the 40~ minutes I had today.  Working on this made me think of how a user will move from one ticket to another... and what happens when a user needs to view a closed ticket... and active tickets...
So, after today, I realized I have to think of more information i need to display, how to move between tickets and how to categorize them.
for some unrelated reasons, i couldn't take a step in the last two days.  the first day i spent the evening with my wife, and yesterday my little boy wouldn't go to sleep, but today, i sacrificed some sleep so i can take a step.  hopefully i can start to make this window useful this week. 
tomorrow, i want to focus on how to categorize and move between tickets
0 notes
Photo
Tumblr media Tumblr media
Another day, another step.  planning is... not always the funnest part of projects, at least for me, but I think I can change that around.  planning, now, has let me dream what I want this software to accomplish, and after an hour or two, I came up with something I'm happy with.
This, hopefully, is what the program should more or less look like.  Theres two windows for now, but I'm hoping to add more.  The summary page will give you a quick look at the status of the ticket, while the assignee page will give the assignee more control over his/her tasks and ability to plan and track their progress.
I believe this captures more or less the information that I wanted to capture in yesterday’s post, and I like how the information is being displayed.  I’m getting excited, taking daily steps and setting small obtainable daily goals is starting to fill me up with a sense of accomplishment.  I mean... its not a lot, but it is something, and it will do for now.
to be honest, I'm not sure if I should start coding tomorrow, or if I should plan out some more stuff.  half of me wants to move to code, while the other half... is a little scared to move forward and instead wants to waste its time making more plans it’ll be scared to execute.  writing this out has helped me decide, I will move to code.
Now that that is out of the way... I don’t know what to work on first... the database or the UI...  designing the database feels like I'm backing out of the coding decision I just made, but on the other hand, the program won’t work without a database...  I think I will work on the UI first.  Something incredibly simple, to start with, and as I add features, I will add the necessary tables to accomplish them to the database.  hopefully, with this method, I can always have a semi-working build that can do *something*.
Tomorrow will be a real test on my will to take steps forward.  I think the research and trial and error of software is what has been killing my will to take a step forward.  Since I only get about and hour or two a day to, in a sense, do as much as I can, spending them researching and creating trial and error apps makes me feel like I'm wasting my time.  I know this is an essential part of software development that I will have to get comfortable with if I am to success in this project, I just hope that when those days occur, I can convince myself that spending time learning how to do something is just as important as actually doing that something.
0 notes
Text
version two
idk if this is common, but... I tend to not finish my projects....  I've started soo many and finished too few that... i can’t remember the last one ive finished...
i don’t know what will be different this time.  maybe its because im fed up with myself being such a flake, maybe its because my dad has cancer, maybe its because im genuinely angry at myself.
whatever the reason, im choosing to comit.  each day will be a step, be it forwards or backwards, either way, im going to be taking one.  Today, i worked on what kind of information the issue tracking system will capture.  to help you read my madness, think of a “list” as containers that lead to other lists or units, while “units” are like dead ends where there is nothing else that needs to be defined, and “each” is what defines a list.
point of contacts list defined reported by unit ticket number unit ticket name unit assigned list defined description of problem unit resolution list derived from milestones status list derived from assigned status in chronological list derived from assigned
assigned each person unit milestones list defined deadline unit derived from milestones? status list defined
milestone each name unit description unit end date unit resolution unit resolution date unit effort put in list defined
effort put in each start datetime unit end datetime unit
status each status type unit status date unit notes unit
point of contacts each name unit location unit email unit phone unit title unit
0 notes
Text
Hello World!
to quote GladOS: Its been a looooong time.
Its good to be back and vomiting all of my thoughts through this keyboard in an attempt to release the pressure of words that's been building in my brain that makes me, at times, feel like ill explode!
Come, friend, and together we’ll explore the wonderful world of programming.  Here, where mere 0s and 1s, addition and memory swapping helped revolutionize the world.
I have 3 projects that I want to tackle first in C#.  First an issue ticket system where people can request for work to be done, and other people fix them.  The second is something I've been wanting for a while, which will help people create grocery lists.  Third is a general expert system, that will allow users to enter questions, answers, and the paths to put users through.  This one is kind of exciting, the idea is that everybody can create their own expert system.
I do have other projects I want to work on, like a Microsoft Office Visio clone that focuses on stencil creation, and a math tutor program that should help students with their math skills.  These, though, feel a lot more ambitious, so we will byte through these later.
Of course, all of these will be free and available to the public once they are done.  feel free to use them when theyre done, but for now, help me make them a reality.
till next time
0 notes