Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
W

wa1gon1

@wa1gon1
About
Posts
1
Topics
0
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • The latest dull fad - SOLID
    W wa1gon1

    I have been programming close to 40 years. SOLID is good, but it isn't a cure all. "If your only tool is a hammer, then every problem looks like a nail." However what I have found is projects that use SOLID and clean coding best practices tend to have few bugs and those bugs are easier to fix. Projects that didn't use SOLID and clean coding BP would end up being maintained by junior programmers and then rewritten. SRP has saved my tail many times, however it can be carried to extremes. For example: a = a + 1; Just a simple statement, but it violates SRP, because it does the following responsibilities: 1. Access memory 2. move a to an accumulator 3. load 1 into a register 4. add register to accumulator 5. save accumulator to memory Of course this is plain silly, but it goes to show that SRP can be taken to extremes. However the world responsibility really means it has one function. However the true meaning should be taken that it perform a single identifiable task. This task could be very complex for example launching a rocket. However within this Launch method, it may call other methods which also has a single responsibility and so on. My test is can you change anything in a method and it will still perform the correct operation as described by it's name. For example: AddItemToOrder(Order order, Item item,int NumOfItemsToAddToOrder) { DecrementItemCountInInventory(item,NumOfItemsToAddToOrder); var orderItem = new OrderItem(); orderItem.Item = item; orderItem.Qty = NumOfItemsToAddToOrder; OrderItemList.Add(orderItem); } This does two things: 1. It removes the count of items from the inventory 2. It adds an item to the order list. We could delete and change DecrementItemCountInInventory call without causing a problem with the function of this method. Of course it would screw up the database, but the order would be correct. Also another team working on the shipment part might also think they should decrement the count because it wasn't done in the mainly code. One of the things I try to do (of course not always possible) is to limit the functionality of a method to the point where the calling method knows if it was successful. Also there is exceptions. This method could throw 2 (out of memory and database exception). The logic to handle to exceptions from the calling method becomes much more complex.

    The Lounge oop architecture c++ css design
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups