CSE 143 Week 4

This week we went over Binary search capacity, Maps and more Maps.

One of my favorite parts of this section is the infinite nature of Maps and Sets. They are endless. And we can taxonimize basically everything using a combination of them. This type of organization is in line with how my mind works. And I like things that work like my mind.

We start the week by going over binary search. Whereby we start by guessing the middle value of any set of numbers, and then move into the middle of whatever set is correct etc etc. Faster than a linear search where we are moving down values one by one.

We cover “complexity” which is a different meaning in computer science land than in. say, relationships.  Where as in relationships “it’s complex” usually means things are not coming to fruition in any societally determined meaningful way, complexity infers that the code or algorithm does compute and it is simply a matter of how much time and space(memory) is necessary for that. Generally, complexity is a trade-off. Instead of the choose 3 of quality, time, and money computer scientists are given a choose 1 of time or space.  Perhaps it is because quality is not a variable as all code must execute.

As per societal constructs, time is the number one resource. There is however an issue in focusing on time, and that is that the optimization of time becomes paramount. How much is sacrificed to shave off smaller and smaller pieces of execution time? It is important to remember if they are worth it. Don’t focus so much on optimizing a solution that you forget to look for a different one.

We discuss complexity classes, which is a little math classy for my background. And we move into the interesting problem of a moving sum. Whereby we move along an ArrayIntList, finding the max within it. blah blah blah eliminate the inner loop by keeping a running sum. Basically, we keep track of each start and each ending point. And are able to move through these totals in a way that preserves the max.

A further complexity is to have some concept that disregards certain sums, that keeps us from computing everything or spending time on those things we know will not add up. We are storing the max sum for the starting value in the node that contains the starting value itself.

We are getting into some more mathy stuff.

And we are back into the original program. The best creation being a loop that generates each possible starting point and each possible stopping point, then adding up each of those numbers and comparing the sum.

Having the initial answer, how do we make this faster? We keep a running sum, that eliminates the need to recreate the loop each time. Here we move the initialization of sum from the inner loop to the outer loop, so that the work we have already completed is not forgotten. Searching for a parallel in real life for this- I can’t say I can think of any one. Maybe something about compounding interest? Instead of going off the original amount and adding interest and the original amount each time, we are using the compounded interest to create a running sum of the original amount and adding to that.

Basically, we are seeing if it is better to include previous values or start with the number we are on.

Moving back into what is most executed and how that maps onto the algorithms that were brought up, and how those algorithms affect the time it takes to run the code.

Next we are into Maps – this was unbelievably convenient for me. As the second phase of the Ada Challenge happened this week, and it involved maps and keys, otherwise know as Hash sets in ruby.

A map is a built-in collection class that keeps track of key/value pairs. A map has one value for any given key, this is one of the things I find interesting about Java. We make it more like real life by changing how a map is constructed, by assigning sets to the map. For some reason this rings very true with me, and it is one of the more interesting and memorable strategies I have learned so far.

Maps will only remember the most recent association with a Key. Looking at a large file and creating a map that looks at the values and finds unique ones. We start by simply creating a set, and being able to look at the size of the set.

Next we add the set to a Map  that allows us to count the number of unique identifiers. Thinking over this set, I would immediately try to create another field that measures the number of words and adds 1 to each line. Like 1:unique identifier, 2:unique identifier.

But this is overly complicated for what is necessary for the code. It will be able to get size returned, and it is not necessary for each entry to be tracked in a count. Additionally if the size was changed, or new values were placed in the middle the entire count would need to be updated, again unnecessarily complicated.

One of the hardest things for me to grasp is the different vocabulary in computer science. It seems much more abstract than labeling things, as we have objects interacting with each other in a very 1 D space, but you need to be able to conceptualize them in a way that is 3D. What is an interface, what is a constructor, what is an object and how do they interact. We are basically creating scenes in our codes that work a certain way within the code, but cannot be separated from the original context, or they mean something else entirely.

Going over map stuff we learn some concepts like put and ContainsKey, how to update for new values and add to the count of old ones. Running for each loops and the kinds of associations that are available for maps.

Next we bring in the concept of a SortedMap, whereby keys need to be sorted.

Going over a sample program, we discuss how we want to label the keys in the map to be the thing we are looking for. Then use that to return the relationships to the other elements in the Map. We speak in a more detailed manner about the objects within the Map, how they interact and what they contain. It is definitely a new way to think about storing data. We normally just take data storage for granted. If we have  a folder that contains folders, it is the same as having a folder that contains files from a high level view. But when we are creating these systems, we need to think about folders and files in terms of muliplicity. Which is a new concept for me. It isn’t 1 item to 1 item. It is Contains 5 items to contains 3 items or Contains 5 items to contains 1 file. Then next we bring in bi directional relationships in this same context, and how to create a program that holds onto those relationships.

Finally, we cover String Manipulation, a check back to CSE 142. Fence post problems specifically. We go back to Mapping and cover the addAll function which allows us to add all elements to another set, and updating the Map to reflect new data that has been taken in.  And how to keep track of old data, and issues with repetition.

 

This blog post was informed by reading and lecture notes from UW CSE 143, Autumn 2017. 

 

 

 

 

 

 

CSE 143 Week 3

This week we talked about Linked Lists, Linked Sets and Loops and more linked lists.

Many lists, many links. This week we discussed nodes and moving around the different nodes. This was something that I found interesting to me, as it seems in line with some of the more basic concepts of block chain technology.

This class was much more challenging for me. And I think one of the main reasons is the size,  while over the summer, it was likely that you would be working with the same TA more than once, so far it seems like I am working with very different TA’s all the time. It’s hard to grasp how to learn from so many different people in any meaningful way.

If I could go back I would be better about doing the labs quicker, and working on my code in the lab when I knew fewer people would be around. Like taking a computer class over the summer it was challenging giving up things like socializing or enjoying the end of the summer to sit in front of a screen, but I’ve learned some great time management techniques as a result.

In studying array nodes, we are learning that arrays are random access data sets. Easy to access any point in the array. Linked Lists on the other hand are sequential, we are moving from one item to the next, never out of order.

If we can get to the value that stores 0 in it, we can get to every other value in the list. Eventually, we can write loops that manipulate the lists,   like the loops we write that move through arrays, or other data sets. Looking forward I am curious how this will incorporate into maps. How we will write loops that manipulate maps.

We still go over the concept of constructors. “A constructor in Java is a block of code similar to a method that’s called when an instance of an object is created. Here are the key differences between a constructor and a method: A constructor doesn’t have a return type. The name of the constructor must be the same as the name of the class.”

https://www.google.com/search?q=what+is+a+constructor+java&oq=what+is+a+constructor+java&aqs=chrome..69i57j0l5.2910j0j7&sourceid=chrome&ie=UTF-8

Going over the same terminology over and over is starting to help me conceptualize it.

A constructor is a block of code like a method, so you call it do something. Specifically when you are creating an object. However it has no return type.  It’s just like an outfit for the object. The object wants to go scuba diving, the constructor holds it’s oxygen tanks.

We move into moving around blocks of data sequentially, one to the next.

Next we have a list of Nodes that we want to move around. Obviously, a loop is appropriate here, as we do not know how many nodes we are going to be moving through and the idea of .next.next.next.next.next and the additional issue of having to count all the Nodes. Counting, is to be avoided, whenever necessary.

We structure a loop that avoids this pitfall of counting, one that keeps going until there is nothing left.  This of course is a whole new era of issues, especially if we can measure things by smaller and smaller amounts, than we can see that we will never have nothing left. That issue is out of the scope of this, but something to keep in mind.

Next we cover using for loops for nodes and their basic structure. While vs. for loops personal taste for lists.

We talk about LinkedIntList, which is a new class similar to the ArrayIntList. Two classses- one for individual nodes of a list and one for the list itself. While the list object must we well encapsualted, the node class doesn’t have to be as much.

Likening this to ways vs. means when you are only experiencing the consequence of the ways. If things are complicated and messy, it’s fine as long as at the top level you view things as complete and the top level is not interefered with. An interesting crossover of corporate culture into node creation. Of course this asks the bigger question of what is the point of keeping things clean if a client is never going to see them.
The easy answer being it makes you feel better as a person. But the client is not here for you to feel better as a person, nor do they understand then clean vs. messy way of doing things. You understand that because you have taken on the protocol of learning how to do things well, albeit possibly only for yourself. It is here that this conversation starts to become confusing. If we are doing things only for ourselves, are we not doing them selfishly. Is it not more community minded to do things in a way that will connect with others and give them what they want – whether or not that means doing it in a way that is “cleaner” or is it that the cleaner or messier way simply does not matter, and that connecting with client is a different scenario with different rules neccessitating the recognition of a different space and scenario. Are we getting caught up with ourselves in  a space that has literally nothing to do with the end point. The end point being a differeng game, chapter entirely. And are we simply expected to effortlessly move between the two spaces and recognize the important factors that create success in each one, and meet both of them? Or give up space in one area so that the other can feature more prominently? Yes.

 

There are only 2 ways to change the contents of a list:

change value of the front, change the value of something that is already in the list(allowing us to follow a different path than before)

By doing this we are changing the value of the final ListNode by adding to it, adding a new list node to the end.

For the end of this week, we covered LinkedIntList that stored a list of ints. The constructor constructs a null list, setting a field called front to null. We add to this LinkedIntList in a two-step process, constructing a Node using the old value of front, and then link the Node by changing the value of the front. Here we are stacking Nodes in a similar way that we stack values in a queue.

The above is all a constructor for LinkedIntList, an object that fits the LinkedIntList to let it do something, but has no return type. This constructor is fitting the LinkedIntList to create itself, without requiring it to return anything.

Now that we have a constructor for the LinkedIntList, and a LinkedIntList itself we can start changing and adapting the LinkedIntList.

This is interesting when working on these programs before reading over the notes, I was trying to create a previous cell that would keep track of the node before we wanted to do something with it. Of course, all we need to do is check the value of something that is already in the list, and read ahead so that we can work with the value before the one we want to work with.

In this part of undertanding things start to get a it murky for me- mostly I need to remember that we are both creating a new ListNode and contextualizing it within the existing structure.

We talk about the special cases we encounter with Array Int List and how we embed those in different loops to work. For changing values in the list we utilize our loops to encompass the different special cases. An if loop handles an empty list and an addition at the front of the list. A while loop handles an addition to the back or middle of the list.

Self-Care

This post is going to be about self care.

I worked on and completed my Ada application. I am so glad that I took the course over the summer, it gave me a head start on the concepts used in the challenge. Also looking over the suggested reading and exercises (surprise, surprise) enabled me to start the challenge in a way that I didn’t feel completely lost.

Now I am going to put it all away for a few hours, and re visit it again later.

 

For this challenge I put aside my CSE 143 class for  a weekend. It was a great weekend. But I still missed the challenge of working with a seemingly impossible code. Getting into week four now of my class, and I feel like I am hitting my stride in a way. It is clear how to study, and what to study.

For the first few weeks, I read and worked the problems off the reading. Going over the assignments with friends, I realized that going over the labs was much more important. Literally reading them out loud and deciphering what each piece of the program did and why it did it. What other pieces were pulled in where, and how they interacted gave me a better understanding.

Working on the Ada challenge, I closed my eyes and visualized the problem in 2D, in 3D and went back and worked and found it to move very quickly past that point. Stopping, stepping aside and letting the program work itself out in my mind changed how I was perceiving it.

I didn’t feel like a quilter, sewing things together and taking scraps of fabric and pushing to bind them together in the way that I thought made sense. I didn’t feel like a mechanic, coming across something already constructed and trying to re do it. It felt different, almost like when I am writing songs and pieces float up and then suddenly they work together in something beyond the 3rd dimension.

Taking time off from coding also helped me come to terms with the struggle I am experiencing in my class. How little of it has to do with the coding itself, and how much more of it has to do with communication, and being willing to both keep lines of communication open and not be shy about changing what communication is happening.

In some ways I feel like an tech illiterate learning email for the first time. In others I get excited about how the concepts play out in the things I am interested in real life. I made a promise to myself that we are going to stay focused on keeping communication open, on being patient with myself around learning the concepts, about not getting hung up on how I think things should piece together, or what mind models I am bringing in. That seems very important to the spirit of the class.

Taking time to sit in silence and not constantly push myself over the edge, like jamming a button over and over in the hopes that a door will finally open.  I’ve heard of those experiments where rats push a button over and over, until finally a treat emerges. Those experiments talk of how the two things are not actually cause and effect but rather linked to a random number of pushes. I want my coding to be real in understanding the button, and the randomness of comprehension.

The fear for me is real, of life, and of anxiety and of the past and of the future. Is it all just a button we push, set to a random value which determines output? If it is, then output is not really the point of it all.

I’ve been doing more energy work, sitting in more silence. And that starts my days differently. It starts my days with something for myself, and the belief that a positive mindset will bring good things my way. That seems far more tangible than a reward, something to focus on for it’s own sake. Whether that is security, or comfort, or forgetfulness I am working to be the creator of the experiment rather than the test subject.

public class groundControl{
   public static void main(String [] args){  
    System.out.println (“And the stars look very different today.”);
   }
}

CSE 143 Week 2

When this course is challenging, and my life is streesful to the point of making me ill, I try to remember how difficult CSE 142 was for me at the time. It took up so much of my time, and I felt like I was drowning for much of it.

I talked with some friends this time, expressing how i feel I’ve kind of hit a wall. In my brain I feel frustrated. It’s like we have the reading and the lab, and the lectures. Then somewhere in between, magically something is supposed to happen and suddenly I will know how to do the homework. Supposedly. My friend told me that this is believeably challenging for me. He described it as a “mental model shift”.  If I knew how it was supposed to happen, obviously I would be there by now. I remind myself that I am taking this class not for credit, for learning. And put forth my best effort to learn it. It is like everyone else in the class already has these concepts in their mind, and even better ones. But I remind myself that when I get these concepts to stick in my mind I will have these concepts, and all the other concepts I have learned, including the ones that made this model challenging. Which is a huge advantage for me going forward. For now just focus on the forward.

This week we covered lists, sets, for-each loop; stacks & queues; arrays of object interfaces.

In some ways I see what we are learning leaning more towards intuitive understanding. “You don’t have to test for the size of the list or to use a call on the get method. Java does that for you when you use a for-each loop.” Here we see Java starting to perform more like our standard concepts of time. We don’t have to set the number of days we lived, or the number of seconds that have gone by since our birth. Time does that for us. It’s a universal variable that we all ascribe to. It helps us measure what by all means is a strange albeit noticeable phenomena in our daily lives. We can see that things change as they move through time and everyone is concerned with holding it still, or finding ways to make it’s affect less prominent. The idea of stopping it entirely, or speed up, or go backwards is illustrated in popular culture in the context of someone who can see it stopping. Someone who can say “it should be like this, but I can observe it moving outside of the way that it should.” So even in sci fi or fantasy depictions of time, we can not escape from it in it’s purest form. It is the only context we have to tell that it is acting aberrant.

We talked about transversing a list with something known as an iterator. Which is simply a tool that we use to read, move along a list, or remove a value from the structure. There is discussion of interfaces, which seem to be the same thing as an iterator. We bring objects into the discussion. To say that we can use interfaces to refer to objects rather than their classes. So we define the objects behavior and properties in the class of the object which we declare in it’s creation. However we do not need t bring the class back in, we can simply reference it in ways of it’s interface. While we could take a tour of object Stadium and learn about how much concrete it took to create it, or how many hours of labor, or how much money was used to create it that is really only necessary when we are building the stadium. Once the stadium is built, it is much more pertinent to discuss the games that are going to be played in it, how many employees will be staffing stadium, how many hours it will be open, and how much electricity it will need to use.

We discussed sets, which don’t allow duplicates, or client control of the order of the elements in it. An iterator can tell us the size of the set, or add or remove from the set(specifically those elements which fit a certain profile). However to do this, we must only talk with the object. We can not  change a collection while iterating over it.  Foreach loops do not work unless they are a “read only” operation. We must ask the iterator to remove any values we would like removed from the list. Why would these be kept separate? Perhaps because the code was written with the idea that the client would be able to access parts of the program, but not the iterator? Kind of like permissions when you share a document with someone. Some people are editors, some are read only and some are administrators. To change something we must access the administrator role. If we access the document as a read only and then try to do something as an administrator  it will not allow it.

However the iterator is not as powerful as the initial structure of the class. It can only work with it.

 

Our reading goes into ArrayLists, the specific conversations necessary with that type to get it to work.

 

 

These notes are derived from the lecture notes for CSE 143, the book Java: A back to basics approach,  and my own notes during lecture for the class. The concept of reference semantics, whereby we can change the current state of the object by simply passing a reference to the object. We talk about common problems with adding and removing from an ArrayList.

Next we go into Collections in the reading. LinkedLists, Hashsets, Treesets, HashMaps and TreeMaps. Tbh these seem kind of redundant and less than useful. Which is covered in lecture. We would like to use these simple structures when we are trying to use the simplest possible solution to a problem.

Once concept that struck me is when modifying the queue but still wanting to maintain it’s integrity. We have to remove values to read them, removing them from the queue. How do we restore the queue? The concept is to use the queue itself to return it to it’s original form. We simply add the values back into the queue. When we are trying to change structure we often simply return values back into it. Otherwise, we would simply slowly fade away as a poem, as a song, as a culture. We use the structure itself to maintain the structure.

And then, since I had the older version of the book, I read the wrong chapter. But in better news, I now know a lot about GUI’s.

 

Reading List 2017

Books I’ve read this year:

Tapscott and Tapscott, Blockchain Revolution

Mullan,  A History of Digital Currency in the United Staes

Samid, Tethered Money: Managing Digitial Currency Transactions

Golumbia, The Politics of Bitcoin: Software as Right-Wing Extremism

Maurer, How would you like to Pay

Reges and Stepp, Java: A Back to Basics Approach

Tamm and Luyet, Radical Collaboration

Damodaran, On Valuation

Leamer, Macroeconomic Patterns and Stories

Soros, The Alchemy of Finance

 

 

Books I read in 2016 :

Galbraith, The Affluent Society

Galbraith, The New Industrial State

Friedman, Free to Choose

Friedman, Capitalism and Freedom

Mankiw, Principles of Macroeconomics

Ariely, Predictably Irrational

Thaler and Sunstein, Nudge

Kahneman, Thinking, Fast and Slow

Heilbroner, The Worldly Philosophers

Dixit and Nalebuff, Thinking Strategically

Mankiw, Principles of Microeconomics

 

CSE 143 Week 1

We started on a Wednesday, two lectures in the first week.

Our topic on Wednesday was the ArrayIntList. A more responsive form than the Array as it can grow and shrink as things are added to it.

During the reading, I was having some difficulty with the concept of a constructor. Many of these concepts seem flimsy when you take a second look at them. Like many sciences science their existence is taken at face value in often abstract terms. Many concepts we take for granted in daily life, and it seems developers like to draw this over into their languages.

If we grow up expecting a cup to be round, and one day we are introduced to a square cup we would find that odd. “Where are the cup?,,,, this is a box”
However in constructed worlds [particularly those created to map the reflection of a human mind] we are expected to take these small differences for granted/ / /” And we do.

We take them for granted because there is a game, or a reality we all want to be involved in. Weather through a language or a program here choice or compulsion we follow the flag posts and mile markers as if they were always true. And we strive to make them true so that we may know our way in this strange world.

I found the greatest connection to understanding the concept of an ArrayIntList was to learn about the reduction in variables. Instead of having many, or creating a new array every time, we could limit ourselves to the one. Additionally we can reclaim the concepts of size (capacity) or the values within the array to be both exclusive and changeable to the ArrayIntList. This efficiency seemed reduced in the new need for pre and post comments, now necessary to each method as we are dealing with a much more flexible data structure, and it’s outcomes and intentions are not always as clear.

The constructor is a special method, with a special syntax that cannot live outside it’s namesake class. _. I can think of several prominent constructors off the top of their heads.

We cover  how to add and remove from the lists.  We scan the lists for values, we manipulate the arrays. I wonder what will happen when AI does take over and computers start using the language to direct our behavior that we use to direct theirs.

Encapsulation is covered. Privacy, limiting access. These concepts are not the same as the concepts we use. Privacy means exclusive to a class, encapsulation means restricting access so that things won’t be disrupted, limiting access….Ok so maybe they are similar. The gated communities, the rollbacks on protections on industries that are controlled by a few players, the accurate belief that access must be limited for things to remain undisturbed. These are concepts we live, and the concepts in the program can only be reflective of their creators.

Friday we cover constructors again. How they relate to each other.

****

it is better style to define this constructor in terms of the other constructor. Most Java classes have one “real” constructor that all the others call. It is most often the constructor that has more parameters than any of the others. You can have one constructor call another by including the keyword this and a set of parameter values inside parentheses, as in:

        public ArrayIntList() {
            this(100);
        }

https://courses.cs.washington.edu/courses/cse143/17au/notes/notes02.html

****

For all of our experiences as humans, there is one experiencing self that calls on the others. We are not the child that was at the beach, or the teenager sneaking out late at night, or the adult out dancing on the weekends. We are this “real” construction of self that contains all experiences of all other constructions of self. The next question being, who is constructing and if it is no one, then yes.

We mention Boolean zen. Which I see as a muted stylistic change from Koans.

In lecture we also discuss stylistic choices, referring directly to fields(more efficient) or by referring to variables (easier to change). The lecture hints at a choice, but it’s one of those which is meant to make you insecure in your choice, insecure in the belief of absolutes.

In our minds when we are understanding the world we filter through information. This is a basic concept that must be believed if we are to accept that computers work due to our own experience and creation of them. Which is to say, there is no way to know for sure.

Of course somethings are necessary to reference as fields. If I have a wife “Imogen” and I view the reference “Imogen” as a direct reference to a variable “Imogen” I will have many wives before the end of the day.  Our relationships must be direct references, to increase our efficiency. This way I do not have to ask “Imogen” what we should do for dinner 50 times, and get a different answer every time. I also know that what we should do for dinner will not change, much like a majority of “Imogen’s” identity, this static knowledge allowing me to bond and grow closer to her in context of  relationships.

If I catch a bus “49” and everyday try to catch the same bus that was the “49” I caught one day, I will be waiting a long time. “49” must be a variable, with many different buses representing the same “49” bus that I need to catch.

Like our lives, programs are subtle. Some pieces of information will need to grow close to us, with our faith in their similarity  no matter what occurs within the code. Some will need to change and only be represented in concept creating a place holder that highlights a method or steps of action, in which the value can be changed but the path is direct and the same.

 

We are talking about general concepts more in this class. I have been trying to let go of scribbling down every single instance that appears overhead like a looming alien invasion each key stroke populating the armada further. Are they friendly? That wouldn’t be my first guess, no.

Working on the first assignment today, I get trapped like a deer in the headlights.

This is a familiar feeling. It’s grant season and there is endless data to report, while in the middle of an application for an online finance academy I have this class to complete. Wasn’t I going to start dating again? I definitely wanted to take a calculus course over September.

Well, now it’s time for CS.

Our first assignment is creating a Class that takes inventory of how many characters are being used, as in the number of all the a’s, b’s, q’s. Simple enough.

Time for my favorite part- DIAGRAMS! They really only seem to serve the purpose of getting my brain unstuck, and coaxing my problem solving skills into reality.  It does work so I continue.