Shared posts

30 Mar 22:00

No Attributes in Objects

I just realised that I rarely define attributes in my classes (the dependency injection references are exceptions) and I’m passing everything as a parameter. So instead of this:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
class Foo
  attr_accessor :list

  def do_something
    @list = []
    action_1
    action_2
  end

  private
  def action1
    @list[2] = "a"
  end

  def action_2
    @list[1] = "b"
  end
end

I have this:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
class Foo
  def do_something
    list = []
    action_1(list)
    action_2(list)
  end

  private
  #   self. means that this is a class level method (static in Java)
  def self.action_1(list)
    list[2] = "a"
  end

  def self.action_2(list)
    list[1] = "b"
  end
end

Similarly to my spike workflow I realised what I’m unintentionally doing after actually having done it. I switched to this method because of the Unix philosophy: “The Unix philosophy emphasizes building short, simple, clear, modular, and extendable code that can be easily maintained and repurposed by developers other than its creators.”

More precisely: I switched to this method because I was struggling with the Unix philosophy. When I’m writing code I don’t know what the shortest and simplest entity in my code is so I put everything into a class and when it is done, I may refactor it into smaller classes. This refactoring work is very hard when I have tightly coupled methods, but when I have methods that are not coupled by attributes (except dependency injection references) then it is easy. In the code above I can simply move action_1 and action_2 anywhere I want:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
class Foo

  # I have an attribute here: @actions

  def initialize(actions)
    @actions = actions
  end

  def do_something
    list = []
    @actions.action_1(list)
    @actions.action_2(list)
  end
end

# ----

class Actions
  def action_1(list)
    list[2] = "a"
  end

  def action_2(list)
    list[1] = "b"
  end
end

The action_1 and action_2 methods are no longer class level methods (no .self) because it is easier to code dependency injection with object level methods.

I do this even if my class has an actual “state”:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
class Foo
  attr_accessor :last_element
  attr_accessor :list

  def do_iterate
    last_element = action_1(@last_element, @list)
  end

  private
  def self.action_1(last_element, list)
    list[2] = "a"
    last_element = 2
    return last_element
  end

end

Anyway, this is the first time a large refactoring is no longer a difficult and long process. Furthermore, there are no more surprises in my methods: I know what is going to happen just by looking at the method definition.

Related posts you may find also interesting:

07 Jun 18:07

Tuesday June 18th – Application Performance Management

by admin

This month Jeff Fynboh, a Senior Engineer with Compuware, will be speaking about application performance monitoring and management. Jeff has spent the last 9 years with Compuware focusing on Application Performance Management. He has worked with dozens of enterprise clients to help them troubleshoot issues related to their applications and he has been working with Java since the alpha and beta versions in the mid 1990’s. Jeff works closely with large organizations on a daily basis to help them follow discreet transactions through their Java and heterogeneous applications.

Location:
Gallup Riverfront Campus, 1001 Gallup Drive

Agenda:
5:30 Networking
6:00 Food – Courtesy of TekSystems
6:30 Presentation

07 Jun 18:06

Pastime

Good thing we're too smart to spend all day being uselessly frustrated with ourselves. I mean, that'd be a hell of a waste, right?
06 Jun 17:40

Posing Guide for Photographing Women: 7 Poses and 21 Different Photos

by Guest Contributor

A post by Kaspars Grinvalds from Posing App.

Previously published articles in the Posing Guide series contained hand illustrated posing samples as a guide or reference during your photo shoots. Based upon feedback and questions I received about these guides, I wanted to describe the process in a little more detail and show some real photos created while using these posing techniques.

I’d like to begin by stating once again – the main purpose of using posing samples is only to get your model into some starting point. That’s it. You don’t need to (and quite often you wouldn’t be able to) precisely recreate even the simplified illustrated pose.

This will be a three part series looking at standing, sitting and laying down poses for female models. For the the first article I chose seven sample standing poses and by slightly adjusting each pose I got 21 different photos. Now, let’s take a look at this process.

Pose 1

Pose1

It is a good idea to start your photo shoot with some very basic, easy pose. That’s why I chose this one to begin with. It’s easy to describe and easy to understand – “portrait shot from a side”. So you might start with saying to your model “Ok, turn with your side towards me, turn your head to me and look right over the shoulder at the camera. Straighten your spine and keep hands loose by sides.”

7poses 1

Photo 1 – With these instructions you should get something like the first picture. The next thing without changing the pose, is to “find” the face expression you’re looking for. You may want to try moving from very subtle smirks to stronger smiles or even laughter. And once you have the expression (or different ones) you’re after, tell and show it to the model. Thereby it will be easy for the model to learn and repeat it.

Photo 2 – After I got the simple and kind expression I was looking for, I slightly changed my position and asked the model to keep looking back over her shoulder to the camera. Exactly the same pose, just taken from another angle and you already have a slightly different photo.

Photo 3 – Also many different looking directions and head tilts are possible. In this particular example I asked the model to look back down her body. This look works very well in many posing situations, creating yet another variation just by slightly adjusting the starting pose.

Pose 2

Pose2

Seeing this sample illustration you should grab only the basic idea – “portrait shot with hands around the face”. That’s all you need for playing around with initial sample pose. Eventually you will come up with some nice variations of your own.

7poses 2

Photo 4 – Before getting to the hands, ask the model to stand facing the camera and support her body weight on just one leg. This instantly curves her body and her shoulder line is shifted. After that ask her to gently move her hands around the face and in the hair. Generally look for asymmetrical hand placements, but as you can imagine – many variations are possible.

Photo 5 – In this shot the only difference is slight tilting of the head and putting one hand behind the hair.

Photo 6 – To differentiate the look and feel, I once again asked the model to look down her own body and cropped tighter around the face. And again with only minor adjustments from one pose we’ve got 3 different photos.

Pose 3

Pose3

Another easy pose with very simple idea – “hands connected on the chest”. Notice that hands are not really “crossed”, but “connected”. Also you should warn your model not to grip them too tight or press upper arms against the body. Simply put, the posture should feel comfortable and subtle.

7poses 3

Photo 7 – Before taking this shot, I showed the model the sample illustration and she tried to recreate it. This is as close as you usually get if you recreate the sample pose.

Photo 8 – The outlines don’t and won’t match perfectly. In this particular example I took a shot from higher angle aiming slightly down because I saw that this angle works better for the model.

Photo 9 – Another simple way of transforming the pose is simply mirroring it the other way around. And to even more differentiate it from the first shot, I asked the model to lean against a wall.

And then I moved closer and took a head shot for just another variation of the same pose.

Pose 4

Pose4

This simple pose is again self-explanatory – “the model turned to the side with one hand on the waist”. That’s all I tried to recreate.

7poses 4

Photo 10 – Here I started straight away with mirroring the sample pose because this was the better looking side for my model. Remember that it is different for each person. If you are not sure, take both variations and ask your model which one she prefers.

Photo 11 – From side view I followed to 45 degree position and asked the model to keep looking to the camera.

Photo 12 – Lastly, I just moved farther away for wider frame. The same pose, but these minor variations provide you with greater choice of images to select from in post.

Pose 5

Pose5

This pose provides simple yet elegant at the wall concept – “standing at the wall with hands behind the back”.

7poses 5

Photo 13 – Start with asking your model to support herself at the wall with her back. After that the first thing to take care of is shifting her body weight on one leg with the other crossed over it. Even if the legs are not visible in the frame, it is critical for forming the model’s body in S shape. Then ask her to place her hands behind her back asymmetrically. Finally ask her to lean forward slightly away from the wall with her upper body part.

Photo 14 – As usual I tried changing my shooting angle and took the next shot more from a side.

Photo 15 – And I continued to experiment with slightly different hand placement and head tilt. These images might be very similar, but most probably your subjects will be grateful for this kind of choice.

Pose 6

Pose6

Another at the wall pose but this time with the model facing the wall. Easy to describe and recreate. Both hands are gently placed on the wall right in front of her just below the breast line.

7poses 6

Photo 16 – With the previous instructions the model easily achieved the described pose. And again I chose mirroring the sample illustration which already is one variation for any pose.

Photo 17 – Here I changed the shooting angle nearly parallel to the wall and cropped for a portrait shot.

Photo 18 – Finally the model changed the hand placement asymmetrically for just another variation.

Pose 7

Pose7

This is a bit more challenging pose than the previous ones, so definitely some guidance for the model is required in order to recreate it.

7poses 7

Photo 19 – The trick for the model here is to stand slightly off the wall and support herself against the wall with the front shoulder only. Front hand is loosened by the wall. After that the model should support the body weight on the outer leg, kicking the hip out with the inner leg crossed over. The back arm rests on the hip and the elbow is pulled behind her back.

Photo 20 – After managing the starting pose I started to variate it. Here I moved closer for tighter crop and asked the model to lean slightly forward along the wall.

Photo 21 – And finally I asked the model to turn sideways, supporting against the wall with both shoulders. And to further differentiate the shots I asked her to look down her body.

So, that’s it. Out of 7 sample poses we managed to get 21 different shots. And as you can easily imagine, even these are only samples, adjustments and variations are indeed endless.

All of these illustrations and many more posing samples are available on Posing App for your mobile devices.

Kaspars Grinvalds is a photographer working and living in Riga, Latvia. He is the author of Posing App where more poses and tips about people photography are available.

Post originally from: Digital Photography Tips.

Check out our more Photography Tips at Photography Tips for Beginners, Portrait Photography Tips and Wedding Photography Tips.

Posing Guide for Photographing Women: 7 Poses and 21 Different Photos

06 Jun 17:39

How to Make a Swiss Army Key Ring

by Tessa Miller

How to Make a Swiss Army Key Ring

Most people have to keep track of at least a few keys. The easiest way to do that is to just keep them all on one key ring. But the more keys you have, the bulkier the ring is to carry in your pocket. Here's an alternate design for holding and organizing your keys that's a little more efficient. The design is very similar in construction to a Swiss Army Knife, with the keys arranged on two parallel bars. Each key can be rotated into the handle for compact storage and rotated back out for use.

Read more...

    


06 Jun 17:39

Comic for June 6, 2013

06 Jun 17:38

Nomenclature

[shouted, from the field] 'Aunt Beast hit a pop fly to second! Dive for it, Mrs Whatsit!'
06 Jun 17:38

Long Exposure Photographs of Fireflies in the Forests of Nagoya City by Yume Cyan

by Christopher Jobson

Long Exposure Photographs of Fireflies in the Forests of Nagoya City by Yume Cyan long exposure Japan fireflies

Long Exposure Photographs of Fireflies in the Forests of Nagoya City by Yume Cyan long exposure Japan fireflies

Long Exposure Photographs of Fireflies in the Forests of Nagoya City by Yume Cyan long exposure Japan fireflies

Long Exposure Photographs of Fireflies in the Forests of Nagoya City by Yume Cyan long exposure Japan fireflies

Long Exposure Photographs of Fireflies in the Forests of Nagoya City by Yume Cyan long exposure Japan fireflies

For the last month or so photographer Yume Cyan has been shooting some magical long exposure photographs of fireflies in a forested area around Nagoya City, Japan. By keeping the camera’s shutter open at a low aperture Cyan captures every bioluminescent flash of each insect resulting in dotted light trails that criss-cross the frame. You may remember a similar series of photographs also shot in Japan from back in 2011. You can see these a bit larger over on 500px.